@webex/plugin-device-manager 3.0.0-beta.15 → 3.0.0-beta.151

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.
@@ -1,29 +1,22 @@
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
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
14
-
15
10
  var _merge2 = _interopRequireDefault(require("lodash/merge"));
16
-
17
11
  var DeviceCollection = {
18
12
  devices: {},
19
13
  get: function get(deviceId) {
20
14
  return this.devices[deviceId];
21
15
  },
22
16
  set: function set(device) {
23
- var deviceId = device.id || device.identity && device.identity.id; // check if the device is already existing, if so then merge else add
24
-
17
+ var deviceId = device.id || device.identity && device.identity.id;
18
+ // check if the device is already existing, if so then merge else add
25
19
  var existingDevice = this.devices[deviceId];
26
-
27
20
  if (existingDevice) {
28
21
  // already existing, merge for any new binding information
29
22
  (0, _merge2.default)(existingDevice, device);
@@ -1 +1 @@
1
- {"version":3,"names":["DeviceCollection","devices","get","deviceId","set","device","id","identity","existingDevice","reset","getAll"],"sources":["collection.js"],"sourcesContent":["import {merge} from 'lodash';\n\nconst DeviceCollection = {\n devices: {},\n\n get(deviceId) {\n return this.devices[deviceId];\n },\n\n set(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n // check if the device is already existing, if so then merge else add\n const existingDevice = this.devices[deviceId];\n\n if (existingDevice) {\n // already existing, merge for any new binding information\n merge(existingDevice, device);\n } else {\n this.devices[deviceId] = device;\n }\n },\n\n reset() {\n this.devices = {};\n },\n\n getAll() {\n return Object.values(this.devices);\n },\n};\n\nexport default DeviceCollection;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAMA,gBAAgB,GAAG;EACvBC,OAAO,EAAE,EADc;EAGvBC,GAHuB,eAGnBC,QAHmB,EAGT;IACZ,OAAO,KAAKF,OAAL,CAAaE,QAAb,CAAP;EACD,CALsB;EAOvBC,GAPuB,eAOnBC,MAPmB,EAOX;IACV,IAAMF,QAAQ,GAAGE,MAAM,CAACC,EAAP,IAAcD,MAAM,CAACE,QAAP,IAAmBF,MAAM,CAACE,QAAP,CAAgBD,EAAlE,CADU,CAEV;;IACA,IAAME,cAAc,GAAG,KAAKP,OAAL,CAAaE,QAAb,CAAvB;;IAEA,IAAIK,cAAJ,EAAoB;MAClB;MACA,qBAAMA,cAAN,EAAsBH,MAAtB;IACD,CAHD,MAGO;MACL,KAAKJ,OAAL,CAAaE,QAAb,IAAyBE,MAAzB;IACD;EACF,CAlBsB;EAoBvBI,KApBuB,mBAoBf;IACN,KAAKR,OAAL,GAAe,EAAf;EACD,CAtBsB;EAwBvBS,MAxBuB,oBAwBd;IACP,OAAO,qBAAc,KAAKT,OAAnB,CAAP;EACD;AA1BsB,CAAzB;eA6BeD,gB"}
1
+ {"version":3,"names":["DeviceCollection","devices","get","deviceId","set","device","id","identity","existingDevice","reset","getAll"],"sources":["collection.js"],"sourcesContent":["import {merge} from 'lodash';\n\nconst DeviceCollection = {\n devices: {},\n\n get(deviceId) {\n return this.devices[deviceId];\n },\n\n set(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n // check if the device is already existing, if so then merge else add\n const existingDevice = this.devices[deviceId];\n\n if (existingDevice) {\n // already existing, merge for any new binding information\n merge(existingDevice, device);\n } else {\n this.devices[deviceId] = device;\n }\n },\n\n reset() {\n this.devices = {};\n },\n\n getAll() {\n return Object.values(this.devices);\n },\n};\n\nexport default DeviceCollection;\n"],"mappings":";;;;;;;;;;AAEA,IAAMA,gBAAgB,GAAG;EACvBC,OAAO,EAAE,CAAC,CAAC;EAEXC,GAAG,eAACC,QAAQ,EAAE;IACZ,OAAO,IAAI,CAACF,OAAO,CAACE,QAAQ,CAAC;EAC/B,CAAC;EAEDC,GAAG,eAACC,MAAM,EAAE;IACV,IAAMF,QAAQ,GAAGE,MAAM,CAACC,EAAE,IAAKD,MAAM,CAACE,QAAQ,IAAIF,MAAM,CAACE,QAAQ,CAACD,EAAG;IACrE;IACA,IAAME,cAAc,GAAG,IAAI,CAACP,OAAO,CAACE,QAAQ,CAAC;IAE7C,IAAIK,cAAc,EAAE;MAClB;MACA,qBAAMA,cAAc,EAAEH,MAAM,CAAC;IAC/B,CAAC,MAAM;MACL,IAAI,CAACJ,OAAO,CAACE,QAAQ,CAAC,GAAGE,MAAM;IACjC;EACF,CAAC;EAEDI,KAAK,mBAAG;IACN,IAAI,CAACR,OAAO,GAAG,CAAC,CAAC;EACnB,CAAC;EAEDS,MAAM,oBAAG;IACP,OAAO,qBAAc,IAAI,CAACT,OAAO,CAAC;EACpC;AACF,CAAC;AAAC,eAEaD,gBAAgB;AAAA"}
package/dist/config.js CHANGED
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
8
  var _default = {};
11
9
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["config.js"],"sourcesContent":["export default {};\n"],"mappings":";;;;;;;;;eAAe,E"}
1
+ {"version":3,"names":[],"sources":["config.js"],"sourcesContent":["export default {};\n"],"mappings":";;;;;;;eAAe,CAAC,CAAC;AAAA"}
package/dist/constants.js CHANGED
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.UC_CLOUD = exports.LYRA_SPACE = exports.DEFAULT_PRODUCT_NAME = void 0;
10
8
  var LYRA_SPACE = 'LYRA_SPACE';
11
9
  exports.LYRA_SPACE = LYRA_SPACE;
@@ -1 +1 @@
1
- {"version":3,"names":["LYRA_SPACE","UC_CLOUD","DEFAULT_PRODUCT_NAME"],"sources":["constants.js"],"sourcesContent":["export const LYRA_SPACE = 'LYRA_SPACE';\nexport const UC_CLOUD = 'uc-cloud';\nexport const DEFAULT_PRODUCT_NAME = 'default';\n"],"mappings":";;;;;;;;;AAAO,IAAMA,UAAU,GAAG,YAAnB;;AACA,IAAMC,QAAQ,GAAG,UAAjB;;AACA,IAAMC,oBAAoB,GAAG,SAA7B"}
1
+ {"version":3,"names":["LYRA_SPACE","UC_CLOUD","DEFAULT_PRODUCT_NAME"],"sources":["constants.js"],"sourcesContent":["export const LYRA_SPACE = 'LYRA_SPACE';\nexport const UC_CLOUD = 'uc-cloud';\nexport const DEFAULT_PRODUCT_NAME = 'default';\n"],"mappings":";;;;;;;AAAO,IAAMA,UAAU,GAAG,YAAY;AAAC;AAChC,IAAMC,QAAQ,GAAG,UAAU;AAAC;AAC5B,IAAMC,oBAAoB,GAAG,SAAS;AAAC"}
@@ -1,31 +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
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
14
-
15
10
  var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
16
-
17
11
  require("@webex/internal-plugin-lyra");
18
-
19
12
  require("@webex/internal-plugin-search");
20
-
21
13
  var _webexCore = require("@webex/webex-core");
22
-
23
14
  var _uuid = _interopRequireDefault(require("uuid"));
24
-
25
15
  var _constants = require("./constants");
26
-
27
16
  var _collection = _interopRequireDefault(require("./collection"));
28
-
29
17
  var DeviceManager = _webexCore.WebexPlugin.extend({
30
18
  namespace: 'DeviceManager',
31
19
  _devicePendingPinChallenge: null,
@@ -33,15 +21,12 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
33
21
  _boundSpace: null,
34
22
  initialize: function initialize() {
35
23
  var _this = this;
36
-
37
24
  // Lyra mercury events listener
38
25
  this.webex.internal.mercury.on('event:lyra.space_updated', function (_ref) {
39
26
  var data = _ref.data;
40
-
41
27
  _this._receiveDeviceUpdates(data);
42
28
  });
43
29
  },
44
-
45
30
  /**
46
31
  * Gets a list of all recent devices associated with the user
47
32
  * the device list gets populated from Redis
@@ -50,7 +35,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
50
35
  getAll: function getAll() {
51
36
  return _collection.default.getAll();
52
37
  },
53
-
54
38
  /**
55
39
  * Gets a list of all recent devices associated with the user
56
40
  * the device list gets populated from Redis
@@ -58,9 +42,7 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
58
42
  */
59
43
  refresh: function refresh() {
60
44
  var _this2 = this;
61
-
62
45
  _collection.default.reset();
63
-
64
46
  return this.webex.request({
65
47
  api: 'wdm',
66
48
  resource: 'devices/auxiliary'
@@ -68,7 +50,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
68
50
  if (!res.body) {
69
51
  return _promise.default.reject();
70
52
  }
71
-
72
53
  return _this2._updateDeviceMetadata(res.body.items).then(function (devices) {
73
54
  /* eslint-disable consistent-return */
74
55
  devices.forEach(function (device) {
@@ -79,7 +60,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
79
60
  }
80
61
  });
81
62
  /* eslint-enable consistent-return */
82
-
83
63
  res.body.items.forEach(function (device) {
84
64
  _collection.default.set(device);
85
65
  });
@@ -89,7 +69,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
89
69
  _this2.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);
90
70
  });
91
71
  },
92
-
93
72
  /**
94
73
  * Search for a device by name
95
74
  * @param {Object} options
@@ -98,12 +77,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
98
77
  */
99
78
  search: function search(options) {
100
79
  var _this3 = this;
101
-
102
80
  if (!options || !options.searchQuery) {
103
81
  this.logger.error('DeviceManager#search: options.searchQuery is required');
104
82
  return _promise.default.reject(new Error('DeviceManager#search: options.searchQuery is required'));
105
83
  }
106
-
107
84
  return this.webex.internal.search.people({
108
85
  searchId: _uuid.default.v4(),
109
86
  searchType: 'DEVICE_SEARCH',
@@ -113,11 +90,9 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
113
90
  queryString: options.searchQuery
114
91
  }).catch(function (err) {
115
92
  _this3.logger.error('DeviceManager#search: failed to search a device', err);
116
-
117
93
  throw err;
118
94
  });
119
95
  },
120
-
121
96
  /**
122
97
  * Caches the device info and also registers to Redis for subsequent fetches
123
98
  * @param {Object} device
@@ -126,26 +101,21 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
126
101
  */
127
102
  upsert: function upsert(device) {
128
103
  var _this4 = this;
129
-
130
104
  var deviceId = device.id || device.identity && device.identity.id;
131
-
132
105
  if (!deviceId) {
133
106
  this.logger.error('DeviceManager#upsert: device.id is required');
134
107
  return _promise.default.reject(new Error('DeviceManager#upsert: device.id is required'));
135
108
  }
136
-
137
109
  this._pairedDevice = this._devicePendingPinChallenge;
138
- this._devicePendingPinChallenge = null; // check if the device is already existing, if so then merge else add
139
-
110
+ this._devicePendingPinChallenge = null;
111
+ // check if the device is already existing, if so then merge else add
140
112
  var existingDevice = _collection.default.get(deviceId);
141
-
142
113
  if (existingDevice) {
143
114
  _collection.default.set(device);
144
-
145
115
  return _promise.default.resolve(_collection.default.get(deviceId));
146
- } // new device requested, add to wdm for subsequent retreivals
147
-
116
+ }
148
117
 
118
+ // new device requested, add to wdm for subsequent retreivals
149
119
  return this.webex.request({
150
120
  api: 'wdm',
151
121
  method: 'PUT',
@@ -153,18 +123,16 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
153
123
  }).then(function (res) {
154
124
  var auxDevice = res.body;
155
125
  return _this4._decryptDeviceName(auxDevice);
156
- }) // eslint-disable-next-line no-shadow
126
+ })
127
+ // eslint-disable-next-line no-shadow
157
128
  .then(function (device) {
158
129
  _collection.default.set(device);
159
-
160
130
  return _promise.default.resolve(_collection.default.get(deviceId));
161
131
  }).catch(function (err) {
162
132
  _this4.logger.error('DeviceManager#upsert: failed to add/update a device', err);
163
-
164
133
  return _promise.default.reject(err);
165
134
  });
166
135
  },
167
-
168
136
  /**
169
137
  * Retreives device info of a particular device
170
138
  * @param {string} token
@@ -172,12 +140,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
172
140
  */
173
141
  get: function get(token) {
174
142
  var _this5 = this;
175
-
176
143
  if (!token) {
177
144
  this.logger.error('DeviceManager#get: token is required');
178
145
  return _promise.default.reject(new Error('DeviceManager#get: token is required'));
179
146
  }
180
-
181
147
  var deviceInfo;
182
148
  return this.webex.internal.lyra.getAdvertisedEndpoint(token).then(function (res) {
183
149
  deviceInfo = res;
@@ -190,15 +156,12 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
190
156
  if (result && result.identity && result.identity.displayName) {
191
157
  deviceInfo.advertiser.displayName = result.identity.displayName;
192
158
  }
193
-
194
159
  return deviceInfo;
195
160
  }).catch(function (err) {
196
161
  _this5.logger.error('DeviceManager#get: failed to get device info', err);
197
-
198
162
  return _promise.default.reject(err);
199
163
  });
200
164
  },
201
-
202
165
  /**
203
166
  * Unregisters the device from Redis, will not fetch in subsequent loads,
204
167
  * similar to space.deleteBinding()
@@ -207,23 +170,19 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
207
170
  */
208
171
  remove: function remove(deviceId) {
209
172
  var _this6 = this;
210
-
211
173
  if (!deviceId) {
212
174
  this.logger.error('DeviceManager#remove: deviceId is required');
213
175
  return _promise.default.reject(new Error('DeviceManager#remove: deviceId is required'));
214
176
  }
215
-
216
177
  return this.webex.request({
217
178
  method: 'delete',
218
179
  api: 'wdm',
219
180
  resource: "devices/auxiliary/".concat(deviceId)
220
181
  }).catch(function (error) {
221
182
  _this6.logger.error('DeviceManager#remove: failed to remove the device', error);
222
-
223
183
  return _promise.default.reject(error);
224
184
  });
225
185
  },
226
-
227
186
  /**
228
187
  * Requests to display PIN on the device
229
188
  * @param {object} device
@@ -233,15 +192,12 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
233
192
  */
234
193
  requestPin: function requestPin(device) {
235
194
  var _this7 = this;
236
-
237
195
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
238
196
  var deviceId = device.id || device.identity && device.identity.id;
239
-
240
197
  if (!deviceId) {
241
198
  this.logger.error('DeviceManager#requestPin: device.id is required');
242
199
  return _promise.default.reject(new Error('DeviceManager#requestPin: device.id is required'));
243
200
  }
244
-
245
201
  var space = {
246
202
  id: deviceId,
247
203
  url: "/spaces/".concat(deviceId)
@@ -250,32 +206,28 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
250
206
  // check if the space is pinChallenge capable
251
207
  if (dev && dev.occupants && dev.occupants.pinChallenge) {
252
208
  _this7.logger.info('DeviceManager#requestPin: space is PIN challenge capable');
253
-
254
209
  return _this7.webex.internal.lyra.space.join(space, {
255
210
  passType: 'MANUAL',
256
211
  verificationInitiation: 'PIN',
257
212
  data: options.data
258
213
  }).then(function () {
259
- _this7._devicePendingPinChallenge = dev; // return the actual device so that it can be upserted on successful
260
- // PIN exchange
214
+ _this7._devicePendingPinChallenge = dev;
261
215
 
216
+ // return the actual device so that it can be upserted on successful
217
+ // PIN exchange
262
218
  return dev;
263
219
  });
264
- } // pairs with the space if it's not PIN challenge capable
265
-
266
-
220
+ }
221
+ // pairs with the space if it's not PIN challenge capable
267
222
  _this7.logger.info('DeviceManager#requestPin: space is not PIN challenge capable, probably already occupied, will still return device info');
268
-
269
223
  return _this7.webex.internal.lyra.space.get(space).then(function () {
270
224
  return _promise.default.resolve(dev);
271
225
  });
272
226
  }).catch(function (err) {
273
227
  _this7.logger.error('DeviceManager#requestPin: device failed PIN challenge request', err);
274
-
275
228
  return _promise.default.reject(err);
276
229
  });
277
230
  },
278
-
279
231
  /**
280
232
  * pairs the device with the user (manual pairing), also adds it to
281
233
  * user's recents list for subsequent fetches.
@@ -286,14 +238,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
286
238
  */
287
239
  pair: function pair() {
288
240
  var _this8 = this;
289
-
290
241
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
291
-
292
242
  if (!options.pin) {
293
243
  this.logger.error('DeviceManager#pair: options.pin is required');
294
244
  return _promise.default.reject(new Error('DeviceManager#pair: options.pin is required'));
295
245
  }
296
-
297
246
  if (this._devicePendingPinChallenge) {
298
247
  var space = {
299
248
  id: this._devicePendingPinChallenge.identity.id,
@@ -304,17 +253,14 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
304
253
  data: options.pin
305
254
  }).catch(function (err) {
306
255
  _this8.logger.error('DeviceManager#pair: incorrect PIN, unable to pair ', err);
307
-
308
256
  return _promise.default.reject(err);
309
257
  }).then(function () {
310
258
  return _this8.upsert(_this8._devicePendingPinChallenge);
311
259
  });
312
260
  }
313
-
314
261
  this.logger.error('DeviceManager#pair: no device to pair');
315
262
  return _promise.default.reject(new Error('DeviceManager#pair: no device to pair'));
316
263
  },
317
-
318
264
  /**
319
265
  * unpairs the device with the user (manual/ultrasonic pairing), but still
320
266
  * keeps in the recents list/does not remove from Redis
@@ -326,24 +272,19 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
326
272
  */
327
273
  unpair: function unpair() {
328
274
  var _this9 = this;
329
-
330
275
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
331
-
332
276
  if (!this._pairedDevice) {
333
277
  this.logger.error('DeviceManager#unpair: no device to unpair');
334
278
  return _promise.default.reject(new Error('DeviceManager#unpair: no device to unpair'));
335
279
  }
336
-
337
280
  var space = {
338
281
  url: "/spaces/".concat(this._pairedDevice.identity.id)
339
282
  };
340
283
  return this.webex.internal.lyra.space.leave(space, options).catch(function (err) {
341
284
  _this9.logger.error('DeviceManager#unpair: failed to remove device from Lyra', err);
342
-
343
285
  return _promise.default.reject(err);
344
286
  });
345
287
  },
346
-
347
288
  /**
348
289
  * binds the space to the paired device (if supported)
349
290
  * similar to space.bindConversation()
@@ -354,24 +295,19 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
354
295
  */
355
296
  bindSpace: function bindSpace() {
356
297
  var _this10 = this;
357
-
358
298
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
359
-
360
299
  if (!options.url) {
361
300
  this.logger.error('DeviceManager#pair: options.url is required');
362
301
  return _promise.default.reject(new Error('DeviceManager#bindSpace: options.url is required'));
363
302
  }
364
-
365
303
  if (!options.kmsResourceObjectUrl) {
366
304
  this.logger.error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required');
367
305
  return _promise.default.reject(new Error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required'));
368
306
  }
369
-
370
307
  if (!this._pairedDevice) {
371
308
  this.logger.error('DeviceManager#bindSpace: No device paired currently');
372
309
  return _promise.default.reject(new Error('DeviceManager#bindSpace: No device paired currently'));
373
310
  }
374
-
375
311
  var space = {
376
312
  url: "/spaces/".concat(this._pairedDevice.identity.id),
377
313
  id: this._pairedDevice.identity.id
@@ -382,11 +318,9 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
382
318
  };
383
319
  return this.webex.internal.lyra.space.bindConversation(space, this._boundSpace).catch(function (err) {
384
320
  _this10.logger.error('DeviceManager#bindSpace: failed to bind device to Space');
385
-
386
321
  return _promise.default.reject(err);
387
322
  });
388
323
  },
389
-
390
324
  /**
391
325
  * unbinds the space to the paired device (if supported)
392
326
  * similar to space.unbindConversation()
@@ -394,12 +328,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
394
328
  */
395
329
  unbindSpace: function unbindSpace() {
396
330
  var _this11 = this;
397
-
398
331
  if (!this._pairedDevice || !this._boundSpace) {
399
332
  this.logger.error('DeviceManager#unbindSpace: No space currently bound to the device');
400
333
  return _promise.default.reject(new Error('DeviceManager#unbindSpace: No space currently bound to the device'));
401
334
  }
402
-
403
335
  var space = {
404
336
  url: "/spaces/".concat(this._pairedDevice.identity.id),
405
337
  id: this._pairedDevice.identity.id
@@ -409,11 +341,9 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
409
341
  return _promise.default.resolve(res);
410
342
  }).catch(function (err) {
411
343
  _this11.logger.error('DeviceManager#unbindSpace: failed to unbind Space to device');
412
-
413
344
  return _promise.default.reject(err);
414
345
  });
415
346
  },
416
-
417
347
  /**
418
348
  * Gets the audio state of the paired device
419
349
  * similar to device.getAudioState()
@@ -424,10 +354,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
424
354
  this.logger.error('DeviceManager#getAudioState: Currently no device is paired');
425
355
  return _promise.default.reject(new Error('DeviceManager#getAudioState: Currently no device is paired'));
426
356
  }
427
-
428
357
  return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);
429
358
  },
430
-
431
359
  /**
432
360
  * Updates audio state of the paired device, should be called every 10 minutes
433
361
  * or when mic or volume state is changed
@@ -440,7 +368,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
440
368
  var audioState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
441
369
  return this.webex.internal.lyra.device.putAudioState(space, audioState);
442
370
  },
443
-
444
371
  /**
445
372
  * Mutes paired device
446
373
  * similar to device.mute()
@@ -451,10 +378,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
451
378
  this.logger.error('DeviceManager#mute: Currently no device is paired');
452
379
  return _promise.default.reject(new Error('DeviceManager#mute: Currently no device is paired'));
453
380
  }
454
-
455
381
  return this.webex.internal.lyra.device.mute(this._pairedDevice);
456
382
  },
457
-
458
383
  /**
459
384
  * Unmutes paired device
460
385
  * similar to device.unmute()
@@ -465,10 +390,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
465
390
  this.logger.error('DeviceManager#unmute: Currently no device is paired');
466
391
  return _promise.default.reject(new Error('DeviceManager#unmute: Currently no device is paired'));
467
392
  }
468
-
469
393
  return this.webex.internal.lyra.device.unmute(this._pairedDevice);
470
394
  },
471
-
472
395
  /**
473
396
  * Increases paired device's volume
474
397
  * similar to device.increaseVolume()
@@ -479,10 +402,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
479
402
  this.logger.error('DeviceManager#increaseVolume: Currently no device is paired');
480
403
  return _promise.default.reject(new Error('DeviceManager#increaseVolume: Currently no device is paired'));
481
404
  }
482
-
483
405
  return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);
484
406
  },
485
-
486
407
  /**
487
408
  * Decreases paired device's volume
488
409
  * similar to device.decreaseVolume()
@@ -493,10 +414,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
493
414
  this.logger.error('DeviceManager#decreaseVolume: Currently no device is paired');
494
415
  return _promise.default.reject(new Error('DeviceManager#decreaseVolume: Currently no device is paired'));
495
416
  }
496
-
497
417
  return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);
498
418
  },
499
-
500
419
  /**
501
420
  * Sets paired device's volume but should use increase and decrease api instead
502
421
  * similar to device.setVolume()
@@ -505,15 +424,12 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
505
424
  */
506
425
  setVolume: function setVolume() {
507
426
  var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
508
-
509
427
  if (!this._pairedDevice) {
510
428
  this.logger.error('DeviceManager#setVolume: Currently no device is paired');
511
429
  return _promise.default.reject(new Error('DeviceManager#setVolume: Currently no device is paired'));
512
430
  }
513
-
514
431
  return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);
515
432
  },
516
-
517
433
  /**
518
434
  * Utility function to update decrypted device name on device object
519
435
  * @param {Array} deviceArray
@@ -521,20 +437,16 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
521
437
  */
522
438
  _updateDeviceMetadata: function _updateDeviceMetadata() {
523
439
  var _this12 = this;
524
-
525
440
  var deviceArray = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
526
-
527
441
  if (!deviceArray.length) {
528
442
  return _promise.default.resolve(deviceArray);
529
443
  }
530
-
531
444
  var devices = (0, _cloneDeep2.default)(deviceArray);
532
445
  return _promise.default.all(devices.map(function (device, index) {
533
446
  return _this12.webex.internal.services.waitForCatalog('postauth').then(function () {
534
447
  if (device.deviceClass === _constants.UC_CLOUD) {
535
448
  device.id = "".concat(_this12.webex.internal.services.get('wdm'), "/").concat(device.id);
536
449
  }
537
-
538
450
  return _this12._decryptDeviceName(device);
539
451
  }).then(function (updatedDevice) {
540
452
  devices[index] = updatedDevice;
@@ -544,7 +456,6 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
544
456
  return _promise.default.resolve(devices);
545
457
  });
546
458
  },
547
-
548
459
  /**
549
460
  * Utility function to update decrypted device name on device object
550
461
  * @param {object} inDevice
@@ -552,10 +463,8 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
552
463
  */
553
464
  _decryptDeviceName: function _decryptDeviceName() {
554
465
  var _this13 = this;
555
-
556
466
  var inDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
557
467
  var device = (0, _cloneDeep2.default)(inDevice);
558
-
559
468
  if (device.metadata && device.metadata.encryptedUserAssignedName && device.metadata.encryptionKeyUrl) {
560
469
  return this.webex.internal.encryption.decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName).then(function (decryptedDeviceName) {
561
470
  // set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed
@@ -565,14 +474,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
565
474
  }).catch(function (err) {
566
475
  // unset encryptedUserAssignedName if failed to decrypt
567
476
  device.metadata.encryptedUserAssignedName = undefined;
568
-
569
477
  _this13.logger.error('DeviceCollection#_decryptDeviceName: failed to decrypt device name', err);
570
478
  });
571
479
  }
572
-
573
480
  return _promise.default.resolve(device);
574
481
  },
575
-
576
482
  /**
577
483
  * Utility function to update device info on mercury updates
578
484
  * @param {object} device
@@ -580,54 +486,42 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
580
486
  */
581
487
  _receiveDeviceUpdates: function _receiveDeviceUpdates(device) {
582
488
  var _this14 = this;
583
-
584
489
  // we care only the updates are for the registered devices
585
490
  if (device && device.spaceUrl) {
586
491
  var deviceId = device.spaceUrl.substring(device.spaceUrl.lastIndexOf('/') + 1);
587
-
588
492
  var existingDevice = _collection.default.get(deviceId);
589
-
590
493
  if (existingDevice) {
591
494
  return this.webex.internal.lyra.space.get({
592
495
  id: deviceId
593
496
  }).then(function (space) {
594
497
  // eslint-disable-next-line no-shadow
595
498
  var device = _collection.default.get(deviceId);
596
-
597
499
  if (device && space.occupants && (!space.occupants.self || !space.occupants.self.verified)) {
598
- device.productName = space.devices && space.devices[0] && space.devices[0].productName || _constants.DEFAULT_PRODUCT_NAME; // pin challenge is not verified reset _pairedDevice if ids
500
+ device.productName = space.devices && space.devices[0] && space.devices[0].productName || _constants.DEFAULT_PRODUCT_NAME;
501
+ // pin challenge is not verified reset _pairedDevice if ids
599
502
  // match
600
-
601
503
  var pairedDeviceId = _this14._pairedDevice && (_this14._pairedDevice.id || _this14._pairedDevice.identity.id);
602
-
603
504
  if (pairedDeviceId === deviceId) {
604
505
  _this14._pairedDevice = null;
605
-
606
506
  _this14.logger.info("DeviceManager#_receiveDeviceUpdates: device ".concat(deviceId, " lost pairing"));
607
-
608
507
  return _promise.default.resolve();
609
- } // we do not want to reset the device pending PIN challenge
610
-
611
-
508
+ }
509
+ // we do not want to reset the device pending PIN challenge
612
510
  if (_this14._devicePendingPinChallenge.identity.id !== deviceId) {
613
511
  return _this14.upsert(device);
614
512
  }
615
-
616
513
  return _promise.default.resolve();
617
514
  }
618
-
619
515
  return _promise.default.resolve();
620
516
  }).catch(function (err) {
621
517
  _this14.logger.error('DeviceManager#_receiveDeviceUpdates: failed to receive updates for Lyra space', err);
622
518
  });
623
519
  }
624
520
  }
625
-
626
521
  return _promise.default.resolve();
627
522
  },
628
- version: "3.0.0-beta.15"
523
+ version: "3.0.0-beta.151"
629
524
  });
630
-
631
525
  var _default = DeviceManager;
632
526
  exports.default = _default;
633
527
  //# sourceMappingURL=device-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DeviceManager","WebexPlugin","extend","namespace","_devicePendingPinChallenge","_pairedDevice","_boundSpace","initialize","webex","internal","mercury","on","data","_receiveDeviceUpdates","getAll","DeviceCollection","refresh","reset","request","api","resource","then","res","body","reject","_updateDeviceMetadata","items","devices","forEach","device","deviceInfo","machineType","LYRA_SPACE","lyra","space","get","catch","err","logger","error","set","search","options","searchQuery","Error","people","searchId","uuid","v4","searchType","searchEntity","includePeople","includeRooms","queryString","upsert","deviceId","id","identity","existingDevice","resolve","method","auxDevice","_decryptDeviceName","token","getAdvertisedEndpoint","advertiser","result","displayName","remove","requestPin","url","dev","occupants","pinChallenge","info","join","passType","verificationInitiation","pair","pin","unpair","leave","bindSpace","kmsResourceObjectUrl","bindConversation","unbindSpace","unbindConversation","getAudioState","putAudioState","audioState","mute","unmute","increaseVolume","decreaseVolume","setVolume","level","deviceArray","length","all","map","index","services","waitForCatalog","deviceClass","UC_CLOUD","updatedDevice","inDevice","metadata","encryptedUserAssignedName","encryptionKeyUrl","encryption","decryptText","decryptedDeviceName","undefined","userAssignedName","spaceUrl","substring","lastIndexOf","self","verified","productName","DEFAULT_PRODUCT_NAME","pairedDeviceId"],"sources":["device-manager.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport {cloneDeep} from 'lodash';\nimport '@webex/internal-plugin-lyra';\nimport '@webex/internal-plugin-search';\nimport {WebexPlugin} from '@webex/webex-core';\nimport uuid from 'uuid';\n\nimport {LYRA_SPACE, UC_CLOUD, DEFAULT_PRODUCT_NAME} from './constants';\nimport DeviceCollection from './collection';\n\nconst DeviceManager = WebexPlugin.extend({\n namespace: 'DeviceManager',\n _devicePendingPinChallenge: null,\n _pairedDevice: null,\n _boundSpace: null,\n\n initialize() {\n // Lyra mercury events listener\n this.webex.internal.mercury.on('event:lyra.space_updated', ({data}) => {\n this._receiveDeviceUpdates(data);\n });\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n getAll() {\n return DeviceCollection.getAll();\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n refresh() {\n DeviceCollection.reset();\n\n return this.webex\n .request({\n api: 'wdm',\n resource: 'devices/auxiliary',\n })\n .then((res) => {\n if (!res.body) {\n return Promise.reject();\n }\n\n return this._updateDeviceMetadata(res.body.items).then((devices) => {\n /* eslint-disable consistent-return */\n devices.forEach((device) => {\n if (device.deviceInfo && device.deviceInfo.machineType === LYRA_SPACE) {\n return this.webex.internal.lyra.space.get(device.deviceInfo).catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to receive device info', err);\n });\n }\n });\n /* eslint-enable consistent-return */\n res.body.items.forEach((device) => {\n DeviceCollection.set(device);\n });\n\n return this.getAll();\n });\n })\n .catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);\n });\n },\n\n /**\n * Search for a device by name\n * @param {Object} options\n * @param {string} options.searchQuery\n * @returns {Promise<Device>}\n */\n search(options) {\n if (!options || !options.searchQuery) {\n this.logger.error('DeviceManager#search: options.searchQuery is required');\n\n return Promise.reject(new Error('DeviceManager#search: options.searchQuery is required'));\n }\n\n return this.webex.internal.search\n .people({\n searchId: uuid.v4(),\n searchType: 'DEVICE_SEARCH',\n searchEntity: 'device',\n includePeople: false,\n includeRooms: true,\n queryString: options.searchQuery,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#search: failed to search a device', err);\n\n throw err;\n });\n },\n\n /**\n * Caches the device info and also registers to Redis for subsequent fetches\n * @param {Object} device\n * @param {string} device.id\n * @returns {deviceInfo}\n */\n upsert(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#upsert: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#upsert: device.id is required'));\n }\n this._pairedDevice = this._devicePendingPinChallenge;\n this._devicePendingPinChallenge = null;\n // check if the device is already existing, if so then merge else add\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n }\n\n // new device requested, add to wdm for subsequent retreivals\n return (\n this.webex\n .request({\n api: 'wdm',\n method: 'PUT',\n resource: `devices/auxiliary/Room/${deviceId}`,\n })\n .then((res) => {\n const auxDevice = res.body;\n\n return this._decryptDeviceName(auxDevice);\n })\n // eslint-disable-next-line no-shadow\n .then((device) => {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#upsert: failed to add/update a device', err);\n\n return Promise.reject(err);\n })\n );\n },\n\n /**\n * Retreives device info of a particular device\n * @param {string} token\n * @returns {Promise<deviceInfo>}\n */\n get(token) {\n if (!token) {\n this.logger.error('DeviceManager#get: token is required');\n\n return Promise.reject(new Error('DeviceManager#get: token is required'));\n }\n let deviceInfo;\n\n return this.webex.internal.lyra\n .getAdvertisedEndpoint(token)\n .then((res) => {\n deviceInfo = res;\n\n return this.webex.internal.lyra.space.get({id: res.advertiser.id});\n })\n .then((result) => {\n // the deviceInfo doesn't have proper displayName, hence update\n // displayName on deviceInfo for search to work\n if (result && result.identity && result.identity.displayName) {\n deviceInfo.advertiser.displayName = result.identity.displayName;\n }\n\n return deviceInfo;\n })\n .catch((err) => {\n this.logger.error('DeviceManager#get: failed to get device info', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Unregisters the device from Redis, will not fetch in subsequent loads,\n * similar to space.deleteBinding()\n * @param {string} deviceId\n * @returns {Promise<deviceInfo>}\n */\n remove(deviceId) {\n if (!deviceId) {\n this.logger.error('DeviceManager#remove: deviceId is required');\n\n return Promise.reject(new Error('DeviceManager#remove: deviceId is required'));\n }\n\n return this.webex\n .request({\n method: 'delete',\n api: 'wdm',\n resource: `devices/auxiliary/${deviceId}`,\n })\n .catch((error) => {\n this.logger.error('DeviceManager#remove: failed to remove the device', error);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Requests to display PIN on the device\n * @param {object} device\n * @param {object} options\n * @param {object} options.data\n * @returns {Promise<deviceInfo>}\n */\n requestPin(device, options = {}) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#requestPin: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#requestPin: device.id is required'));\n }\n const space = {id: deviceId, url: `/spaces/${deviceId}`};\n\n return this.webex.internal.lyra.space\n .get(space)\n .then((dev) => {\n // check if the space is pinChallenge capable\n if (dev && dev.occupants && dev.occupants.pinChallenge) {\n this.logger.info('DeviceManager#requestPin: space is PIN challenge capable');\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'MANUAL',\n verificationInitiation: 'PIN',\n data: options.data,\n })\n .then(() => {\n this._devicePendingPinChallenge = dev;\n\n // return the actual device so that it can be upserted on successful\n // PIN exchange\n return dev;\n });\n }\n // pairs with the space if it's not PIN challenge capable\n this.logger.info(\n 'DeviceManager#requestPin: space is not PIN challenge capable, probably already occupied, will still return device info'\n );\n\n return this.webex.internal.lyra.space.get(space).then(() => Promise.resolve(dev));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#requestPin: device failed PIN challenge request', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * pairs the device with the user (manual pairing), also adds it to\n * user's recents list for subsequent fetches.\n * similar to space.join()\n * @param {object} options\n * @param {number} options.pin\n * @returns {Promise<deviceInfo>}\n */\n pair(options = {}) {\n if (!options.pin) {\n this.logger.error('DeviceManager#pair: options.pin is required');\n\n return Promise.reject(new Error('DeviceManager#pair: options.pin is required'));\n }\n if (this._devicePendingPinChallenge) {\n const space = {\n id: this._devicePendingPinChallenge.identity.id,\n url: `/spaces/${this._devicePendingPinChallenge.identity.id}`,\n };\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'PIN_ANSWER',\n data: options.pin,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#pair: incorrect PIN, unable to pair ', err);\n\n return Promise.reject(err);\n })\n .then(() => this.upsert(this._devicePendingPinChallenge));\n }\n this.logger.error('DeviceManager#pair: no device to pair');\n\n return Promise.reject(new Error('DeviceManager#pair: no device to pair'));\n },\n\n /**\n * unpairs the device with the user (manual/ultrasonic pairing), but still\n * keeps in the recents list/does not remove from Redis\n * options.removeAllDevices will remove all associated devices to user\n * similar to space.leave()\n * @param {object} options\n * @param {boolean} options.removeAllDevices\n * @returns {Promise<deviceInfo>}\n */\n unpair(options = {}) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unpair: no device to unpair');\n\n return Promise.reject(new Error('DeviceManager#unpair: no device to unpair'));\n }\n const space = {url: `/spaces/${this._pairedDevice.identity.id}`};\n\n return this.webex.internal.lyra.space.leave(space, options).catch((err) => {\n this.logger.error('DeviceManager#unpair: failed to remove device from Lyra', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * binds the space to the paired device (if supported)\n * similar to space.bindConversation()\n * @param {object} options\n * @param {boolean} options.url, conversation url\n * @param {boolean} options.kmsResourceObjectUrl of the convo\n * @returns {Promise<deviceInfo>}\n */\n bindSpace(options = {}) {\n if (!options.url) {\n this.logger.error('DeviceManager#pair: options.url is required');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: options.url is required'));\n }\n if (!options.kmsResourceObjectUrl) {\n this.logger.error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required');\n\n return Promise.reject(\n new Error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required')\n );\n }\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#bindSpace: No device paired currently');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: No device paired currently'));\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n this._boundSpace = {\n kmsResourceObjectUrl: options.kmsResourceObjectUrl,\n url: options.url,\n };\n\n return this.webex.internal.lyra.space.bindConversation(space, this._boundSpace).catch((err) => {\n this.logger.error('DeviceManager#bindSpace: failed to bind device to Space');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * unbinds the space to the paired device (if supported)\n * similar to space.unbindConversation()\n * @returns {Promise<deviceInfo>}\n */\n unbindSpace() {\n if (!this._pairedDevice || !this._boundSpace) {\n this.logger.error('DeviceManager#unbindSpace: No space currently bound to the device');\n\n return Promise.reject(\n new Error('DeviceManager#unbindSpace: No space currently bound to the device')\n );\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n return this.webex.internal.lyra.space\n .unbindConversation(space, this._boundSpace)\n .then((res) => {\n this._boundSpace = null;\n\n return Promise.resolve(res);\n })\n .catch((err) => {\n this.logger.error('DeviceManager#unbindSpace: failed to unbind Space to device');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Gets the audio state of the paired device\n * similar to device.getAudioState()\n * @returns {Promise<audioState>}\n */\n getAudioState() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#getAudioState: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#getAudioState: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);\n },\n\n /**\n * Updates audio state of the paired device, should be called every 10 minutes\n * or when mic or volume state is changed\n * similar to device.putAudioState()\n * @param {object} space\n * @param {object} audioState\n * @returns {Promise<audioState>}\n */\n putAudioState(space, audioState = {}) {\n return this.webex.internal.lyra.device.putAudioState(space, audioState);\n },\n\n /**\n * Mutes paired device\n * similar to device.mute()\n * @returns {Promise<audioState>}\n */\n mute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#mute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#mute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.mute(this._pairedDevice);\n },\n\n /**\n * Unmutes paired device\n * similar to device.unmute()\n * @returns {Promise<audioState>}\n */\n unmute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unmute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#unmute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.unmute(this._pairedDevice);\n },\n\n /**\n * Increases paired device's volume\n * similar to device.increaseVolume()\n * @returns {Promise<audioState>}\n */\n increaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#increaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#increaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);\n },\n\n /**\n * Decreases paired device's volume\n * similar to device.decreaseVolume()\n * @returns {Promise<audioState>}\n */\n decreaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#decreaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#decreaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);\n },\n\n /**\n * Sets paired device's volume but should use increase and decrease api instead\n * similar to device.setVolume()\n * @param {number} level\n * @returns {Promise<audioState>}\n */\n setVolume(level = 0) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#setVolume: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#setVolume: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {Array} deviceArray\n * @returns {device}\n */\n _updateDeviceMetadata(deviceArray = []) {\n if (!deviceArray.length) {\n return Promise.resolve(deviceArray);\n }\n const devices = cloneDeep(deviceArray);\n\n return Promise.all(\n devices.map((device, index) =>\n this.webex.internal.services\n .waitForCatalog('postauth')\n .then(() => {\n if (device.deviceClass === UC_CLOUD) {\n device.id = `${this.webex.internal.services.get('wdm')}/${device.id}`;\n }\n\n return this._decryptDeviceName(device);\n })\n .then((updatedDevice) => {\n devices[index] = updatedDevice;\n\n return Promise.resolve();\n })\n )\n ).then(() => Promise.resolve(devices));\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {object} inDevice\n * @returns {device}\n */\n _decryptDeviceName(inDevice = {}) {\n const device = cloneDeep(inDevice);\n\n if (\n device.metadata &&\n device.metadata.encryptedUserAssignedName &&\n device.metadata.encryptionKeyUrl\n ) {\n return this.webex.internal.encryption\n .decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName)\n .then((decryptedDeviceName) => {\n // set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed\n device.metadata.encryptedUserAssignedName = undefined;\n device.metadata.userAssignedName = decryptedDeviceName;\n\n return Promise.resolve(device);\n })\n .catch((err) => {\n // unset encryptedUserAssignedName if failed to decrypt\n device.metadata.encryptedUserAssignedName = undefined;\n this.logger.error(\n 'DeviceCollection#_decryptDeviceName: failed to decrypt device name',\n err\n );\n });\n }\n\n return Promise.resolve(device);\n },\n\n /**\n * Utility function to update device info on mercury updates\n * @param {object} device\n * @returns {device}\n */\n _receiveDeviceUpdates(device) {\n // we care only the updates are for the registered devices\n if (device && device.spaceUrl) {\n const deviceId = device.spaceUrl.substring(device.spaceUrl.lastIndexOf('/') + 1);\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n return this.webex.internal.lyra.space\n .get({id: deviceId})\n .then((space) => {\n // eslint-disable-next-line no-shadow\n const device = DeviceCollection.get(deviceId);\n\n if (\n device &&\n space.occupants &&\n (!space.occupants.self || !space.occupants.self.verified)\n ) {\n device.productName =\n (space.devices && space.devices[0] && space.devices[0].productName) ||\n DEFAULT_PRODUCT_NAME;\n // pin challenge is not verified reset _pairedDevice if ids\n // match\n const pairedDeviceId =\n this._pairedDevice && (this._pairedDevice.id || this._pairedDevice.identity.id);\n\n if (pairedDeviceId === deviceId) {\n this._pairedDevice = null;\n this.logger.info(\n `DeviceManager#_receiveDeviceUpdates: device ${deviceId} lost pairing`\n );\n\n return Promise.resolve();\n }\n // we do not want to reset the device pending PIN challenge\n if (this._devicePendingPinChallenge.identity.id !== deviceId) {\n return this.upsert(device);\n }\n\n return Promise.resolve();\n }\n\n return Promise.resolve();\n })\n .catch((err) => {\n this.logger.error(\n 'DeviceManager#_receiveDeviceUpdates: failed to receive updates for Lyra space',\n err\n );\n });\n }\n }\n\n return Promise.resolve();\n },\n});\n\nexport default DeviceManager;\n"],"mappings":";;;;;;;;;;;;;;;;AAIA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA,IAAMA,aAAa,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EACvCC,SAAS,EAAE,eAD4B;EAEvCC,0BAA0B,EAAE,IAFW;EAGvCC,aAAa,EAAE,IAHwB;EAIvCC,WAAW,EAAE,IAJ0B;EAMvCC,UANuC,wBAM1B;IAAA;;IACX;IACA,KAAKC,KAAL,CAAWC,QAAX,CAAoBC,OAApB,CAA4BC,EAA5B,CAA+B,0BAA/B,EAA2D,gBAAY;MAAA,IAAVC,IAAU,QAAVA,IAAU;;MACrE,KAAI,CAACC,qBAAL,CAA2BD,IAA3B;IACD,CAFD;EAGD,CAXsC;;EAavC;AACF;AACA;AACA;AACA;EACEE,MAlBuC,oBAkB9B;IACP,OAAOC,mBAAA,CAAiBD,MAAjB,EAAP;EACD,CApBsC;;EAsBvC;AACF;AACA;AACA;AACA;EACEE,OA3BuC,qBA2B7B;IAAA;;IACRD,mBAAA,CAAiBE,KAAjB;;IAEA,OAAO,KAAKT,KAAL,CACJU,OADI,CACI;MACPC,GAAG,EAAE,KADE;MAEPC,QAAQ,EAAE;IAFH,CADJ,EAKJC,IALI,CAKC,UAACC,GAAD,EAAS;MACb,IAAI,CAACA,GAAG,CAACC,IAAT,EAAe;QACb,OAAO,iBAAQC,MAAR,EAAP;MACD;;MAED,OAAO,MAAI,CAACC,qBAAL,CAA2BH,GAAG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+ {"version":3,"names":["DeviceManager","WebexPlugin","extend","namespace","_devicePendingPinChallenge","_pairedDevice","_boundSpace","initialize","webex","internal","mercury","on","data","_receiveDeviceUpdates","getAll","DeviceCollection","refresh","reset","request","api","resource","then","res","body","reject","_updateDeviceMetadata","items","devices","forEach","device","deviceInfo","machineType","LYRA_SPACE","lyra","space","get","catch","err","logger","error","set","search","options","searchQuery","Error","people","searchId","uuid","v4","searchType","searchEntity","includePeople","includeRooms","queryString","upsert","deviceId","id","identity","existingDevice","resolve","method","auxDevice","_decryptDeviceName","token","getAdvertisedEndpoint","advertiser","result","displayName","remove","requestPin","url","dev","occupants","pinChallenge","info","join","passType","verificationInitiation","pair","pin","unpair","leave","bindSpace","kmsResourceObjectUrl","bindConversation","unbindSpace","unbindConversation","getAudioState","putAudioState","audioState","mute","unmute","increaseVolume","decreaseVolume","setVolume","level","deviceArray","length","all","map","index","services","waitForCatalog","deviceClass","UC_CLOUD","updatedDevice","inDevice","metadata","encryptedUserAssignedName","encryptionKeyUrl","encryption","decryptText","decryptedDeviceName","undefined","userAssignedName","spaceUrl","substring","lastIndexOf","self","verified","productName","DEFAULT_PRODUCT_NAME","pairedDeviceId"],"sources":["device-manager.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport {cloneDeep} from 'lodash';\nimport '@webex/internal-plugin-lyra';\nimport '@webex/internal-plugin-search';\nimport {WebexPlugin} from '@webex/webex-core';\nimport uuid from 'uuid';\n\nimport {LYRA_SPACE, UC_CLOUD, DEFAULT_PRODUCT_NAME} from './constants';\nimport DeviceCollection from './collection';\n\nconst DeviceManager = WebexPlugin.extend({\n namespace: 'DeviceManager',\n _devicePendingPinChallenge: null,\n _pairedDevice: null,\n _boundSpace: null,\n\n initialize() {\n // Lyra mercury events listener\n this.webex.internal.mercury.on('event:lyra.space_updated', ({data}) => {\n this._receiveDeviceUpdates(data);\n });\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n getAll() {\n return DeviceCollection.getAll();\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n refresh() {\n DeviceCollection.reset();\n\n return this.webex\n .request({\n api: 'wdm',\n resource: 'devices/auxiliary',\n })\n .then((res) => {\n if (!res.body) {\n return Promise.reject();\n }\n\n return this._updateDeviceMetadata(res.body.items).then((devices) => {\n /* eslint-disable consistent-return */\n devices.forEach((device) => {\n if (device.deviceInfo && device.deviceInfo.machineType === LYRA_SPACE) {\n return this.webex.internal.lyra.space.get(device.deviceInfo).catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to receive device info', err);\n });\n }\n });\n /* eslint-enable consistent-return */\n res.body.items.forEach((device) => {\n DeviceCollection.set(device);\n });\n\n return this.getAll();\n });\n })\n .catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);\n });\n },\n\n /**\n * Search for a device by name\n * @param {Object} options\n * @param {string} options.searchQuery\n * @returns {Promise<Device>}\n */\n search(options) {\n if (!options || !options.searchQuery) {\n this.logger.error('DeviceManager#search: options.searchQuery is required');\n\n return Promise.reject(new Error('DeviceManager#search: options.searchQuery is required'));\n }\n\n return this.webex.internal.search\n .people({\n searchId: uuid.v4(),\n searchType: 'DEVICE_SEARCH',\n searchEntity: 'device',\n includePeople: false,\n includeRooms: true,\n queryString: options.searchQuery,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#search: failed to search a device', err);\n\n throw err;\n });\n },\n\n /**\n * Caches the device info and also registers to Redis for subsequent fetches\n * @param {Object} device\n * @param {string} device.id\n * @returns {deviceInfo}\n */\n upsert(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#upsert: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#upsert: device.id is required'));\n }\n this._pairedDevice = this._devicePendingPinChallenge;\n this._devicePendingPinChallenge = null;\n // check if the device is already existing, if so then merge else add\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n }\n\n // new device requested, add to wdm for subsequent retreivals\n return (\n this.webex\n .request({\n api: 'wdm',\n method: 'PUT',\n resource: `devices/auxiliary/Room/${deviceId}`,\n })\n .then((res) => {\n const auxDevice = res.body;\n\n return this._decryptDeviceName(auxDevice);\n })\n // eslint-disable-next-line no-shadow\n .then((device) => {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#upsert: failed to add/update a device', err);\n\n return Promise.reject(err);\n })\n );\n },\n\n /**\n * Retreives device info of a particular device\n * @param {string} token\n * @returns {Promise<deviceInfo>}\n */\n get(token) {\n if (!token) {\n this.logger.error('DeviceManager#get: token is required');\n\n return Promise.reject(new Error('DeviceManager#get: token is required'));\n }\n let deviceInfo;\n\n return this.webex.internal.lyra\n .getAdvertisedEndpoint(token)\n .then((res) => {\n deviceInfo = res;\n\n return this.webex.internal.lyra.space.get({id: res.advertiser.id});\n })\n .then((result) => {\n // the deviceInfo doesn't have proper displayName, hence update\n // displayName on deviceInfo for search to work\n if (result && result.identity && result.identity.displayName) {\n deviceInfo.advertiser.displayName = result.identity.displayName;\n }\n\n return deviceInfo;\n })\n .catch((err) => {\n this.logger.error('DeviceManager#get: failed to get device info', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Unregisters the device from Redis, will not fetch in subsequent loads,\n * similar to space.deleteBinding()\n * @param {string} deviceId\n * @returns {Promise<deviceInfo>}\n */\n remove(deviceId) {\n if (!deviceId) {\n this.logger.error('DeviceManager#remove: deviceId is required');\n\n return Promise.reject(new Error('DeviceManager#remove: deviceId is required'));\n }\n\n return this.webex\n .request({\n method: 'delete',\n api: 'wdm',\n resource: `devices/auxiliary/${deviceId}`,\n })\n .catch((error) => {\n this.logger.error('DeviceManager#remove: failed to remove the device', error);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Requests to display PIN on the device\n * @param {object} device\n * @param {object} options\n * @param {object} options.data\n * @returns {Promise<deviceInfo>}\n */\n requestPin(device, options = {}) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#requestPin: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#requestPin: device.id is required'));\n }\n const space = {id: deviceId, url: `/spaces/${deviceId}`};\n\n return this.webex.internal.lyra.space\n .get(space)\n .then((dev) => {\n // check if the space is pinChallenge capable\n if (dev && dev.occupants && dev.occupants.pinChallenge) {\n this.logger.info('DeviceManager#requestPin: space is PIN challenge capable');\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'MANUAL',\n verificationInitiation: 'PIN',\n data: options.data,\n })\n .then(() => {\n this._devicePendingPinChallenge = dev;\n\n // return the actual device so that it can be upserted on successful\n // PIN exchange\n return dev;\n });\n }\n // pairs with the space if it's not PIN challenge capable\n this.logger.info(\n 'DeviceManager#requestPin: space is not PIN challenge capable, probably already occupied, will still return device info'\n );\n\n return this.webex.internal.lyra.space.get(space).then(() => Promise.resolve(dev));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#requestPin: device failed PIN challenge request', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * pairs the device with the user (manual pairing), also adds it to\n * user's recents list for subsequent fetches.\n * similar to space.join()\n * @param {object} options\n * @param {number} options.pin\n * @returns {Promise<deviceInfo>}\n */\n pair(options = {}) {\n if (!options.pin) {\n this.logger.error('DeviceManager#pair: options.pin is required');\n\n return Promise.reject(new Error('DeviceManager#pair: options.pin is required'));\n }\n if (this._devicePendingPinChallenge) {\n const space = {\n id: this._devicePendingPinChallenge.identity.id,\n url: `/spaces/${this._devicePendingPinChallenge.identity.id}`,\n };\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'PIN_ANSWER',\n data: options.pin,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#pair: incorrect PIN, unable to pair ', err);\n\n return Promise.reject(err);\n })\n .then(() => this.upsert(this._devicePendingPinChallenge));\n }\n this.logger.error('DeviceManager#pair: no device to pair');\n\n return Promise.reject(new Error('DeviceManager#pair: no device to pair'));\n },\n\n /**\n * unpairs the device with the user (manual/ultrasonic pairing), but still\n * keeps in the recents list/does not remove from Redis\n * options.removeAllDevices will remove all associated devices to user\n * similar to space.leave()\n * @param {object} options\n * @param {boolean} options.removeAllDevices\n * @returns {Promise<deviceInfo>}\n */\n unpair(options = {}) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unpair: no device to unpair');\n\n return Promise.reject(new Error('DeviceManager#unpair: no device to unpair'));\n }\n const space = {url: `/spaces/${this._pairedDevice.identity.id}`};\n\n return this.webex.internal.lyra.space.leave(space, options).catch((err) => {\n this.logger.error('DeviceManager#unpair: failed to remove device from Lyra', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * binds the space to the paired device (if supported)\n * similar to space.bindConversation()\n * @param {object} options\n * @param {boolean} options.url, conversation url\n * @param {boolean} options.kmsResourceObjectUrl of the convo\n * @returns {Promise<deviceInfo>}\n */\n bindSpace(options = {}) {\n if (!options.url) {\n this.logger.error('DeviceManager#pair: options.url is required');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: options.url is required'));\n }\n if (!options.kmsResourceObjectUrl) {\n this.logger.error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required');\n\n return Promise.reject(\n new Error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required')\n );\n }\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#bindSpace: No device paired currently');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: No device paired currently'));\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n this._boundSpace = {\n kmsResourceObjectUrl: options.kmsResourceObjectUrl,\n url: options.url,\n };\n\n return this.webex.internal.lyra.space.bindConversation(space, this._boundSpace).catch((err) => {\n this.logger.error('DeviceManager#bindSpace: failed to bind device to Space');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * unbinds the space to the paired device (if supported)\n * similar to space.unbindConversation()\n * @returns {Promise<deviceInfo>}\n */\n unbindSpace() {\n if (!this._pairedDevice || !this._boundSpace) {\n this.logger.error('DeviceManager#unbindSpace: No space currently bound to the device');\n\n return Promise.reject(\n new Error('DeviceManager#unbindSpace: No space currently bound to the device')\n );\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n return this.webex.internal.lyra.space\n .unbindConversation(space, this._boundSpace)\n .then((res) => {\n this._boundSpace = null;\n\n return Promise.resolve(res);\n })\n .catch((err) => {\n this.logger.error('DeviceManager#unbindSpace: failed to unbind Space to device');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Gets the audio state of the paired device\n * similar to device.getAudioState()\n * @returns {Promise<audioState>}\n */\n getAudioState() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#getAudioState: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#getAudioState: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);\n },\n\n /**\n * Updates audio state of the paired device, should be called every 10 minutes\n * or when mic or volume state is changed\n * similar to device.putAudioState()\n * @param {object} space\n * @param {object} audioState\n * @returns {Promise<audioState>}\n */\n putAudioState(space, audioState = {}) {\n return this.webex.internal.lyra.device.putAudioState(space, audioState);\n },\n\n /**\n * Mutes paired device\n * similar to device.mute()\n * @returns {Promise<audioState>}\n */\n mute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#mute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#mute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.mute(this._pairedDevice);\n },\n\n /**\n * Unmutes paired device\n * similar to device.unmute()\n * @returns {Promise<audioState>}\n */\n unmute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unmute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#unmute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.unmute(this._pairedDevice);\n },\n\n /**\n * Increases paired device's volume\n * similar to device.increaseVolume()\n * @returns {Promise<audioState>}\n */\n increaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#increaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#increaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);\n },\n\n /**\n * Decreases paired device's volume\n * similar to device.decreaseVolume()\n * @returns {Promise<audioState>}\n */\n decreaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#decreaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#decreaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);\n },\n\n /**\n * Sets paired device's volume but should use increase and decrease api instead\n * similar to device.setVolume()\n * @param {number} level\n * @returns {Promise<audioState>}\n */\n setVolume(level = 0) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#setVolume: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#setVolume: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {Array} deviceArray\n * @returns {device}\n */\n _updateDeviceMetadata(deviceArray = []) {\n if (!deviceArray.length) {\n return Promise.resolve(deviceArray);\n }\n const devices = cloneDeep(deviceArray);\n\n return Promise.all(\n devices.map((device, index) =>\n this.webex.internal.services\n .waitForCatalog('postauth')\n .then(() => {\n if (device.deviceClass === UC_CLOUD) {\n device.id = `${this.webex.internal.services.get('wdm')}/${device.id}`;\n }\n\n return this._decryptDeviceName(device);\n })\n .then((updatedDevice) => {\n devices[index] = updatedDevice;\n\n return Promise.resolve();\n })\n )\n ).then(() => Promise.resolve(devices));\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {object} inDevice\n * @returns {device}\n */\n _decryptDeviceName(inDevice = {}) {\n const device = cloneDeep(inDevice);\n\n if (\n device.metadata &&\n device.metadata.encryptedUserAssignedName &&\n device.metadata.encryptionKeyUrl\n ) {\n return this.webex.internal.encryption\n .decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName)\n .then((decryptedDeviceName) => {\n // set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed\n device.metadata.encryptedUserAssignedName = undefined;\n device.metadata.userAssignedName = decryptedDeviceName;\n\n return Promise.resolve(device);\n })\n .catch((err) => {\n // unset encryptedUserAssignedName if failed to decrypt\n device.metadata.encryptedUserAssignedName = undefined;\n this.logger.error(\n 'DeviceCollection#_decryptDeviceName: failed to decrypt device name',\n err\n );\n });\n }\n\n return Promise.resolve(device);\n },\n\n /**\n * Utility function to update device info on mercury updates\n * @param {object} device\n * @returns {device}\n */\n _receiveDeviceUpdates(device) {\n // we care only the updates are for the registered devices\n if (device && device.spaceUrl) {\n const deviceId = device.spaceUrl.substring(device.spaceUrl.lastIndexOf('/') + 1);\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n return this.webex.internal.lyra.space\n .get({id: deviceId})\n .then((space) => {\n // eslint-disable-next-line no-shadow\n const device = DeviceCollection.get(deviceId);\n\n if (\n device &&\n space.occupants &&\n (!space.occupants.self || !space.occupants.self.verified)\n ) {\n device.productName =\n (space.devices && space.devices[0] && space.devices[0].productName) ||\n DEFAULT_PRODUCT_NAME;\n // pin challenge is not verified reset _pairedDevice if ids\n // match\n const pairedDeviceId =\n this._pairedDevice && (this._pairedDevice.id || this._pairedDevice.identity.id);\n\n if (pairedDeviceId === deviceId) {\n this._pairedDevice = null;\n this.logger.info(\n `DeviceManager#_receiveDeviceUpdates: device ${deviceId} lost pairing`\n );\n\n return Promise.resolve();\n }\n // we do not want to reset the device pending PIN challenge\n if (this._devicePendingPinChallenge.identity.id !== deviceId) {\n return this.upsert(device);\n }\n\n return Promise.resolve();\n }\n\n return Promise.resolve();\n })\n .catch((err) => {\n this.logger.error(\n 'DeviceManager#_receiveDeviceUpdates: failed to receive updates for Lyra space',\n err\n );\n });\n }\n }\n\n return Promise.resolve();\n },\n});\n\nexport default DeviceManager;\n"],"mappings":";;;;;;;;;;AAIA;AACA;AACA;AACA;AAEA;AACA;AAEA,IAAMA,aAAa,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACvCC,SAAS,EAAE,eAAe;EAC1BC,0BAA0B,EAAE,IAAI;EAChCC,aAAa,EAAE,IAAI;EACnBC,WAAW,EAAE,IAAI;EAEjBC,UAAU,wBAAG;IAAA;IACX;IACA,IAAI,CAACC,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACC,EAAE,CAAC,0BAA0B,EAAE,gBAAY;MAAA,IAAVC,IAAI,QAAJA,IAAI;MAC/D,KAAI,CAACC,qBAAqB,CAACD,IAAI,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,MAAM,oBAAG;IACP,OAAOC,mBAAgB,CAACD,MAAM,EAAE;EAClC,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,OAAO,qBAAG;IAAA;IACRD,mBAAgB,CAACE,KAAK,EAAE;IAExB,OAAO,IAAI,CAACT,KAAK,CACdU,OAAO,CAAC;MACPC,GAAG,EAAE,KAAK;MACVC,QAAQ,EAAE;IACZ,CAAC,CAAC,CACDC,IAAI,CAAC,UAACC,GAAG,EAAK;MACb,IAAI,CAACA,GAAG,CAACC,IAAI,EAAE;QACb,OAAO,iBAAQC,MAAM,EAAE;MACzB;MAEA,OAAO,MAAI,CAACC,qBAAqB,CAACH,GAAG,CAACC,IAAI,CAACG,KAAK,CAAC,CAACL,IAAI,CAAC,UAACM,OAAO,EAAK;QAClE;QACAA,OAAO,CAACC,OAAO,CAAC,UAACC,MAAM,EAAK;UAC1B,IAAIA,MAAM,CAACC,UAAU,IAAID,MAAM,CAACC,UAAU,CAACC,WAA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AACsC,SAAS,CAAC8C,IAAI,CAACC,QAAQ,CAAC,EACzD;YACA1F,MAAM,CAAC2F,WAAW,GACftF,KAAK,CAACP,OAAO,IAAIO,KAAK,CAACP,OAAO,CAAC,CAAC,CAAC,IAAIO,KAAK,CAACP,OAAO,CAAC,CAAC,CAAC,CAAC6F,WAAW,IAClEC,+BAAoB;YACtB;YACA;YACA,IAAMC,cAAc,GAClB,OAAI,CAACrH,aAAa,KAAK,OAAI,CAACA,aAAa,CAACmD,EAAE,IAAI,OAAI,CAACnD,aAAa,CAACoD,QAAQ,CAACD,EAAE,CAAC;YAEjF,IAAIkE,cAAc,KAAKnE,QAAQ,EAAE;cAC/B,OAAI,CAAClD,aAAa,GAAG,IAAI;cACzB,OAAI,CAACiC,MAAM,CAACoC,IAAI,uDACiCnB,QAAQ,mBACxD;cAED,OAAO,iBAAQI,OAAO,EAAE;YAC1B;YACA;YACA,IAAI,OAAI,CAACvD,0BAA0B,CAACqD,QAAQ,CAACD,EAAE,KAAKD,QAAQ,EAAE;cAC5D,OAAO,OAAI,CAACD,MAAM,CAACzB,MAAM,CAAC;YAC5B;YAEA,OAAO,iBAAQ8B,OAAO,EAAE;UAC1B;UAEA,OAAO,iBAAQA,OAAO,EAAE;QAC1B,CAAC,CAAC,CACDvB,KAAK,CAAC,UAACC,GAAG,EAAK;UACd,OAAI,CAACC,MAAM,CAACC,KAAK,CACf,+EAA+E,EAC/EF,GAAG,CACJ;QACH,CAAC,CAAC;MACN;IACF;IAEA,OAAO,iBAAQsB,OAAO,EAAE;EAC1B,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEY3D,aAAa;AAAA"}
package/dist/index.js CHANGED
@@ -1,40 +1,32 @@
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
  _Object$defineProperty(exports, "config", {
12
9
  enumerable: true,
13
10
  get: function get() {
14
11
  return _config.default;
15
12
  }
16
13
  });
17
-
18
14
  _Object$defineProperty(exports, "default", {
19
15
  enumerable: true,
20
16
  get: function get() {
21
17
  return _deviceManager.default;
22
18
  }
23
19
  });
24
-
25
20
  require("@webex/internal-plugin-device");
26
-
27
21
  var _webexCore = require("@webex/webex-core");
28
-
29
22
  var _deviceManager = _interopRequireDefault(require("./device-manager"));
30
-
31
23
  var _config = _interopRequireDefault(require("./config"));
32
-
33
24
  /*!
34
25
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
35
26
  */
36
27
 
37
28
  /* globals */
29
+
38
30
  (0, _webexCore.registerPlugin)('devicemanager', _deviceManager.default, {
39
31
  config: _config.default
40
32
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["registerPlugin","DeviceManager","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* globals */\n\nimport '@webex/internal-plugin-device';\nimport {registerPlugin} from '@webex/webex-core';\n\nimport DeviceManager from './device-manager';\nimport config from './config';\n\nregisterPlugin('devicemanager', DeviceManager, {\n config,\n});\n\nexport {default} from './device-manager';\nexport {default as config} from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AAEA;;AACA;;AAVA;AACA;AACA;;AAEA;AAQA,IAAAA,yBAAA,EAAe,eAAf,EAAgCC,sBAAhC,EAA+C;EAC7CC,MAAM,EAANA;AAD6C,CAA/C"}
1
+ {"version":3,"names":["registerPlugin","DeviceManager","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* globals */\n\nimport '@webex/internal-plugin-device';\nimport {registerPlugin} from '@webex/webex-core';\n\nimport DeviceManager from './device-manager';\nimport config from './config';\n\nregisterPlugin('devicemanager', DeviceManager, {\n config,\n});\n\nexport {default} from './device-manager';\nexport {default as config} from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA;AACA;AAEA;AACA;AAVA;AACA;AACA;;AAEA;;AAQA,IAAAA,yBAAc,EAAC,eAAe,EAAEC,sBAAa,EAAE;EAC7CC,MAAM,EAANA;AACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-device-manager",
3
- "version": "3.0.0-beta.15",
3
+ "version": "3.0.0-beta.151",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -23,15 +23,15 @@
23
23
  ]
24
24
  },
25
25
  "dependencies": {
26
- "@webex/internal-plugin-calendar": "3.0.0-beta.15",
27
- "@webex/internal-plugin-device": "3.0.0-beta.15",
28
- "@webex/internal-plugin-lyra": "3.0.0-beta.15",
29
- "@webex/internal-plugin-search": "3.0.0-beta.15",
30
- "@webex/plugin-authorization": "3.0.0-beta.15",
31
- "@webex/plugin-device-manager": "3.0.0-beta.15",
32
- "@webex/plugin-logger": "3.0.0-beta.15",
33
- "@webex/test-helper-chai": "3.0.0-beta.15",
34
- "@webex/webex-core": "3.0.0-beta.15",
26
+ "@webex/internal-plugin-calendar": "3.0.0-beta.151",
27
+ "@webex/internal-plugin-device": "3.0.0-beta.151",
28
+ "@webex/internal-plugin-lyra": "3.0.0-beta.151",
29
+ "@webex/internal-plugin-search": "3.0.0-beta.151",
30
+ "@webex/plugin-authorization": "3.0.0-beta.151",
31
+ "@webex/plugin-device-manager": "3.0.0-beta.151",
32
+ "@webex/plugin-logger": "3.0.0-beta.151",
33
+ "@webex/test-helper-chai": "3.0.0-beta.151",
34
+ "@webex/webex-core": "3.0.0-beta.151",
35
35
  "lodash": "^4.17.21",
36
36
  "uuid": "^3.3.2"
37
37
  }