@webex/internal-plugin-calendar 3.0.0-beta.4 → 3.0.0-beta.400
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 +1 -3
- package/dist/calendar.decrypt.helper.js +73 -0
- package/dist/calendar.decrypt.helper.js.map +1 -0
- package/dist/calendar.encrypt.helper.js +88 -0
- package/dist/calendar.encrypt.helper.js.map +1 -0
- package/dist/calendar.js +235 -116
- package/dist/calendar.js.map +1 -1
- package/dist/collection.js +0 -19
- package/dist/collection.js.map +1 -1
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +10 -24
- package/dist/index.js.map +1 -1
- package/dist/util.js +0 -13
- package/dist/util.js.map +1 -1
- package/package.json +9 -11
- package/src/calendar.decrypt.helper.js +121 -0
- package/src/calendar.encrypt.helper.js +98 -0
- package/src/calendar.js +264 -53
- package/src/collection.js +2 -4
- package/src/config.js +2 -2
- package/src/index.js +124 -43
- package/src/util.js +5 -3
- package/test/integration/spec/calendar.js +379 -271
- package/test/unit/spec/calendar.decrypt.helper.js +145 -0
- package/test/unit/spec/calendar.encrypt.helper.js +52 -0
- package/test/unit/spec/calendar.js +298 -94
- package/test/unit/spec/utils.js +4 -1
package/dist/calendar.js
CHANGED
|
@@ -1,71 +1,21 @@
|
|
|
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
|
-
var
|
|
16
|
-
|
|
10
|
+
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
11
|
+
var _common = require("@webex/common");
|
|
17
12
|
var _webexCore = require("@webex/webex-core");
|
|
18
|
-
|
|
19
13
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
20
|
-
|
|
21
14
|
var _constants = require("./constants");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Calendar Item Create Event
|
|
29
|
-
* Emitted when a calendar item has been added
|
|
30
|
-
* @event calendar:meeting:create
|
|
31
|
-
* @instance
|
|
32
|
-
* @memberof Calendar
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Calendar Item Update Event
|
|
37
|
-
* Emitted when a calendar item has been updated
|
|
38
|
-
* @event calendar:meeting:update
|
|
39
|
-
* @instance
|
|
40
|
-
* @memberof Calendar
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Calendar Item Update Event
|
|
45
|
-
* Emitted when a calendar item has been deleted
|
|
46
|
-
* @event calendar:meeting:delete
|
|
47
|
-
* @instance
|
|
48
|
-
* @memberof Calendar
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Calendar Registered Event
|
|
53
|
-
* Emitted when the calendar instance has been registered and listening
|
|
54
|
-
* @event calendar:registered
|
|
55
|
-
* @instance
|
|
56
|
-
* @memberof Calendar
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Calendar Registered Event
|
|
61
|
-
* Emitted when the calendar instance has been registered and listening
|
|
62
|
-
* @event calendar:unregistered
|
|
63
|
-
* @instance
|
|
64
|
-
* @memberof Calendar
|
|
65
|
-
*/
|
|
15
|
+
var _calendarEncrypt = _interopRequireDefault(require("./calendar.encrypt.helper"));
|
|
16
|
+
var _calendarDecrypt = _interopRequireDefault(require("./calendar.decrypt.helper"));
|
|
66
17
|
var Calendar = _webexCore.WebexPlugin.extend({
|
|
67
18
|
namespace: 'Calendar',
|
|
68
|
-
|
|
69
19
|
/**
|
|
70
20
|
* registered value indicating events registration is successful
|
|
71
21
|
* @instance
|
|
@@ -73,7 +23,62 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
73
23
|
* @memberof Calendar
|
|
74
24
|
*/
|
|
75
25
|
registered: false,
|
|
76
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Cache all rpc event request locally
|
|
28
|
+
* */
|
|
29
|
+
rpcEventRequests: [],
|
|
30
|
+
/**
|
|
31
|
+
* Cache KMS encryptionKeyUrl
|
|
32
|
+
* */
|
|
33
|
+
encryptionKeyUrl: null,
|
|
34
|
+
/**
|
|
35
|
+
* Pre-fetch a KMS encryption key url to improve performance.
|
|
36
|
+
* Waits for the user to be authorized and skips if an unverified guest.
|
|
37
|
+
* @private
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
prefetchEncryptionKey: function prefetchEncryptionKey() {
|
|
41
|
+
var _this = this;
|
|
42
|
+
if (!this.webex.canAuthorize) {
|
|
43
|
+
this.listenToOnce(this.webex, 'change:canAuthorize', function () {
|
|
44
|
+
_this.prefetchEncryptionKey();
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.webex.credentials.isUnverifiedGuest) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.webex.internal.encryption.kms.createUnboundKeys({
|
|
52
|
+
count: 1
|
|
53
|
+
}).then(function (keys) {
|
|
54
|
+
var key = (0, _isArray2.default)(keys) ? keys[0] : keys;
|
|
55
|
+
_this.encryptionKeyUrl = key ? key.uri : null;
|
|
56
|
+
_this.logger.info('calendar->bind a KMS encryption key url');
|
|
57
|
+
_this.webex.internal.encryption.getKey(_this.encryptionKeyUrl, {
|
|
58
|
+
onBehalfOf: null
|
|
59
|
+
}).then(function (retrievedKey) {
|
|
60
|
+
_this.encryptionKeyUrl = retrievedKey ? retrievedKey.uri : null;
|
|
61
|
+
_this.logger.info('calendar->retrieve the KMS encryption key url and cache it');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* WebexPlugin initialize method. This triggers once Webex has completed its
|
|
67
|
+
* initialization workflow.
|
|
68
|
+
*
|
|
69
|
+
* If the plugin is meant to perform startup actions, place them in this
|
|
70
|
+
* `initialize()` method instead of the `constructor()` method.
|
|
71
|
+
* @private
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
initialize: function initialize() {
|
|
75
|
+
var _this2 = this;
|
|
76
|
+
// Used to perform actions after webex is fully qualified and ready for
|
|
77
|
+
// operation.
|
|
78
|
+
this.listenToOnce(this.webex, 'ready', function () {
|
|
79
|
+
_this2.prefetchEncryptionKey();
|
|
80
|
+
});
|
|
81
|
+
},
|
|
77
82
|
/**
|
|
78
83
|
* Explicitly sets up the calendar plugin by registering
|
|
79
84
|
* the device, connecting to mercury, and listening for calendar events.
|
|
@@ -82,33 +87,26 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
82
87
|
* @memberof Calendar
|
|
83
88
|
*/
|
|
84
89
|
register: function register() {
|
|
85
|
-
var
|
|
86
|
-
|
|
90
|
+
var _this3 = this;
|
|
87
91
|
if (!this.webex.canAuthorize) {
|
|
88
92
|
this.logger.error('calendar->register#ERROR, Unable to register, SDK cannot authorize');
|
|
89
93
|
return _promise.default.reject(new Error('SDK cannot authorize'));
|
|
90
94
|
}
|
|
91
|
-
|
|
92
95
|
if (this.registered) {
|
|
93
96
|
this.logger.info('calendar->register#INFO, Calendar plugin already registered');
|
|
94
97
|
return _promise.default.resolve();
|
|
95
98
|
}
|
|
96
|
-
|
|
97
99
|
return this.webex.internal.device.register().then(function () {
|
|
98
|
-
return
|
|
100
|
+
return _this3.webex.internal.mercury.connect();
|
|
99
101
|
}).then(function () {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_this.registered = true;
|
|
102
|
+
_this3.listenForEvents();
|
|
103
|
+
_this3.trigger(_constants.CALENDAR_REGISTERED);
|
|
104
|
+
_this3.registered = true;
|
|
105
105
|
}).catch(function (error) {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
_this3.logger.error("calendar->register#ERROR, Unable to register, ".concat(error.message));
|
|
108
107
|
return _promise.default.reject(error);
|
|
109
108
|
});
|
|
110
109
|
},
|
|
111
|
-
|
|
112
110
|
/**
|
|
113
111
|
* Explicitly tears down the calendar plugin by deregistering
|
|
114
112
|
* the device, disconnecting from mercury, and stops listening to calendar events
|
|
@@ -118,49 +116,46 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
118
116
|
* @memberof Calendar
|
|
119
117
|
*/
|
|
120
118
|
unregister: function unregister() {
|
|
121
|
-
var
|
|
122
|
-
|
|
119
|
+
var _this4 = this;
|
|
123
120
|
if (!this.registered) {
|
|
124
121
|
this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');
|
|
125
122
|
return _promise.default.resolve();
|
|
126
123
|
}
|
|
127
|
-
|
|
128
124
|
this.stopListeningForEvents();
|
|
129
125
|
return this.webex.internal.mercury.disconnect().then(function () {
|
|
130
|
-
return
|
|
126
|
+
return _this4.webex.internal.device.unregister();
|
|
131
127
|
}).then(function () {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
_this2.registered = false;
|
|
128
|
+
_this4.trigger(_constants.CALENDAR_UNREGISTERED);
|
|
129
|
+
_this4.registered = false;
|
|
135
130
|
});
|
|
136
131
|
},
|
|
137
|
-
|
|
138
132
|
/**
|
|
139
133
|
* registers for calendar events through mercury
|
|
140
134
|
* @returns {undefined}
|
|
141
135
|
* @private
|
|
142
136
|
*/
|
|
143
137
|
listenForEvents: function listenForEvents() {
|
|
144
|
-
var
|
|
145
|
-
|
|
138
|
+
var _this5 = this;
|
|
146
139
|
// Calendar mercury events listener
|
|
147
140
|
this.webex.internal.mercury.on('event:calendar.meeting.create', function (envelope) {
|
|
148
|
-
|
|
141
|
+
_this5._handleCreate(envelope.data);
|
|
149
142
|
});
|
|
150
143
|
this.webex.internal.mercury.on('event:calendar.meeting.update', function (envelope) {
|
|
151
|
-
|
|
144
|
+
_this5._handleUpdate(envelope.data);
|
|
152
145
|
});
|
|
153
146
|
this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', function (envelope) {
|
|
154
|
-
|
|
147
|
+
_this5._handleCreate(envelope.data);
|
|
155
148
|
});
|
|
156
149
|
this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', function (envelope) {
|
|
157
|
-
|
|
150
|
+
_this5._handleUpdate(envelope.data);
|
|
158
151
|
});
|
|
159
152
|
this.webex.internal.mercury.on('event:calendar.meeting.delete', function (envelope) {
|
|
160
|
-
|
|
153
|
+
_this5._handleDelete(envelope.data);
|
|
154
|
+
});
|
|
155
|
+
this.webex.internal.mercury.on('event:calendar.free_busy', function (envelope) {
|
|
156
|
+
_this5._handleFreeBusy(envelope.data);
|
|
161
157
|
});
|
|
162
158
|
},
|
|
163
|
-
|
|
164
159
|
/**
|
|
165
160
|
* unregisteres all the calendar events from mercury
|
|
166
161
|
* @returns {undefined}
|
|
@@ -172,8 +167,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
172
167
|
this.webex.internal.mercury.off('event:calendar.meeting.update');
|
|
173
168
|
this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');
|
|
174
169
|
this.webex.internal.mercury.off('event:calendar.meeting.delete');
|
|
170
|
+
this.webex.internal.mercury.off('event:calendar.free_busy');
|
|
175
171
|
},
|
|
176
|
-
|
|
177
172
|
/**
|
|
178
173
|
* handles update events, triggers after collection updates
|
|
179
174
|
* @param {Object} data
|
|
@@ -182,10 +177,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
182
177
|
*/
|
|
183
178
|
_handleUpdate: function _handleUpdate(data) {
|
|
184
179
|
var id = _collection.default.set(data.calendarMeetingExternal);
|
|
185
|
-
|
|
186
180
|
this.trigger(_constants.CALENDAR_UPDATED, _collection.default.get(id));
|
|
187
181
|
},
|
|
188
|
-
|
|
189
182
|
/**
|
|
190
183
|
* handles create events, triggers after collection updates
|
|
191
184
|
* @param {Object} data
|
|
@@ -194,10 +187,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
194
187
|
*/
|
|
195
188
|
_handleCreate: function _handleCreate(data) {
|
|
196
189
|
var id = _collection.default.set(data.calendarMeetingExternal);
|
|
197
|
-
|
|
198
190
|
this.trigger(_constants.CALENDAR_CREATE, _collection.default.get(id));
|
|
199
191
|
},
|
|
200
|
-
|
|
201
192
|
/**
|
|
202
193
|
* handles delete events, triggers after collection updates
|
|
203
194
|
* @param {Object} data
|
|
@@ -206,10 +197,32 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
206
197
|
*/
|
|
207
198
|
_handleDelete: function _handleDelete(data) {
|
|
208
199
|
var item = _collection.default.remove(data.calendarMeetingExternal.id);
|
|
209
|
-
|
|
210
200
|
this.trigger(_constants.CALENDAR_DELETE, item);
|
|
211
201
|
},
|
|
212
|
-
|
|
202
|
+
/**
|
|
203
|
+
* handles free_busy events
|
|
204
|
+
* @param {Object} data
|
|
205
|
+
* @returns {undefined}
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
_handleFreeBusy: function _handleFreeBusy(data) {
|
|
209
|
+
var _this6 = this;
|
|
210
|
+
_calendarDecrypt.default.decryptFreeBusyResponse(this, data).then(function () {
|
|
211
|
+
var response = {};
|
|
212
|
+
if (data && data.calendarFreeBusyScheduleResponse) {
|
|
213
|
+
response = data.calendarFreeBusyScheduleResponse;
|
|
214
|
+
}
|
|
215
|
+
if (response && response.requestId && response.requestId in _this6.rpcEventRequests) {
|
|
216
|
+
_this6.logger.log("webex.internal.calendar - receive requests, requestId: ".concat(response.requestId));
|
|
217
|
+
delete response.encryptionKeyUrl;
|
|
218
|
+
var resolve = _this6.rpcEventRequests[response.requestId].resolve;
|
|
219
|
+
resolve(response);
|
|
220
|
+
delete _this6.rpcEventRequests[response.requestId];
|
|
221
|
+
} else {
|
|
222
|
+
_this6.logger.log('webex.internal.calendar - receive other requests.');
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
},
|
|
213
226
|
/**
|
|
214
227
|
* Retrieves a collection of calendars based on the request parameters
|
|
215
228
|
* Defaults to 1 day before and 7 days ahead
|
|
@@ -228,11 +241,9 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
228
241
|
toDate: options.toDate
|
|
229
242
|
}).then(function (res) {
|
|
230
243
|
_collection.default.setAll(res);
|
|
231
|
-
|
|
232
244
|
return _collection.default.getAll();
|
|
233
245
|
});
|
|
234
246
|
},
|
|
235
|
-
|
|
236
247
|
/**
|
|
237
248
|
* get the calendar item that has a matching value
|
|
238
249
|
* @param {String} key meeting property
|
|
@@ -243,10 +254,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
243
254
|
if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {
|
|
244
255
|
return _collection.default.getBy(key, value);
|
|
245
256
|
}
|
|
246
|
-
|
|
247
257
|
throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');
|
|
248
258
|
},
|
|
249
|
-
|
|
250
259
|
/**
|
|
251
260
|
* gets all the calendar items that have been populated
|
|
252
261
|
* @returns {Object}
|
|
@@ -254,7 +263,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
254
263
|
getAll: function getAll() {
|
|
255
264
|
return _collection.default.getAll();
|
|
256
265
|
},
|
|
257
|
-
|
|
258
266
|
/**
|
|
259
267
|
* Decrypts an encrypted incoming calendar event
|
|
260
268
|
* @param {Object} event
|
|
@@ -265,20 +273,28 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
265
273
|
return event;
|
|
266
274
|
});
|
|
267
275
|
},
|
|
268
|
-
|
|
269
276
|
/**
|
|
270
|
-
* Retrieves an array of meeting participants for the meeting
|
|
271
|
-
* @param {String}
|
|
277
|
+
* Retrieves an array of meeting participants for the meeting participantsUrl
|
|
278
|
+
* @param {String} participantsUrl
|
|
272
279
|
* @returns {Promise} Resolves with an object of meeting participants
|
|
273
280
|
*/
|
|
274
|
-
getParticipants: function getParticipants(
|
|
281
|
+
getParticipants: function getParticipants(participantsUrl) {
|
|
275
282
|
return this.request({
|
|
276
283
|
method: 'GET',
|
|
277
|
-
|
|
278
|
-
|
|
284
|
+
uri: participantsUrl
|
|
285
|
+
});
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* get meeting notes using notesUrl from meeting object.
|
|
289
|
+
* @param {String} notesUrl
|
|
290
|
+
* @returns {Promise} Resolves with an object of meeting notes
|
|
291
|
+
*/
|
|
292
|
+
getNotesByUrl: function getNotesByUrl(notesUrl) {
|
|
293
|
+
return this.request({
|
|
294
|
+
method: 'GET',
|
|
295
|
+
uri: notesUrl
|
|
279
296
|
});
|
|
280
297
|
},
|
|
281
|
-
|
|
282
298
|
/**
|
|
283
299
|
* Retrieves a collection of meetings based on the request parameters
|
|
284
300
|
* @param {String} id
|
|
@@ -288,10 +304,9 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
288
304
|
return this.request({
|
|
289
305
|
method: 'GET',
|
|
290
306
|
service: 'calendar',
|
|
291
|
-
resource: "calendarEvents/".concat(
|
|
307
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/notes")
|
|
292
308
|
});
|
|
293
309
|
},
|
|
294
|
-
|
|
295
310
|
/**
|
|
296
311
|
* Retrieves a collection of meetings based on the request parameters
|
|
297
312
|
* @param {Object} options
|
|
@@ -300,8 +315,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
300
315
|
* @returns {Promise} Resolves with an array of meetings
|
|
301
316
|
*/
|
|
302
317
|
list: function list(options) {
|
|
303
|
-
var
|
|
304
|
-
|
|
318
|
+
var _this7 = this;
|
|
305
319
|
options = options || {};
|
|
306
320
|
return this.webex.request({
|
|
307
321
|
method: 'GET',
|
|
@@ -312,14 +326,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
312
326
|
var meetingObjects = res.body.items;
|
|
313
327
|
var promises = [];
|
|
314
328
|
meetingObjects.forEach(function (meeting) {
|
|
315
|
-
if (!meeting.encryptedNotes) {
|
|
316
|
-
promises.push(_this4.getNotes(meeting.id).then(function (notesResponse) {
|
|
317
|
-
meeting.encryptedNotes = notesResponse.body && notesResponse.body.encryptedNotes;
|
|
318
|
-
}));
|
|
319
|
-
}
|
|
320
|
-
|
|
321
329
|
if (!meeting.encryptedParticipants) {
|
|
322
|
-
promises.push(
|
|
330
|
+
promises.push(_this7.getParticipants(meeting.participantsUrl).then(function (notesResponse) {
|
|
323
331
|
meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
|
|
324
332
|
}));
|
|
325
333
|
}
|
|
@@ -329,9 +337,120 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
329
337
|
});
|
|
330
338
|
});
|
|
331
339
|
},
|
|
332
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Create calendar event
|
|
342
|
+
* @param {object} [data] meeting payload data
|
|
343
|
+
* @param {object} [query] the query parameters for specific usage
|
|
344
|
+
* @returns {Promise} Resolves with creating calendar event response
|
|
345
|
+
* */
|
|
346
|
+
createCalendarEvent: function createCalendarEvent(data, query) {
|
|
347
|
+
var _this8 = this;
|
|
348
|
+
return _calendarEncrypt.default.encryptCalendarEventRequest(this, data).then(function () {
|
|
349
|
+
return _this8.request({
|
|
350
|
+
method: 'POST',
|
|
351
|
+
service: 'calendar',
|
|
352
|
+
body: data,
|
|
353
|
+
resource: 'calendarEvents/sync',
|
|
354
|
+
qs: query || {}
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
/**
|
|
359
|
+
* Update calendar event
|
|
360
|
+
* @param {string} [id] calendar event id
|
|
361
|
+
* @param {object} [data] meeting payload data
|
|
362
|
+
* @param {object} [query] the query parameters for specific usage
|
|
363
|
+
* @returns {Promise} Resolves with updating calendar event response
|
|
364
|
+
* */
|
|
365
|
+
updateCalendarEvent: function updateCalendarEvent(id, data, query) {
|
|
366
|
+
var _this9 = this;
|
|
367
|
+
return _calendarEncrypt.default.encryptCalendarEventRequest(this, data).then(function () {
|
|
368
|
+
return _this9.request({
|
|
369
|
+
method: 'PATCH',
|
|
370
|
+
service: 'calendar',
|
|
371
|
+
body: data,
|
|
372
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/sync"),
|
|
373
|
+
qs: query || {}
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* Delete calendar event
|
|
379
|
+
* @param {string} [id] calendar event id
|
|
380
|
+
* @param {object} [query] the query parameters for specific usage
|
|
381
|
+
* @returns {Promise} Resolves with deleting calendar event response
|
|
382
|
+
* */
|
|
383
|
+
deleteCalendarEvent: function deleteCalendarEvent(id, query) {
|
|
384
|
+
return this.request({
|
|
385
|
+
method: 'DELETE',
|
|
386
|
+
service: 'calendar',
|
|
387
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/sync"),
|
|
388
|
+
qs: query || {}
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
/**
|
|
392
|
+
* @typedef QuerySchedulerDataOptions
|
|
393
|
+
* @param {string} [siteName] it is site full url, must have. Example: ccctest.dmz.webex.com
|
|
394
|
+
* @param {string} [id] it is seriesOrOccurrenceId. If present, the series/occurrence meeting ID to fetch data for.
|
|
395
|
+
* Example: 040000008200E00074C5B7101A82E008000000004A99F11A0841D9010000000000000000100000009EE499D4A71C1A46B51494C70EC7BFE5
|
|
396
|
+
* @param {string} [clientMeetingId] If present, the client meeting UUID to fetch data for.
|
|
397
|
+
* Example: 7f318aa9-887c-6e94-802a-8dc8e6eb1a0a
|
|
398
|
+
* @param {string} [scheduleTemplateId] it template id.
|
|
399
|
+
* @param {string} [sessionTypeId] it session type id.
|
|
400
|
+
* @param {string} [organizerCIUserId] required in schedule-on-behalf case. It is the organizer's CI UUID.
|
|
401
|
+
* @param {boolean} [usmPreference]
|
|
402
|
+
* @param {string} [webexMeetingId] webex side meeting UUID
|
|
403
|
+
* @param {string} [eventId] event ID.
|
|
404
|
+
* @param {string} [icalUid] icalendar UUID.
|
|
405
|
+
* @param {string} [thirdPartyType] third part type, such as: Microsoft
|
|
406
|
+
*/
|
|
407
|
+
/**
|
|
408
|
+
* Get scheduler data from calendar service
|
|
409
|
+
* @param {QuerySchedulerDataOptions} [query] the command parameters for fetching scheduler data.
|
|
410
|
+
* @returns {Promise} Resolves with a decrypted scheduler data
|
|
411
|
+
* */
|
|
412
|
+
getSchedulerData: function getSchedulerData(query) {
|
|
413
|
+
var _this10 = this;
|
|
414
|
+
return this.request({
|
|
415
|
+
method: 'GET',
|
|
416
|
+
service: 'calendar',
|
|
417
|
+
resource: 'schedulerData',
|
|
418
|
+
qs: query || {}
|
|
419
|
+
}).then(function (response) {
|
|
420
|
+
return _calendarDecrypt.default.decryptSchedulerDataResponse(_this10, response.body).then(function () {
|
|
421
|
+
return response;
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
},
|
|
425
|
+
/**
|
|
426
|
+
* Get free busy status from calendar service
|
|
427
|
+
* @param {Object} [data] the command parameters for fetching free busy status.
|
|
428
|
+
* @param {object} [query] the query parameters for specific usage
|
|
429
|
+
* @returns {Promise} Resolves with a decrypted response
|
|
430
|
+
* */
|
|
431
|
+
getFreeBusy: function getFreeBusy(data, query) {
|
|
432
|
+
var _this11 = this;
|
|
433
|
+
return _calendarEncrypt.default.encryptFreeBusyRequest(this, data).then(function () {
|
|
434
|
+
return _this11.request({
|
|
435
|
+
method: 'POST',
|
|
436
|
+
service: 'calendar',
|
|
437
|
+
body: data,
|
|
438
|
+
resource: 'freebusy',
|
|
439
|
+
qs: query || {}
|
|
440
|
+
});
|
|
441
|
+
}).then(function () {
|
|
442
|
+
return new _promise.default(function (resolve, reject) {
|
|
443
|
+
_this11.rpcEventRequests[data.requestId] = {
|
|
444
|
+
resolve: resolve,
|
|
445
|
+
reject: reject
|
|
446
|
+
};
|
|
447
|
+
});
|
|
448
|
+
}).catch(function (error) {
|
|
449
|
+
throw error;
|
|
450
|
+
});
|
|
451
|
+
},
|
|
452
|
+
version: "3.0.0-beta.400"
|
|
333
453
|
});
|
|
334
|
-
|
|
335
454
|
var _default = Calendar;
|
|
336
455
|
exports.default = _default;
|
|
337
456
|
//# sourceMappingURL=calendar.js.map
|
package/dist/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Calendar","WebexPlugin","extend","namespace","registered","register","webex","canAuthorize","logger","error","reject","Error","info","resolve","internal","device","then","mercury","connect","listenForEvents","trigger","CALENDAR_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","CALENDAR_UNREGISTERED","on","envelope","_handleCreate","data","_handleUpdate","_handleDelete","off","id","CalendarCollection","set","calendarMeetingExternal","CALENDAR_UPDATED","get","CALENDAR_CREATE","item","remove","CALENDAR_DELETE","syncCalendar","options","fromDate","config","toDate","list","res","setAll","getAll","getByType","key","value","includes","getBy","processMeetingEvent","event","transform","getParticipants","request","method","service","resource","btoa","getNotes","qs","meetingObjects","body","items","promises","forEach","meeting","encryptedNotes","push","notesResponse","encryptedParticipants","all"],"sources":["calendar.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Calendar Item Create Event\n * Emitted when a calendar item has been added\n * @event calendar:meeting:create\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been updated\n * @event calendar:meeting:update\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been deleted\n * @event calendar:meeting:delete\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:registered\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:unregistered\n * @instance\n * @memberof Calendar\n */\n\nimport btoa from 'btoa';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CalendarCollection from './collection';\nimport {CALENDAR_REGISTERED, CALENDAR_UNREGISTERED, CALENDAR_DELETE, CALENDAR_CREATE, CALENDAR_UPDATED} from './constants';\n\nconst Calendar = WebexPlugin.extend({\n namespace: 'Calendar',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof Calendar\n */\n registered: false,\n\n /**\n * Explicitly sets up the calendar plugin by registering\n * the device, connecting to mercury, and listening for calendar events.\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('calendar->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('calendar->register#INFO, Calendar plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.device.register()\n .then(() => this.webex.internal.mercury.connect())\n .then(() => {\n this.listenForEvents();\n this.trigger(CALENDAR_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`calendar->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the calendar plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to calendar events\n *\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n this.trigger(CALENDAR_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for calendar events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n // Calendar mercury events listener\n this.webex.internal.mercury.on('event:calendar.meeting.create', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.delete', (envelope) => {\n this._handleDelete(envelope.data);\n });\n },\n\n /**\n * unregisteres all the calendar events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off('event:calendar.meeting.create');\n this.webex.internal.mercury.off('event:calendar.meeting.create.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.update');\n this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.delete');\n },\n\n /**\n * handles update events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleUpdate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_UPDATED, CalendarCollection.get(id));\n },\n\n /**\n * handles create events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleCreate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_CREATE, CalendarCollection.get(id));\n },\n\n /**\n * handles delete events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleDelete(data) {\n const item = CalendarCollection.remove(data.calendarMeetingExternal.id);\n\n this.trigger(CALENDAR_DELETE, item);\n },\n\n /**\n * Retrieves a collection of calendars based on the request parameters\n * Defaults to 1 day before and 7 days ahead\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of calendars\n */\n syncCalendar(options = {fromDate: this.config.fromDate, toDate: this.config.toDate}) {\n return this.list({fromDate: options.fromDate, toDate: options.toDate}).then((res) => {\n CalendarCollection.setAll(res);\n\n return CalendarCollection.getAll();\n });\n },\n /**\n * get the calendar item that has a matching value\n * @param {String} key meeting property\n * @param {Any} value the meeting property to match\n * @returns {Object}\n */\n getByType(key, value) {\n if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {\n return CalendarCollection.getBy(key, value);\n }\n throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');\n },\n\n /**\n * gets all the calendar items that have been populated\n * @returns {Object}\n */\n getAll() {\n return CalendarCollection.getAll();\n },\n\n /**\n * Decrypts an encrypted incoming calendar event\n * @param {Object} event\n * @returns {Promise} Resolves with a decrypted calendar event\n */\n processMeetingEvent(event) {\n return this.webex.transform('inbound', event)\n .then(() => event);\n },\n\n /**\n * Retrieves an array of meeting participants for the meeting id\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting participants\n */\n getParticipants(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${btoa(id)}/participants`\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotes(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${btoa(id)}/notes`\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of meetings\n */\n list(options) {\n options = options || {};\n\n return this.webex.request({\n method: 'GET',\n service: 'calendar',\n resource: 'calendarEvents',\n qs: options\n })\n .then((res) => {\n const meetingObjects = res.body.items;\n const promises = [];\n\n meetingObjects.forEach((meeting) => {\n if (!meeting.encryptedNotes) {\n promises.push(\n this.getNotes(meeting.id)\n .then((notesResponse) => {\n meeting.encryptedNotes = notesResponse.body && notesResponse.body.encryptedNotes;\n })\n );\n }\n\n if (!meeting.encryptedParticipants) {\n promises.push(\n this.getParticipants(meeting.id)\n .then((notesResponse) => {\n meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;\n })\n );\n }\n });\n\n return Promise.all(promises)\n .then(() => meetingObjects);\n });\n }\n});\n\nexport default Calendar;\n"],"mappings":";;;;;;;;;;;;;;AA4CA;;AACA;;AAEA;;AACA;;AAhDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,IAAMA,QAAQ,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EAClCC,SAAS,EAAE,UADuB;;EAGlC;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KATsB;;EAWlC;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,QAlBkC,sBAkBvB;IAAA;;IACT,IAAI,CAAC,KAAKC,KAAL,CAAWC,YAAhB,EAA8B;MAC5B,KAAKC,MAAL,CAAYC,KAAZ,CAAkB,oEAAlB;MAEA,OAAO,iBAAQC,MAAR,CAAe,IAAIC,KAAJ,CAAU,sBAAV,CAAf,CAAP;IACD;;IAED,IAAI,KAAKP,UAAT,EAAqB;MACnB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,6DAAjB;MAEA,OAAO,iBAAQC,OAAR,EAAP;IACD;;IAED,OAAO,KAAKP,KAAL,CAAWQ,QAAX,CAAoBC,MAApB,CAA2BV,QAA3B,GACJW,IADI,CACC;MAAA,OAAM,KAAI,CAACV,KAAL,CAAWQ,QAAX,CAAoBG,OAApB,CAA4BC,OAA5B,EAAN;IAAA,CADD,EAEJF,IAFI,CAEC,YAAM;MACV,KAAI,CAACG,eAAL;;MACA,KAAI,CAACC,OAAL,CAAaC,8BAAb;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A,IAAMC,QAAQ,GAAG,EAAjB;MAEAH,cAAc,CAACI,OAAf,CAAuB,UAACC,OAAD,EAAa;QAClC,IAAI,CAACA,OAAO,CAACC,cAAb,EAA6B;UAC3BH,QAAQ,CAACI,IAAT,CACE,MAAI,CAACT,QAAL,CAAcO,OAAO,CAACxC,EAAtB,EACGnB,IADH,CACQ,UAAC8D,aAAD,EAAmB;YACvBH,OAAO,CAACC,cAAR,GAAyBE,aAAa,CAACP,IAAd,IAAsBO,aAAa,CAACP,IAAd,CAAmBK,cAAlE;UACD,CAHH,CADF;QAMD;;QAED,IAAI,CAACD,OAAO,CAACI,qBAAb,EAAoC;UAClCN,QAAQ,CAACI,IAAT,CACE,MAAI,CAACf,eAAL,CAAqBa,OAAO,CAACxC,EAA7B,EACGnB,IADH,CACQ,UAAC8D,aAAD,EAAmB;YACvBH,OAAO,CAACI,qBAAR,GAAgCD,aAAa,CAACP,IAAd,CAAmBQ,qBAAnD;UACD,CAHH,CADF;QAMD;MACF,CAlBD;MAoBA,OAAO,iBAAQC,GAAR,CAAYP,QAAZ,EACJzD,IADI,CACC;QAAA,OAAMsD,cAAN;MAAA,CADD,CAAP;IAED,CAhCI,CAAP;EAiCD,CAlQiC;EAAA;AAAA,CAAnB,CAAjB;;eAqQetE,Q"}
|
|
1
|
+
{"version":3,"names":["Calendar","WebexPlugin","extend","namespace","registered","rpcEventRequests","encryptionKeyUrl","prefetchEncryptionKey","webex","canAuthorize","listenToOnce","credentials","isUnverifiedGuest","internal","encryption","kms","createUnboundKeys","count","then","keys","key","uri","logger","info","getKey","onBehalfOf","retrievedKey","initialize","register","error","reject","Error","resolve","device","mercury","connect","listenForEvents","trigger","CALENDAR_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","CALENDAR_UNREGISTERED","on","envelope","_handleCreate","data","_handleUpdate","_handleDelete","_handleFreeBusy","off","id","CalendarCollection","set","calendarMeetingExternal","CALENDAR_UPDATED","get","CALENDAR_CREATE","item","remove","CALENDAR_DELETE","DecryptHelper","decryptFreeBusyResponse","response","calendarFreeBusyScheduleResponse","requestId","log","syncCalendar","options","fromDate","config","toDate","list","res","setAll","getAll","getByType","value","includes","getBy","processMeetingEvent","event","transform","getParticipants","participantsUrl","request","method","getNotesByUrl","notesUrl","getNotes","service","resource","base64","encode","qs","meetingObjects","body","items","promises","forEach","meeting","encryptedParticipants","push","notesResponse","all","createCalendarEvent","query","EncryptHelper","encryptCalendarEventRequest","updateCalendarEvent","deleteCalendarEvent","getSchedulerData","decryptSchedulerDataResponse","getFreeBusy","encryptFreeBusyRequest"],"sources":["calendar.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Calendar Item Create Event\n * Emitted when a calendar item has been added\n * @event calendar:meeting:create\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been updated\n * @event calendar:meeting:update\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been deleted\n * @event calendar:meeting:delete\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:registered\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:unregistered\n * @instance\n * @memberof Calendar\n */\nimport {isArray} from 'lodash';\nimport {base64} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CalendarCollection from './collection';\nimport {\n CALENDAR_REGISTERED,\n CALENDAR_UNREGISTERED,\n CALENDAR_DELETE,\n CALENDAR_CREATE,\n CALENDAR_UPDATED,\n} from './constants';\n\nimport EncryptHelper from './calendar.encrypt.helper';\nimport DecryptHelper from './calendar.decrypt.helper';\n\nconst Calendar = WebexPlugin.extend({\n namespace: 'Calendar',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof Calendar\n */\n registered: false,\n\n /**\n * Cache all rpc event request locally\n * */\n rpcEventRequests: [],\n\n /**\n * Cache KMS encryptionKeyUrl\n * */\n encryptionKeyUrl: null,\n\n /**\n * Pre-fetch a KMS encryption key url to improve performance.\n * Waits for the user to be authorized and skips if an unverified guest.\n * @private\n * @returns {void}\n */\n prefetchEncryptionKey() {\n if (!this.webex.canAuthorize) {\n this.listenToOnce(this.webex, 'change:canAuthorize', () => {\n this.prefetchEncryptionKey();\n });\n\n return;\n }\n\n if (this.webex.credentials.isUnverifiedGuest) {\n return;\n }\n\n this.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => {\n const key = isArray(keys) ? keys[0] : keys;\n this.encryptionKeyUrl = key ? key.uri : null;\n this.logger.info('calendar->bind a KMS encryption key url');\n this.webex.internal.encryption\n .getKey(this.encryptionKeyUrl, {onBehalfOf: null})\n .then((retrievedKey) => {\n this.encryptionKeyUrl = retrievedKey ? retrievedKey.uri : null;\n this.logger.info('calendar->retrieve the KMS encryption key url and cache it');\n });\n });\n },\n\n /**\n * WebexPlugin initialize method. This triggers once Webex has completed its\n * initialization workflow.\n *\n * If the plugin is meant to perform startup actions, place them in this\n * `initialize()` method instead of the `constructor()` method.\n * @private\n * @returns {void}\n */\n initialize() {\n // Used to perform actions after webex is fully qualified and ready for\n // operation.\n this.listenToOnce(this.webex, 'ready', () => {\n this.prefetchEncryptionKey();\n });\n },\n\n /**\n * Explicitly sets up the calendar plugin by registering\n * the device, connecting to mercury, and listening for calendar events.\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('calendar->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('calendar->register#INFO, Calendar plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.device\n .register()\n .then(() => this.webex.internal.mercury.connect())\n .then(() => {\n this.listenForEvents();\n this.trigger(CALENDAR_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`calendar->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the calendar plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to calendar events\n *\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury\n .disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n this.trigger(CALENDAR_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for calendar events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n // Calendar mercury events listener\n this.webex.internal.mercury.on('event:calendar.meeting.create', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.delete', (envelope) => {\n this._handleDelete(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.free_busy', (envelope) => {\n this._handleFreeBusy(envelope.data);\n });\n },\n\n /**\n * unregisteres all the calendar events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off('event:calendar.meeting.create');\n this.webex.internal.mercury.off('event:calendar.meeting.create.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.update');\n this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.delete');\n this.webex.internal.mercury.off('event:calendar.free_busy');\n },\n\n /**\n * handles update events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleUpdate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_UPDATED, CalendarCollection.get(id));\n },\n\n /**\n * handles create events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleCreate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_CREATE, CalendarCollection.get(id));\n },\n\n /**\n * handles delete events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleDelete(data) {\n const item = CalendarCollection.remove(data.calendarMeetingExternal.id);\n\n this.trigger(CALENDAR_DELETE, item);\n },\n\n /**\n * handles free_busy events\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleFreeBusy(data) {\n DecryptHelper.decryptFreeBusyResponse(this, data).then(() => {\n let response = {};\n if (data && data.calendarFreeBusyScheduleResponse) {\n response = data.calendarFreeBusyScheduleResponse;\n }\n if (response && response.requestId && response.requestId in this.rpcEventRequests) {\n this.logger.log(\n `webex.internal.calendar - receive requests, requestId: ${response.requestId}`\n );\n delete response.encryptionKeyUrl;\n const {resolve} = this.rpcEventRequests[response.requestId];\n resolve(response);\n delete this.rpcEventRequests[response.requestId];\n } else {\n this.logger.log('webex.internal.calendar - receive other requests.');\n }\n });\n },\n\n /**\n * Retrieves a collection of calendars based on the request parameters\n * Defaults to 1 day before and 7 days ahead\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of calendars\n */\n syncCalendar(options = {fromDate: this.config.fromDate, toDate: this.config.toDate}) {\n return this.list({fromDate: options.fromDate, toDate: options.toDate}).then((res) => {\n CalendarCollection.setAll(res);\n\n return CalendarCollection.getAll();\n });\n },\n /**\n * get the calendar item that has a matching value\n * @param {String} key meeting property\n * @param {Any} value the meeting property to match\n * @returns {Object}\n */\n getByType(key, value) {\n if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {\n return CalendarCollection.getBy(key, value);\n }\n throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');\n },\n\n /**\n * gets all the calendar items that have been populated\n * @returns {Object}\n */\n getAll() {\n return CalendarCollection.getAll();\n },\n\n /**\n * Decrypts an encrypted incoming calendar event\n * @param {Object} event\n * @returns {Promise} Resolves with a decrypted calendar event\n */\n processMeetingEvent(event) {\n return this.webex.transform('inbound', event).then(() => event);\n },\n\n /**\n * Retrieves an array of meeting participants for the meeting participantsUrl\n * @param {String} participantsUrl\n * @returns {Promise} Resolves with an object of meeting participants\n */\n getParticipants(participantsUrl) {\n return this.request({\n method: 'GET',\n uri: participantsUrl,\n });\n },\n\n /**\n * get meeting notes using notesUrl from meeting object.\n * @param {String} notesUrl\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotesByUrl(notesUrl) {\n return this.request({\n method: 'GET',\n uri: notesUrl,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotes(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${base64.encode(id)}/notes`,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of meetings\n */\n list(options) {\n options = options || {};\n\n return this.webex\n .request({\n method: 'GET',\n service: 'calendar',\n resource: 'calendarEvents',\n qs: options,\n })\n .then((res) => {\n const meetingObjects = res.body.items;\n const promises = [];\n\n meetingObjects.forEach((meeting) => {\n if (!meeting.encryptedParticipants) {\n promises.push(\n this.getParticipants(meeting.participantsUrl).then((notesResponse) => {\n meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;\n })\n );\n }\n });\n\n return Promise.all(promises).then(() => meetingObjects);\n });\n },\n\n /**\n * Create calendar event\n * @param {object} [data] meeting payload data\n * @param {object} [query] the query parameters for specific usage\n * @returns {Promise} Resolves with creating calendar event response\n * */\n createCalendarEvent(data, query) {\n return EncryptHelper.encryptCalendarEventRequest(this, data).then(() =>\n this.request({\n method: 'POST',\n service: 'calendar',\n body: data,\n resource: 'calendarEvents/sync',\n qs: query || {},\n })\n );\n },\n\n /**\n * Update calendar event\n * @param {string} [id] calendar event id\n * @param {object} [data] meeting payload data\n * @param {object} [query] the query parameters for specific usage\n * @returns {Promise} Resolves with updating calendar event response\n * */\n updateCalendarEvent(id, data, query) {\n return EncryptHelper.encryptCalendarEventRequest(this, data).then(() =>\n this.request({\n method: 'PATCH',\n service: 'calendar',\n body: data,\n resource: `calendarEvents/${base64.encode(id)}/sync`,\n qs: query || {},\n })\n );\n },\n\n /**\n * Delete calendar event\n * @param {string} [id] calendar event id\n * @param {object} [query] the query parameters for specific usage\n * @returns {Promise} Resolves with deleting calendar event response\n * */\n deleteCalendarEvent(id, query) {\n return this.request({\n method: 'DELETE',\n service: 'calendar',\n resource: `calendarEvents/${base64.encode(id)}/sync`,\n qs: query || {},\n });\n },\n\n /**\n * @typedef QuerySchedulerDataOptions\n * @param {string} [siteName] it is site full url, must have. Example: ccctest.dmz.webex.com\n * @param {string} [id] it is seriesOrOccurrenceId. If present, the series/occurrence meeting ID to fetch data for.\n * Example: 040000008200E00074C5B7101A82E008000000004A99F11A0841D9010000000000000000100000009EE499D4A71C1A46B51494C70EC7BFE5\n * @param {string} [clientMeetingId] If present, the client meeting UUID to fetch data for.\n * Example: 7f318aa9-887c-6e94-802a-8dc8e6eb1a0a\n * @param {string} [scheduleTemplateId] it template id.\n * @param {string} [sessionTypeId] it session type id.\n * @param {string} [organizerCIUserId] required in schedule-on-behalf case. It is the organizer's CI UUID.\n * @param {boolean} [usmPreference]\n * @param {string} [webexMeetingId] webex side meeting UUID\n * @param {string} [eventId] event ID.\n * @param {string} [icalUid] icalendar UUID.\n * @param {string} [thirdPartyType] third part type, such as: Microsoft\n */\n /**\n * Get scheduler data from calendar service\n * @param {QuerySchedulerDataOptions} [query] the command parameters for fetching scheduler data.\n * @returns {Promise} Resolves with a decrypted scheduler data\n * */\n getSchedulerData(query) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: 'schedulerData',\n qs: query || {},\n }).then((response) => {\n return DecryptHelper.decryptSchedulerDataResponse(this, response.body).then(() => response);\n });\n },\n\n /**\n * Get free busy status from calendar service\n * @param {Object} [data] the command parameters for fetching free busy status.\n * @param {object} [query] the query parameters for specific usage\n * @returns {Promise} Resolves with a decrypted response\n * */\n getFreeBusy(data, query) {\n return EncryptHelper.encryptFreeBusyRequest(this, data)\n .then(() => {\n return this.request({\n method: 'POST',\n service: 'calendar',\n body: data,\n resource: 'freebusy',\n qs: query || {},\n });\n })\n .then(() => {\n return new Promise((resolve, reject) => {\n this.rpcEventRequests[data.requestId] = {resolve, reject};\n });\n })\n .catch((error) => {\n throw error;\n });\n },\n});\n\nexport default Calendar;\n"],"mappings":";;;;;;;;;;AA4CA;AACA;AAEA;AACA;AAQA;AACA;AAEA,IAAMA,QAAQ,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAClCC,SAAS,EAAE,UAAU;EAErB;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KAAK;EAEjB;AACF;AACA;EACEC,gBAAgB,EAAE,EAAE;EAEpB;AACF;AACA;EACEC,gBAAgB,EAAE,IAAI;EAEtB;AACF;AACA;AACA;AACA;AACA;EACEC,qBAAqB,mCAAG;IAAA;IACtB,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,YAAY,EAAE;MAC5B,IAAI,CAACC,YAAY,CAAC,IAAI,CAACF,KAAK,EAAE,qBAAqB,EAAE,YAAM;QACzD,KAAI,CAACD,qBAAqB,EAAE;MAC9B,CAAC,CAAC;MAEF;IACF;IAEA,IAAI,IAAI,CAACC,KAAK,CAACG,WAAW,CAACC,iBAAiB,EAAE;MAC5C;IACF;IAEA,IAAI,CAACJ,KAAK,CAACK,QAAQ,CAACC,UAAU,CAACC,GAAG,CAACC,iBAAiB,CAAC;M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