@webex/internal-plugin-calendar 3.0.0-beta.15 → 3.0.0-beta.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/calendar.js CHANGED
@@ -1,25 +1,16 @@
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 _btoa = _interopRequireDefault(require("btoa"));
16
-
17
11
  var _webexCore = require("@webex/webex-core");
18
-
19
12
  var _collection = _interopRequireDefault(require("./collection"));
20
-
21
13
  var _constants = require("./constants");
22
-
23
14
  /*!
24
15
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
25
16
  */
@@ -63,9 +54,9 @@ var _constants = require("./constants");
63
54
  * @instance
64
55
  * @memberof Calendar
65
56
  */
57
+
66
58
  var Calendar = _webexCore.WebexPlugin.extend({
67
59
  namespace: 'Calendar',
68
-
69
60
  /**
70
61
  * registered value indicating events registration is successful
71
62
  * @instance
@@ -73,7 +64,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
73
64
  * @memberof Calendar
74
65
  */
75
66
  registered: false,
76
-
77
67
  /**
78
68
  * Explicitly sets up the calendar plugin by registering
79
69
  * the device, connecting to mercury, and listening for calendar events.
@@ -83,32 +73,25 @@ var Calendar = _webexCore.WebexPlugin.extend({
83
73
  */
84
74
  register: function register() {
85
75
  var _this = this;
86
-
87
76
  if (!this.webex.canAuthorize) {
88
77
  this.logger.error('calendar->register#ERROR, Unable to register, SDK cannot authorize');
89
78
  return _promise.default.reject(new Error('SDK cannot authorize'));
90
79
  }
91
-
92
80
  if (this.registered) {
93
81
  this.logger.info('calendar->register#INFO, Calendar plugin already registered');
94
82
  return _promise.default.resolve();
95
83
  }
96
-
97
84
  return this.webex.internal.device.register().then(function () {
98
85
  return _this.webex.internal.mercury.connect();
99
86
  }).then(function () {
100
87
  _this.listenForEvents();
101
-
102
88
  _this.trigger(_constants.CALENDAR_REGISTERED);
103
-
104
89
  _this.registered = true;
105
90
  }).catch(function (error) {
106
91
  _this.logger.error("calendar->register#ERROR, Unable to register, ".concat(error.message));
107
-
108
92
  return _promise.default.reject(error);
109
93
  });
110
94
  },
111
-
112
95
  /**
113
96
  * Explicitly tears down the calendar plugin by deregistering
114
97
  * the device, disconnecting from mercury, and stops listening to calendar events
@@ -119,22 +102,18 @@ var Calendar = _webexCore.WebexPlugin.extend({
119
102
  */
120
103
  unregister: function unregister() {
121
104
  var _this2 = this;
122
-
123
105
  if (!this.registered) {
124
106
  this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');
125
107
  return _promise.default.resolve();
126
108
  }
127
-
128
109
  this.stopListeningForEvents();
129
110
  return this.webex.internal.mercury.disconnect().then(function () {
130
111
  return _this2.webex.internal.device.unregister();
131
112
  }).then(function () {
132
113
  _this2.trigger(_constants.CALENDAR_UNREGISTERED);
133
-
134
114
  _this2.registered = false;
135
115
  });
136
116
  },
137
-
138
117
  /**
139
118
  * registers for calendar events through mercury
140
119
  * @returns {undefined}
@@ -142,7 +121,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
142
121
  */
143
122
  listenForEvents: function listenForEvents() {
144
123
  var _this3 = this;
145
-
146
124
  // Calendar mercury events listener
147
125
  this.webex.internal.mercury.on('event:calendar.meeting.create', function (envelope) {
148
126
  _this3._handleCreate(envelope.data);
@@ -160,7 +138,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
160
138
  _this3._handleDelete(envelope.data);
161
139
  });
162
140
  },
163
-
164
141
  /**
165
142
  * unregisteres all the calendar events from mercury
166
143
  * @returns {undefined}
@@ -173,7 +150,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
173
150
  this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');
174
151
  this.webex.internal.mercury.off('event:calendar.meeting.delete');
175
152
  },
176
-
177
153
  /**
178
154
  * handles update events, triggers after collection updates
179
155
  * @param {Object} data
@@ -182,10 +158,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
182
158
  */
183
159
  _handleUpdate: function _handleUpdate(data) {
184
160
  var id = _collection.default.set(data.calendarMeetingExternal);
185
-
186
161
  this.trigger(_constants.CALENDAR_UPDATED, _collection.default.get(id));
187
162
  },
188
-
189
163
  /**
190
164
  * handles create events, triggers after collection updates
191
165
  * @param {Object} data
@@ -194,10 +168,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
194
168
  */
195
169
  _handleCreate: function _handleCreate(data) {
196
170
  var id = _collection.default.set(data.calendarMeetingExternal);
197
-
198
171
  this.trigger(_constants.CALENDAR_CREATE, _collection.default.get(id));
199
172
  },
200
-
201
173
  /**
202
174
  * handles delete events, triggers after collection updates
203
175
  * @param {Object} data
@@ -206,10 +178,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
206
178
  */
207
179
  _handleDelete: function _handleDelete(data) {
208
180
  var item = _collection.default.remove(data.calendarMeetingExternal.id);
209
-
210
181
  this.trigger(_constants.CALENDAR_DELETE, item);
211
182
  },
212
-
213
183
  /**
214
184
  * Retrieves a collection of calendars based on the request parameters
215
185
  * Defaults to 1 day before and 7 days ahead
@@ -228,11 +198,9 @@ var Calendar = _webexCore.WebexPlugin.extend({
228
198
  toDate: options.toDate
229
199
  }).then(function (res) {
230
200
  _collection.default.setAll(res);
231
-
232
201
  return _collection.default.getAll();
233
202
  });
234
203
  },
235
-
236
204
  /**
237
205
  * get the calendar item that has a matching value
238
206
  * @param {String} key meeting property
@@ -243,10 +211,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
243
211
  if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {
244
212
  return _collection.default.getBy(key, value);
245
213
  }
246
-
247
214
  throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');
248
215
  },
249
-
250
216
  /**
251
217
  * gets all the calendar items that have been populated
252
218
  * @returns {Object}
@@ -254,7 +220,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
254
220
  getAll: function getAll() {
255
221
  return _collection.default.getAll();
256
222
  },
257
-
258
223
  /**
259
224
  * Decrypts an encrypted incoming calendar event
260
225
  * @param {Object} event
@@ -265,20 +230,28 @@ var Calendar = _webexCore.WebexPlugin.extend({
265
230
  return event;
266
231
  });
267
232
  },
268
-
269
233
  /**
270
- * Retrieves an array of meeting participants for the meeting id
271
- * @param {String} id
234
+ * Retrieves an array of meeting participants for the meeting participantsUrl
235
+ * @param {String} participantsUrl
272
236
  * @returns {Promise} Resolves with an object of meeting participants
273
237
  */
274
- getParticipants: function getParticipants(id) {
238
+ getParticipants: function getParticipants(participantsUrl) {
275
239
  return this.request({
276
240
  method: 'GET',
277
- service: 'calendar',
278
- resource: "calendarEvents/".concat((0, _btoa.default)(id), "/participants")
241
+ uri: participantsUrl
242
+ });
243
+ },
244
+ /**
245
+ * get meeting notes using notesUrl from meeting object.
246
+ * @param {String} notesUrl
247
+ * @returns {Promise} Resolves with an object of meeting notes
248
+ */
249
+ getNotesByUrl: function getNotesByUrl(notesUrl) {
250
+ return this.request({
251
+ method: 'GET',
252
+ uri: notesUrl
279
253
  });
280
254
  },
281
-
282
255
  /**
283
256
  * Retrieves a collection of meetings based on the request parameters
284
257
  * @param {String} id
@@ -291,7 +264,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
291
264
  resource: "calendarEvents/".concat((0, _btoa.default)(id), "/notes")
292
265
  });
293
266
  },
294
-
295
267
  /**
296
268
  * Retrieves a collection of meetings based on the request parameters
297
269
  * @param {Object} options
@@ -301,7 +273,6 @@ var Calendar = _webexCore.WebexPlugin.extend({
301
273
  */
302
274
  list: function list(options) {
303
275
  var _this4 = this;
304
-
305
276
  options = options || {};
306
277
  return this.webex.request({
307
278
  method: 'GET',
@@ -312,14 +283,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
312
283
  var meetingObjects = res.body.items;
313
284
  var promises = [];
314
285
  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
286
  if (!meeting.encryptedParticipants) {
322
- promises.push(_this4.getParticipants(meeting.id).then(function (notesResponse) {
287
+ promises.push(_this4.getParticipants(meeting.participantsUrl).then(function (notesResponse) {
323
288
  meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
324
289
  }));
325
290
  }
@@ -329,9 +294,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
329
294
  });
330
295
  });
331
296
  },
332
- version: "3.0.0-beta.15"
297
+ version: "3.0.0-beta.150"
333
298
  });
334
-
335
299
  var _default = Calendar;
336
300
  exports.default = _default;
337
301
  //# sourceMappingURL=calendar.js.map
@@ -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 {\n CALENDAR_REGISTERED,\n CALENDAR_UNREGISTERED,\n CALENDAR_DELETE,\n CALENDAR_CREATE,\n CALENDAR_UPDATED,\n} 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\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 },\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).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\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.encryptedNotes) {\n promises.push(\n this.getNotes(meeting.id).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).then((notesResponse) => {\n meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;\n })\n );\n }\n });\n\n return Promise.all(promises).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;AAcA,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,CA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AKxC,KAAL,CACJyD,OADI,CACI;MACPC,MAAM,EAAE,KADD;MAEPC,OAAO,EAAE,UAFF;MAGPC,QAAQ,EAAE,gBAHH;MAIPG,EAAE,EAAEvB;IAJG,CADJ,EAOJ9B,IAPI,CAOC,UAACmC,GAAD,EAAS;MACb,IAAMmB,cAAc,GAAGnB,GAAG,CAACoB,IAAJ,CAASC,KAAhC;MACA,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,EAA0BnB,IAA1B,CAA+B,UAAC8D,aAAD,EAAmB;YAChDH,OAAO,CAACC,cAAR,GAAyBE,aAAa,CAACP,IAAd,IAAsBO,aAAa,CAACP,IAAd,CAAmBK,cAAlE;UACD,CAFD,CADF;QAKD;;QAED,IAAI,CAACD,OAAO,CAACI,qBAAb,EAAoC;UAClCN,QAAQ,CAACI,IAAT,CACE,MAAI,CAACf,eAAL,CAAqBa,OAAO,CAACxC,EAA7B,EAAiCnB,IAAjC,CAAsC,UAAC8D,aAAD,EAAmB;YACvDH,OAAO,CAACI,qBAAR,GAAgCD,aAAa,CAACP,IAAd,CAAmBQ,qBAAnD;UACD,CAFD,CADF;QAKD;MACF,CAhBD;MAkBA,OAAO,iBAAQC,GAAR,CAAYP,QAAZ,EAAsBzD,IAAtB,CAA2B;QAAA,OAAMsD,cAAN;MAAA,CAA3B,CAAP;IACD,CA9BI,CAAP;EA+BD,CAjQiC;EAAA;AAAA,CAAnB,CAAjB;;eAoQetE,Q"}
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","participantsUrl","request","method","uri","getNotesByUrl","notesUrl","getNotes","service","resource","btoa","qs","meetingObjects","body","items","promises","forEach","meeting","encryptedParticipants","push","notesResponse","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 {\n CALENDAR_REGISTERED,\n CALENDAR_UNREGISTERED,\n CALENDAR_DELETE,\n CALENDAR_CREATE,\n CALENDAR_UPDATED,\n} 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\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 },\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).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/${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\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\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;;AAcA,IAAMA,QAAQ,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAClCC,SAAS,EAAE,UAAU;EAErB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CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEY1E,QAAQ;AAAA"}
@@ -1,30 +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 _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
14
-
15
10
  var _find2 = _interopRequireDefault(require("lodash/find"));
16
-
17
11
  var _util = _interopRequireDefault(require("./util"));
18
-
19
12
  var _constants = require("./constants");
20
-
21
13
  /**
22
14
  * @class CalendarCollection
23
15
  */
24
16
  var CalendarCollection = {
25
17
  namespace: _constants.CALENDAR,
26
18
  items: {},
27
-
28
19
  /**
29
20
  * @param {String} id calendar ID
30
21
  * @returns {Any} Calendar Item specifc to that id
@@ -34,7 +25,6 @@ var CalendarCollection = {
34
25
  get: function get(id) {
35
26
  return this.items[id];
36
27
  },
37
-
38
28
  /**
39
29
  * @param {String} key any key and the corresponding calendar Item
40
30
  * @param {String} value any values corresponding to calendar item
@@ -48,10 +38,8 @@ var CalendarCollection = {
48
38
  return item[key] === value;
49
39
  });
50
40
  }
51
-
52
41
  return null;
53
42
  },
54
-
55
43
  /**
56
44
  * @param {Object} item CalendarObject passed to the collection
57
45
  * @returns {Any} returns calender id whats get set
@@ -60,13 +48,10 @@ var CalendarCollection = {
60
48
  */
61
49
  set: function set(item) {
62
50
  var itemId = item.id;
63
-
64
51
  var meeting = _util.default.calculateEndTime(item);
65
-
66
52
  this.items[itemId] = meeting;
67
53
  return itemId;
68
54
  },
69
-
70
55
  /**
71
56
  * resets all the values in the calendarcollection
72
57
  * @returns {undefined}
@@ -76,7 +61,6 @@ var CalendarCollection = {
76
61
  reset: function reset() {
77
62
  this.items = {};
78
63
  },
79
-
80
64
  /**
81
65
  * @param {Id} id is the id for the calendar item to be removed
82
66
  * @returns {Any} calendar item which got removed
@@ -88,7 +72,6 @@ var CalendarCollection = {
88
72
  delete this.items[id];
89
73
  return meeting;
90
74
  },
91
-
92
75
  /**
93
76
  * sets all the item passed to the collection
94
77
  * @param {Array} items array of calendar items
@@ -98,12 +81,10 @@ var CalendarCollection = {
98
81
  */
99
82
  setAll: function setAll(items) {
100
83
  var _this = this;
101
-
102
84
  items.forEach(function (item) {
103
85
  _this.set(item);
104
86
  });
105
87
  },
106
-
107
88
  /**
108
89
  * gets all the calendar stored in the collection
109
90
  * @param {Array} items array of calendar items
@@ -1 +1 @@
1
- {"version":3,"names":["CalendarCollection","namespace","CALENDAR","items","get","id","getBy","key","value","item","set","itemId","meeting","CalendarUtil","calculateEndTime","reset","remove","setAll","forEach","getAll"],"sources":["collection.js"],"sourcesContent":["import {find} from 'lodash';\n\nimport CalendarUtil from './util';\nimport {CALENDAR} from './constants';\n/**\n * @class CalendarCollection\n */\nconst CalendarCollection = {\n namespace: CALENDAR,\n items: {},\n /**\n * @param {String} id calendar ID\n * @returns {Any} Calendar Item specifc to that id\n * @private\n * @memberof CalendarCollection\n */\n get(id) {\n return this.items[id];\n },\n\n /**\n * @param {String} key any key and the corresponding calendar Item\n * @param {String} value any values corresponding to calendar item\n * @returns {Any} returns whatever is being stuffed into the collection\n * @private\n * @memberof CalendarCollection\n */\n getBy(key, value) {\n if (key && value) {\n return find(this.items, (item) => item[key] === value);\n }\n\n return null;\n },\n\n /**\n * @param {Object} item CalendarObject passed to the collection\n * @returns {Any} returns calender id whats get set\n * @private\n * @memberof CalendarCollection\n */\n set(item) {\n const itemId = item.id;\n const meeting = CalendarUtil.calculateEndTime(item);\n\n this.items[itemId] = meeting;\n\n return itemId;\n },\n\n /**\n * resets all the values in the calendarcollection\n * @returns {undefined}\n * @private\n * @memberof CalendarCollection\n */\n reset() {\n this.items = {};\n },\n\n /**\n * @param {Id} id is the id for the calendar item to be removed\n * @returns {Any} calendar item which got removed\n * @private\n * @memberof CalendarCollection\n */\n remove(id) {\n const meeting = this.get(id);\n\n delete this.items[id];\n\n return meeting;\n },\n\n /**\n * sets all the item passed to the collection\n * @param {Array} items array of calendar items\n * @private\n * @returns {undefined}\n * @memberof CalendarCollection\n */\n setAll(items) {\n items.forEach((item) => {\n this.set(item);\n });\n },\n\n /**\n * gets all the calendar stored in the collection\n * @param {Array} items array of calendar items\n * @private\n * @returns {Array} returns an array of calendar items\n * @memberof CalendarCollection\n */\n getAll() {\n return Object.values(this.items);\n },\n};\n\nexport default CalendarCollection;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG;EACzBC,SAAS,EAAEC,mBADc;EAEzBC,KAAK,EAAE,EAFkB;;EAGzB;AACF;AACA;AACA;AACA;AACA;EACEC,GATyB,eASrBC,EATqB,EASjB;IACN,OAAO,KAAKF,KAAL,CAAWE,EAAX,CAAP;EACD,CAXwB;;EAazB;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,KApByB,iBAoBnBC,GApBmB,EAoBdC,KApBc,EAoBP;IAChB,IAAID,GAAG,IAAIC,KAAX,EAAkB;MAChB,OAAO,oBAAK,KAAKL,KAAV,EAAiB,UAACM,IAAD;QAAA,OAAUA,IAAI,CAACF,GAAD,CAAJ,KAAcC,KAAxB;MAAA,CAAjB,CAAP;IACD;;IAED,OAAO,IAAP;EACD,CA1BwB;;EA4BzB;AACF;AACA;AACA;AACA;AACA;EACEE,GAlCyB,eAkCrBD,IAlCqB,EAkCf;IACR,IAAME,MAAM,GAAGF,IAAI,CAACJ,EAApB;;IACA,IAAMO,OAAO,GAAGC,aAAA,CAAaC,gBAAb,CAA8BL,IAA9B,CAAhB;;IAEA,KAAKN,KAAL,CAAWQ,MAAX,IAAqBC,OAArB;IAEA,OAAOD,MAAP;EACD,CAzCwB;;EA2CzB;AACF;AACA;AACA;AACA;AACA;EACEI,KAjDyB,mBAiDjB;IACN,KAAKZ,KAAL,GAAa,EAAb;EACD,CAnDwB;;EAqDzB;AACF;AACA;AACA;AACA;AACA;EACEa,MA3DyB,kBA2DlBX,EA3DkB,EA2Dd;IACT,IAAMO,OAAO,GAAG,KAAKR,GAAL,CAASC,EAAT,CAAhB;IAEA,OAAO,KAAKF,KAAL,CAAWE,EAAX,CAAP;IAEA,OAAOO,OAAP;EACD,CAjEwB;;EAmEzB;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,MA1EyB,kBA0ElBd,KA1EkB,EA0EX;IAAA;;IACZA,KAAK,CAACe,OAAN,CAAc,UAACT,IAAD,EAAU;MACtB,KAAI,CAACC,GAAL,CAASD,IAAT;IACD,CAFD;EAGD,CA9EwB;;EAgFzB;AACF;AACA;AACA;AACA;AACA;AACA;EACEU,MAvFyB,oBAuFhB;IACP,OAAO,qBAAc,KAAKhB,KAAnB,CAAP;EACD;AAzFwB,CAA3B;eA4FeH,kB"}
1
+ {"version":3,"names":["CalendarCollection","namespace","CALENDAR","items","get","id","getBy","key","value","item","set","itemId","meeting","CalendarUtil","calculateEndTime","reset","remove","setAll","forEach","getAll"],"sources":["collection.js"],"sourcesContent":["import {find} from 'lodash';\n\nimport CalendarUtil from './util';\nimport {CALENDAR} from './constants';\n/**\n * @class CalendarCollection\n */\nconst CalendarCollection = {\n namespace: CALENDAR,\n items: {},\n /**\n * @param {String} id calendar ID\n * @returns {Any} Calendar Item specifc to that id\n * @private\n * @memberof CalendarCollection\n */\n get(id) {\n return this.items[id];\n },\n\n /**\n * @param {String} key any key and the corresponding calendar Item\n * @param {String} value any values corresponding to calendar item\n * @returns {Any} returns whatever is being stuffed into the collection\n * @private\n * @memberof CalendarCollection\n */\n getBy(key, value) {\n if (key && value) {\n return find(this.items, (item) => item[key] === value);\n }\n\n return null;\n },\n\n /**\n * @param {Object} item CalendarObject passed to the collection\n * @returns {Any} returns calender id whats get set\n * @private\n * @memberof CalendarCollection\n */\n set(item) {\n const itemId = item.id;\n const meeting = CalendarUtil.calculateEndTime(item);\n\n this.items[itemId] = meeting;\n\n return itemId;\n },\n\n /**\n * resets all the values in the calendarcollection\n * @returns {undefined}\n * @private\n * @memberof CalendarCollection\n */\n reset() {\n this.items = {};\n },\n\n /**\n * @param {Id} id is the id for the calendar item to be removed\n * @returns {Any} calendar item which got removed\n * @private\n * @memberof CalendarCollection\n */\n remove(id) {\n const meeting = this.get(id);\n\n delete this.items[id];\n\n return meeting;\n },\n\n /**\n * sets all the item passed to the collection\n * @param {Array} items array of calendar items\n * @private\n * @returns {undefined}\n * @memberof CalendarCollection\n */\n setAll(items) {\n items.forEach((item) => {\n this.set(item);\n });\n },\n\n /**\n * gets all the calendar stored in the collection\n * @param {Array} items array of calendar items\n * @private\n * @returns {Array} returns an array of calendar items\n * @memberof CalendarCollection\n */\n getAll() {\n return Object.values(this.items);\n },\n};\n\nexport default CalendarCollection;\n"],"mappings":";;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG;EACzBC,SAAS,EAAEC,mBAAQ;EACnBC,KAAK,EAAE,CAAC,CAAC;EACT;AACF;AACA;AACA;AACA;AACA;EACEC,GAAG,eAACC,EAAE,EAAE;IACN,OAAO,IAAI,CAACF,KAAK,CAACE,EAAE,CAAC;EACvB,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,KAAK,iBAACC,GAAG,EAAEC,KAAK,EAAE;IAChB,IAAID,GAAG,IAAIC,KAAK,EAAE;MAChB,OAAO,oBAAK,IAAI,CAACL,KAAK,EAAE,UAACM,IAAI;QAAA,OAAKA,IAAI,CAACF,GAAG,CAAC,KAAKC,KAAK;MAAA,EAAC;IACxD;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,GAAG,eAACD,IAAI,EAAE;IACR,IAAME,MAAM,GAAGF,IAAI,CAACJ,EAAE;IACtB,IAAMO,OAAO,GAAGC,aAAY,CAACC,gBAAgB,CAACL,IAAI,CAAC;IAEnD,IAAI,CAACN,KAAK,CAACQ,MAAM,CAAC,GAAGC,OAAO;IAE5B,OAAOD,MAAM;EACf,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEI,KAAK,mBAAG;IACN,IAAI,CAACZ,KAAK,GAAG,CAAC,CAAC;EACjB,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEa,MAAM,kBAACX,EAAE,EAAE;IACT,IAAMO,OAAO,GAAG,IAAI,CAACR,GAAG,CAACC,EAAE,CAAC;IAE5B,OAAO,IAAI,CAACF,KAAK,CAACE,EAAE,CAAC;IAErB,OAAOO,OAAO;EAChB,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,MAAM,kBAACd,KAAK,EAAE;IAAA;IACZA,KAAK,CAACe,OAAO,CAAC,UAACT,IAAI,EAAK;MACtB,KAAI,CAACC,GAAG,CAACD,IAAI,CAAC;IAChB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEU,MAAM,oBAAG;IACP,OAAO,qBAAc,IAAI,CAAChB,KAAK,CAAC;EAClC;AACF,CAAC;AAAC,eAEaH,kBAAkB;AAAA"}
package/dist/config.js CHANGED
@@ -1,13 +1,10 @@
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
-
11
8
  /*!
12
9
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
13
10
  */
@@ -1 +1 @@
1
- {"version":3,"names":["calendar","fromDate","Date","setDate","getDate","toDate"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n calendar: {\n fromDate: new Date(new Date().setDate(new Date().getDate() - 1)),\n toDate: new Date(new Date().setDate(new Date().getDate() + 7)),\n },\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;eAEe;EACbA,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIC,IAAJ,CAAS,IAAIA,IAAJ,GAAWC,OAAX,CAAmB,IAAID,IAAJ,GAAWE,OAAX,KAAuB,CAA1C,CAAT,CADF;IAERC,MAAM,EAAE,IAAIH,IAAJ,CAAS,IAAIA,IAAJ,GAAWC,OAAX,CAAmB,IAAID,IAAJ,GAAWE,OAAX,KAAuB,CAA1C,CAAT;EAFA;AADG,C"}
1
+ {"version":3,"names":["calendar","fromDate","Date","setDate","getDate","toDate"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n calendar: {\n fromDate: new Date(new Date().setDate(new Date().getDate() - 1)),\n toDate: new Date(new Date().setDate(new Date().getDate() + 7)),\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,eAIe;EACbA,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIC,IAAI,CAAC,IAAIA,IAAI,EAAE,CAACC,OAAO,CAAC,IAAID,IAAI,EAAE,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAChEC,MAAM,EAAE,IAAIH,IAAI,CAAC,IAAIA,IAAI,EAAE,CAACC,OAAO,CAAC,IAAID,IAAI,EAAE,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC;EAC/D;AACF,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.CALENDAR_UPDATED = exports.CALENDAR_UNREGISTERED = exports.CALENDAR_REGISTERED = exports.CALENDAR_DELETE = exports.CALENDAR_CREATE = exports.CALENDAR = void 0;
10
8
  var CALENDAR_REGISTERED = 'calendar:registered';
11
9
  exports.CALENDAR_REGISTERED = CALENDAR_REGISTERED;
@@ -1 +1 @@
1
- {"version":3,"names":["CALENDAR_REGISTERED","CALENDAR_UNREGISTERED","CALENDAR_UPDATED","CALENDAR_DELETE","CALENDAR_CREATE","CALENDAR"],"sources":["constants.js"],"sourcesContent":["export const CALENDAR_REGISTERED = 'calendar:registered';\nexport const CALENDAR_UNREGISTERED = 'calendar:unregistered';\nexport const CALENDAR_UPDATED = 'calendar:update';\nexport const CALENDAR_DELETE = 'calendar:delete';\nexport const CALENDAR_CREATE = 'calendar:create';\nexport const CALENDAR = 'CALENDAR';\n"],"mappings":";;;;;;;;;AAAO,IAAMA,mBAAmB,GAAG,qBAA5B;;AACA,IAAMC,qBAAqB,GAAG,uBAA9B;;AACA,IAAMC,gBAAgB,GAAG,iBAAzB;;AACA,IAAMC,eAAe,GAAG,iBAAxB;;AACA,IAAMC,eAAe,GAAG,iBAAxB;;AACA,IAAMC,QAAQ,GAAG,UAAjB"}
1
+ {"version":3,"names":["CALENDAR_REGISTERED","CALENDAR_UNREGISTERED","CALENDAR_UPDATED","CALENDAR_DELETE","CALENDAR_CREATE","CALENDAR"],"sources":["constants.js"],"sourcesContent":["export const CALENDAR_REGISTERED = 'calendar:registered';\nexport const CALENDAR_UNREGISTERED = 'calendar:unregistered';\nexport const CALENDAR_UPDATED = 'calendar:update';\nexport const CALENDAR_DELETE = 'calendar:delete';\nexport const CALENDAR_CREATE = 'calendar:create';\nexport const CALENDAR = 'CALENDAR';\n"],"mappings":";;;;;;;AAAO,IAAMA,mBAAmB,GAAG,qBAAqB;AAAC;AAClD,IAAMC,qBAAqB,GAAG,uBAAuB;AAAC;AACtD,IAAMC,gBAAgB,GAAG,iBAAiB;AAAC;AAC3C,IAAMC,eAAe,GAAG,iBAAiB;AAAC;AAC1C,IAAMC,eAAe,GAAG,iBAAiB;AAAC;AAC1C,IAAMC,QAAQ,GAAG,UAAU;AAAC"}
package/dist/index.js CHANGED
@@ -1,39 +1,28 @@
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, "default", {
12
9
  enumerable: true,
13
10
  get: function get() {
14
11
  return _calendar.default;
15
12
  }
16
13
  });
17
-
18
14
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
19
-
20
15
  var _has2 = _interopRequireDefault(require("lodash/has"));
21
-
22
16
  require("@webex/internal-plugin-device");
23
-
24
17
  require("@webex/internal-plugin-encryption");
25
-
26
18
  require("@webex/internal-plugin-conversation");
27
-
28
19
  var _webexCore = require("@webex/webex-core");
29
-
30
20
  var _calendar = _interopRequireDefault(require("./calendar"));
31
-
32
21
  var _config = _interopRequireDefault(require("./config"));
33
-
34
22
  /*!
35
23
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
36
24
  */
25
+
37
26
  (0, _webexCore.registerInternalPlugin)('calendar', _calendar.default, {
38
27
  config: _config.default,
39
28
  payloadTransformer: {
@@ -97,16 +86,16 @@ var _config = _interopRequireDefault(require("./config"));
97
86
  if (!object) {
98
87
  return _promise.default.resolve();
99
88
  }
100
-
101
89
  if (!object.encryptionKeyUrl) {
102
90
  return _promise.default.resolve();
103
- } // Decrypt participant properties if meeting object contains participants
104
-
91
+ }
105
92
 
93
+ // Decrypt participant properties if meeting object contains participants
106
94
  var decryptedParticipants = object.encryptedParticipants ? object.encryptedParticipants.map(function (participant) {
107
95
  return _promise.default.all([ctx.transform('decryptTextProp', 'encryptedEmailAddress', object.encryptionKeyUrl, participant), ctx.transform('decryptTextProp', 'encryptedName', object.encryptionKeyUrl, participant)]);
108
- }) : []; // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo
96
+ }) : [];
109
97
 
98
+ // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo
110
99
  var decryptedMeetingJoinInfo = object.meetingJoinInfo ? _promise.default.all([ctx.transform('decryptTextProp', 'meetingJoinURI', object.encryptionKeyUrl, object.meetingJoinInfo), ctx.transform('decryptTextProp', 'meetingJoinURL', object.encryptionKeyUrl, object.meetingJoinInfo)]) : [];
111
100
  var decryptedOrganizer = object.encryptedOrganizer ? _promise.default.all([ctx.transform('decryptTextProp', 'encryptedEmailAddress', object.encryptionKeyUrl, object.encryptedOrganizer), ctx.transform('decryptTextProp', 'encryptedName', object.encryptionKeyUrl, object.encryptedOrganizer)]) : [];
112
101
  return _promise.default.all([ctx.transform('decryptTextProp', 'encryptedSubject', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'encryptedLocation', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'webexURI', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'webexURL', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'spaceMeetURL', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'spaceURI', object.encryptionKeyUrl, object), ctx.transform('decryptTextProp', 'spaceURL', object.encryptionKeyUrl, object)].concat(decryptedOrganizer, decryptedParticipants, decryptedMeetingJoinInfo));
@@ -118,11 +107,9 @@ var _config = _interopRequireDefault(require("./config"));
118
107
  if (!object) {
119
108
  return _promise.default.resolve();
120
109
  }
121
-
122
110
  if (!object.encryptionKeyUrl) {
123
111
  return _promise.default.resolve();
124
112
  }
125
-
126
113
  return _promise.default.all([ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object)]);
127
114
  }
128
115
  }, {
@@ -132,12 +119,11 @@ var _config = _interopRequireDefault(require("./config"));
132
119
  if (!object) {
133
120
  return _promise.default.resolve();
134
121
  }
135
-
136
122
  if (!object.encryptionKeyUrl || !object.encryptedParticipants) {
137
123
  return _promise.default.resolve();
138
- } // Decrypt participant properties
139
-
124
+ }
140
125
 
126
+ // Decrypt participant properties
141
127
  var decryptedParticipants = object.encryptedParticipants.map(function (participant) {
142
128
  return _promise.default.all([ctx.transform('decryptTextProp', 'encryptedEmailAddress', object.encryptionKeyUrl, participant), ctx.transform('decryptTextProp', 'encryptedName', object.encryptionKeyUrl, participant)]);
143
129
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["registerInternalPlugin","Calendar","config","payloadTransformer","predicates","name","direction","test","ctx","response","resolve","extract","body","items","calendarMeetingExternal","transforms","fn","array","all","map","item","transform","object","encryptionKeyUrl","decryptedParticipants","encryptedParticipants","participant","decryptedMeetingJoinInfo","meetingJoinInfo","decryptedOrganizer","encryptedOrganizer","concat"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\nimport '@webex/internal-plugin-encryption';\nimport '@webex/internal-plugin-conversation';\n\nimport {registerInternalPlugin} from '@webex/webex-core';\nimport {has} from 'lodash';\n\nimport Calendar from './calendar';\nimport config from './config';\n\nregisterInternalPlugin('calendar', Calendar, {\n config,\n payloadTransformer: {\n predicates: [\n {\n name: 'transformMeetingNotes',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.encryptedNotes'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeetingParticipants',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.encryptedParticipants'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeetingArray',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.items[0].seriesId'));\n },\n extract(response) {\n return Promise.resolve(response.body.items);\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.seriesId'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'calendarMeetingExternal'));\n },\n extract(response) {\n return Promise.resolve(response.calendarMeetingExternal);\n },\n },\n ],\n transforms: [\n {\n name: 'transformMeetingArray',\n fn(ctx, array) {\n return Promise.all(array.map((item) => ctx.transform('transformMeeting', item)));\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties if meeting object contains participants\n const decryptedParticipants = object.encryptedParticipants\n ? object.encryptedParticipants.map((participant) =>\n Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n participant\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n participant\n ),\n ])\n )\n : [];\n\n // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo\n const decryptedMeetingJoinInfo = object.meetingJoinInfo\n ? Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'meetingJoinURI',\n object.encryptionKeyUrl,\n object.meetingJoinInfo\n ),\n ctx.transform(\n 'decryptTextProp',\n 'meetingJoinURL',\n object.encryptionKeyUrl,\n object.meetingJoinInfo\n ),\n ])\n : [];\n\n const decryptedOrganizer = object.encryptedOrganizer\n ? Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n object.encryptedOrganizer\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n object.encryptedOrganizer\n ),\n ])\n : [];\n\n return Promise.all(\n [\n ctx.transform('decryptTextProp', 'encryptedSubject', object.encryptionKeyUrl, object),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedLocation',\n object.encryptionKeyUrl,\n object\n ),\n ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'webexURI', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'webexURL', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceMeetURL', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceURI', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceURL', object.encryptionKeyUrl, object),\n ].concat(decryptedOrganizer, decryptedParticipants, decryptedMeetingJoinInfo)\n );\n },\n },\n {\n name: 'transformMeetingNotes',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n return Promise.all([\n ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object),\n ]);\n },\n },\n {\n name: 'transformMeetingParticipants',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl || !object.encryptedParticipants) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties\n const decryptedParticipants = object.encryptedParticipants.map((participant) =>\n Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n participant\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n participant\n ),\n ])\n );\n\n return Promise.all(decryptedParticipants);\n },\n },\n ],\n },\n});\n\nexport {default} from './calendar';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AACA;;AAEA;;AAGA;;AACA;;AAZA;AACA;AACA;AAYA,IAAAA,iCAAA,EAAuB,UAAvB,EAAmCC,iBAAnC,EAA6C;EAC3CC,MAAM,EAANA,eAD2C;EAE3CC,kBAAkB,EAAE;IAClBC,UAAU,EAAE,CACV;MACEC,IAAI,EAAE,uBADR;MAEEC,SAAS,EAAE,SAFb;MAGEC,IAHF,gBAGOC,GAHP,EAGYC,QAHZ,EAGsB;QAClB,OAAO,iBAAQC,OAA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,CAPU,CAAZ,CAD6D;QAAA,CAAjC,CAA9B;QAiBA,OAAO,iBAAQR,GAAR,CAAYM,qBAAZ,CAAP;MACD;IA/BH,CA9GU;EArDM;AAFuB,CAA7C"}
1
+ {"version":3,"names":["registerInternalPlugin","Calendar","config","payloadTransformer","predicates","name","direction","test","ctx","response","resolve","extract","body","items","calendarMeetingExternal","transforms","fn","array","all","map","item","transform","object","encryptionKeyUrl","decryptedParticipants","encryptedParticipants","participant","decryptedMeetingJoinInfo","meetingJoinInfo","decryptedOrganizer","encryptedOrganizer","concat"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\nimport '@webex/internal-plugin-encryption';\nimport '@webex/internal-plugin-conversation';\n\nimport {registerInternalPlugin} from '@webex/webex-core';\nimport {has} from 'lodash';\n\nimport Calendar from './calendar';\nimport config from './config';\n\nregisterInternalPlugin('calendar', Calendar, {\n config,\n payloadTransformer: {\n predicates: [\n {\n name: 'transformMeetingNotes',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.encryptedNotes'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeetingParticipants',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.encryptedParticipants'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeetingArray',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.items[0].seriesId'));\n },\n extract(response) {\n return Promise.resolve(response.body.items);\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'body.seriesId'));\n },\n extract(response) {\n return Promise.resolve(response.body);\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n test(ctx, response) {\n return Promise.resolve(has(response, 'calendarMeetingExternal'));\n },\n extract(response) {\n return Promise.resolve(response.calendarMeetingExternal);\n },\n },\n ],\n transforms: [\n {\n name: 'transformMeetingArray',\n fn(ctx, array) {\n return Promise.all(array.map((item) => ctx.transform('transformMeeting', item)));\n },\n },\n {\n name: 'transformMeeting',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties if meeting object contains participants\n const decryptedParticipants = object.encryptedParticipants\n ? object.encryptedParticipants.map((participant) =>\n Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n participant\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n participant\n ),\n ])\n )\n : [];\n\n // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo\n const decryptedMeetingJoinInfo = object.meetingJoinInfo\n ? Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'meetingJoinURI',\n object.encryptionKeyUrl,\n object.meetingJoinInfo\n ),\n ctx.transform(\n 'decryptTextProp',\n 'meetingJoinURL',\n object.encryptionKeyUrl,\n object.meetingJoinInfo\n ),\n ])\n : [];\n\n const decryptedOrganizer = object.encryptedOrganizer\n ? Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n object.encryptedOrganizer\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n object.encryptedOrganizer\n ),\n ])\n : [];\n\n return Promise.all(\n [\n ctx.transform('decryptTextProp', 'encryptedSubject', object.encryptionKeyUrl, object),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedLocation',\n object.encryptionKeyUrl,\n object\n ),\n ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'webexURI', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'webexURL', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceMeetURL', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceURI', object.encryptionKeyUrl, object),\n ctx.transform('decryptTextProp', 'spaceURL', object.encryptionKeyUrl, object),\n ].concat(decryptedOrganizer, decryptedParticipants, decryptedMeetingJoinInfo)\n );\n },\n },\n {\n name: 'transformMeetingNotes',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n return Promise.all([\n ctx.transform('decryptTextProp', 'encryptedNotes', object.encryptionKeyUrl, object),\n ]);\n },\n },\n {\n name: 'transformMeetingParticipants',\n direction: 'inbound',\n fn(ctx, object) {\n if (!object) {\n return Promise.resolve();\n }\n\n if (!object.encryptionKeyUrl || !object.encryptedParticipants) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties\n const decryptedParticipants = object.encryptedParticipants.map((participant) =>\n Promise.all([\n ctx.transform(\n 'decryptTextProp',\n 'encryptedEmailAddress',\n object.encryptionKeyUrl,\n participant\n ),\n ctx.transform(\n 'decryptTextProp',\n 'encryptedName',\n object.encryptionKeyUrl,\n participant\n ),\n ])\n );\n\n return Promise.all(decryptedParticipants);\n },\n },\n ],\n },\n});\n\nexport {default} from './calendar';\n"],"mappings":";;;;;;;;;;;;;;;AAIA;AACA;AACA;AAEA;AAGA;AACA;AAZA;AACA;AACA;;AAYA,IAAAA,iCAAsB,EAAC,UAAU,EAAEC,iBAAQ,EAAE;EAC3CC,MAAM,EAANA,eAAM;EACNC,kBAAkB,EAAE;IAClBC,UAAU,EAAE,CACV;MACEC,IAAI,EAAE,uBAAuB;MAC7BC,SAAS,EAAE,SAAS;MACpBC,IAAI,gBAACC,GAAG,EAAEC,QAAQ,EAAE;QAClB,OAAO,iBAAQC,OAAO,CAAC,mBAAID,QAAQ,EAAE,qBAAqB,CAAC,CAAC;MAC9D,CAAC;MACDE,OAAO,mBAACF,QAAQ,EAAE;QAChB,OAAO,iBA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("@babel/runtime-corejs2/core-js/object/keys");
4
-
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
-
7
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
-
9
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
10
-
11
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
12
-
13
8
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
14
-
15
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
16
-
17
10
  _Object$defineProperty(exports, "__esModule", {
18
11
  value: true
19
12
  });
20
-
21
13
  exports.default = void 0;
22
-
23
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
24
-
25
15
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
26
-
27
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
28
-
29
17
  var CalendarUtil = {
30
18
  // calculate the end time for the meeting based on the duration so it's stored on
31
19
  // the scheduled meeting item, that way client can display start and end without
32
20
  // calculation on their side
33
21
  // gets the start time from server, and the duration, and reformats
34
-
35
22
  /**
36
23
  * calculates the end time for meeting
37
24
  * @param {Object} item the locus.host property
package/dist/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["CalendarUtil","calculateEndTime","item","endTime","Date","start","getTime","durationMinutes"],"sources":["util.js"],"sourcesContent":["const CalendarUtil = {\n // calculate the end time for the meeting based on the duration so it's stored on\n // the scheduled meeting item, that way client can display start and end without\n // calculation on their side\n // gets the start time from server, and the duration, and reformats\n /**\n * calculates the end time for meeting\n * @param {Object} item the locus.host property\n * @param {Object} item.start start time of the meeting\n * @param {Object} item.duration duration of the meeting\n * @returns {Object} end time of the meeting\n * @memberof CalendarUtil\n */\n calculateEndTime(item) {\n return {\n ...item,\n endTime: new Date(new Date(item.start).getTime() + item.durationMinutes * 60000),\n };\n },\n};\n\nexport default CalendarUtil;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG;EACnB;EACA;EACA;EACA;;EACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,gBAbmB,4BAaFC,IAbE,EAaI;IACrB,uCACKA,IADL;MAEEC,OAAO,EAAE,IAAIC,IAAJ,CAAS,IAAIA,IAAJ,CAASF,IAAI,CAACG,KAAd,EAAqBC,OAArB,KAAiCJ,IAAI,CAACK,eAAL,GAAuB,KAAjE;IAFX;EAID;AAlBkB,CAArB;eAqBeP,Y"}
1
+ {"version":3,"names":["CalendarUtil","calculateEndTime","item","endTime","Date","start","getTime","durationMinutes"],"sources":["util.js"],"sourcesContent":["const CalendarUtil = {\n // calculate the end time for the meeting based on the duration so it's stored on\n // the scheduled meeting item, that way client can display start and end without\n // calculation on their side\n // gets the start time from server, and the duration, and reformats\n /**\n * calculates the end time for meeting\n * @param {Object} item the locus.host property\n * @param {Object} item.start start time of the meeting\n * @param {Object} item.duration duration of the meeting\n * @returns {Object} end time of the meeting\n * @memberof CalendarUtil\n */\n calculateEndTime(item) {\n return {\n ...item,\n endTime: new Date(new Date(item.start).getTime() + item.durationMinutes * 60000),\n };\n },\n};\n\nexport default CalendarUtil;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG;EACnB;EACA;EACA;EACA;EACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,gBAAgB,4BAACC,IAAI,EAAE;IACrB,uCACKA,IAAI;MACPC,OAAO,EAAE,IAAIC,IAAI,CAAC,IAAIA,IAAI,CAACF,IAAI,CAACG,KAAK,CAAC,CAACC,OAAO,EAAE,GAAGJ,IAAI,CAACK,eAAe,GAAG,KAAK;IAAC;EAEpF;AACF,CAAC;AAAC,eAEaP,YAAY;AAAA"}
package/package.json CHANGED
@@ -19,20 +19,20 @@
19
19
  "envify"
20
20
  ]
21
21
  },
22
- "version": "3.0.0-beta.15",
22
+ "version": "3.0.0-beta.150",
23
23
  "devDependencies": {
24
- "@webex/test-helper-chai": "3.0.0-beta.15",
25
- "@webex/test-helper-mock-webex": "3.0.0-beta.15",
26
- "@webex/test-helper-retry": "3.0.0-beta.15",
27
- "@webex/test-helper-test-users": "3.0.0-beta.15",
24
+ "@webex/test-helper-chai": "3.0.0-beta.150",
25
+ "@webex/test-helper-mock-webex": "3.0.0-beta.150",
26
+ "@webex/test-helper-retry": "3.0.0-beta.150",
27
+ "@webex/test-helper-test-users": "3.0.0-beta.150",
28
28
  "sinon": "^9.2.4"
29
29
  },
30
30
  "dependencies": {
31
- "@webex/internal-plugin-calendar": "3.0.0-beta.15",
32
- "@webex/internal-plugin-conversation": "3.0.0-beta.15",
33
- "@webex/internal-plugin-device": "3.0.0-beta.15",
34
- "@webex/internal-plugin-encryption": "3.0.0-beta.15",
35
- "@webex/webex-core": "3.0.0-beta.15",
31
+ "@webex/internal-plugin-calendar": "3.0.0-beta.150",
32
+ "@webex/internal-plugin-conversation": "3.0.0-beta.150",
33
+ "@webex/internal-plugin-device": "3.0.0-beta.150",
34
+ "@webex/internal-plugin-encryption": "3.0.0-beta.150",
35
+ "@webex/webex-core": "3.0.0-beta.150",
36
36
  "btoa": "^1.2.1",
37
37
  "lodash": "^4.17.21",
38
38
  "uuid": "^3.3.2"
package/src/calendar.js CHANGED
@@ -245,15 +245,26 @@ const Calendar = WebexPlugin.extend({
245
245
  },
246
246
 
247
247
  /**
248
- * Retrieves an array of meeting participants for the meeting id
249
- * @param {String} id
248
+ * Retrieves an array of meeting participants for the meeting participantsUrl
249
+ * @param {String} participantsUrl
250
250
  * @returns {Promise} Resolves with an object of meeting participants
251
251
  */
252
- getParticipants(id) {
252
+ getParticipants(participantsUrl) {
253
253
  return this.request({
254
254
  method: 'GET',
255
- service: 'calendar',
256
- resource: `calendarEvents/${btoa(id)}/participants`,
255
+ uri: participantsUrl,
256
+ });
257
+ },
258
+
259
+ /**
260
+ * get meeting notes using notesUrl from meeting object.
261
+ * @param {String} notesUrl
262
+ * @returns {Promise} Resolves with an object of meeting notes
263
+ */
264
+ getNotesByUrl(notesUrl) {
265
+ return this.request({
266
+ method: 'GET',
267
+ uri: notesUrl,
257
268
  });
258
269
  },
259
270
 
@@ -292,17 +303,9 @@ const Calendar = WebexPlugin.extend({
292
303
  const promises = [];
293
304
 
294
305
  meetingObjects.forEach((meeting) => {
295
- if (!meeting.encryptedNotes) {
296
- promises.push(
297
- this.getNotes(meeting.id).then((notesResponse) => {
298
- meeting.encryptedNotes = notesResponse.body && notesResponse.body.encryptedNotes;
299
- })
300
- );
301
- }
302
-
303
306
  if (!meeting.encryptedParticipants) {
304
307
  promises.push(
305
- this.getParticipants(meeting.id).then((notesResponse) => {
308
+ this.getParticipants(meeting.participantsUrl).then((notesResponse) => {
306
309
  meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
307
310
  })
308
311
  );
@@ -203,18 +203,6 @@ describe('internal-plugin-calendar', () => {
203
203
  },
204
204
  })
205
205
  );
206
- // getNotes stub
207
- webexRequestStub
208
- .withArgs({
209
- method: 'GET',
210
- service: 'calendar',
211
- resource: `calendarEvents/${btoa('calendar1')}/notes`,
212
- })
213
- .returns(
214
- Promise.resolve({
215
- body: null,
216
- })
217
- );
218
206
 
219
207
  // Assign webexRequestStub to webex.request
220
208
  webex.request = webexRequestStub;
@@ -223,7 +211,7 @@ describe('internal-plugin-calendar', () => {
223
211
 
224
212
  assert.equal(res.length, 2);
225
213
  assert.deepEqual(res, [
226
- {id: 'calendar1', encryptedNotes: null, encryptedParticipants: ['participant1']},
214
+ {id: 'calendar1', encryptedParticipants: ['participant1']},
227
215
  {id: 'calendar2', encryptedNotes: 'notes2', encryptedParticipants: ['participant2']},
228
216
  ]);
229
217
  assert.calledWith(webex.request, {
@@ -232,11 +220,6 @@ describe('internal-plugin-calendar', () => {
232
220
  resource: 'calendarEvents',
233
221
  qs: {fromDate: 'xx-xx', toDate: 'xx-nn'},
234
222
  });
235
- assert.calledWith(webex.request, {
236
- method: 'GET',
237
- service: 'calendar',
238
- resource: `calendarEvents/${btoa('calendar1')}/notes`,
239
- });
240
223
  });
241
224
 
242
225
  it('should fetch the calendar list and resolves with fetched encryptedNotes', async () => {
@@ -254,7 +237,7 @@ describe('internal-plugin-calendar', () => {
254
237
  Promise.resolve({
255
238
  body: {
256
239
  items: [
257
- {id: 'calendar1', encryptedParticipants: ['participant1']},
240
+ {id: 'calendar1', encryptedNotes: 'notes1', encryptedParticipants: ['participant1']},
258
241
  {
259
242
  id: 'calendar2',
260
243
  encryptedNotes: 'notes2',
@@ -264,20 +247,6 @@ describe('internal-plugin-calendar', () => {
264
247
  },
265
248
  })
266
249
  );
267
- // getNotes stub
268
- webexRequestStub
269
- .withArgs({
270
- method: 'GET',
271
- service: 'calendar',
272
- resource: `calendarEvents/${btoa('calendar1')}/notes`,
273
- })
274
- .returns(
275
- Promise.resolve({
276
- body: {
277
- encryptedNotes: 'notes1',
278
- },
279
- })
280
- );
281
250
 
282
251
  // Assign webexRequestStub to webex.request
283
252
  webex.request = webexRequestStub;
@@ -295,11 +264,6 @@ describe('internal-plugin-calendar', () => {
295
264
  resource: 'calendarEvents',
296
265
  qs: {fromDate: 'xx-xx', toDate: 'xx-nn'},
297
266
  });
298
- assert.calledWith(webex.request, {
299
- method: 'GET',
300
- service: 'calendar',
301
- resource: `calendarEvents/${btoa('calendar1')}/notes`,
302
- });
303
267
  });
304
268
  });
305
269
 
@@ -327,7 +291,7 @@ describe('internal-plugin-calendar', () => {
327
291
  });
328
292
 
329
293
  describe('#getParticipants()', () => {
330
- const id = 'meetingId123';
294
+ const uri = 'participantsUrl';
331
295
 
332
296
  it('should fetch the meeting participants', async () => {
333
297
  webex.request = sinon.stub().returns(
@@ -338,13 +302,34 @@ describe('internal-plugin-calendar', () => {
338
302
  })
339
303
  );
340
304
 
341
- const res = await webex.internal.calendar.getParticipants(id);
305
+ const res = await webex.internal.calendar.getParticipants(uri);
342
306
 
343
307
  assert.equal(res.body.encryptedParticipants.length, 1);
344
308
  assert.calledWith(webex.request, {
345
309
  method: 'GET',
346
- service: 'calendar',
347
- resource: `calendarEvents/${btoa(id)}/participants`,
310
+ uri,
311
+ });
312
+ });
313
+ });
314
+
315
+ describe('#getNotesByUrl()', () => {
316
+ const uri = 'notesUrl';
317
+
318
+ it('should fetch the meeting notes', async () => {
319
+ webex.request = sinon.stub().returns(
320
+ Promise.resolve({
321
+ body: {
322
+ encryptedParticipants: ['participant1'],
323
+ },
324
+ })
325
+ );
326
+
327
+ const res = await webex.internal.calendar.getNotesByUrl(uri);
328
+
329
+ assert.equal(res.body.encryptedParticipants.length, 1);
330
+ assert.calledWith(webex.request, {
331
+ method: 'GET',
332
+ uri,
348
333
  });
349
334
  });
350
335
  });