@webex/plugin-meetings 3.8.0-next.8 → 3.8.0-web-workers-keepalive.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/config.js.map +1 -1
  5. package/dist/interpretation/index.js +1 -1
  6. package/dist/interpretation/siLanguage.js +1 -1
  7. package/dist/locus-info/controlsUtils.js +1 -1
  8. package/dist/locus-info/controlsUtils.js.map +1 -1
  9. package/dist/meeting/index.js +51 -5
  10. package/dist/meeting/index.js.map +1 -1
  11. package/dist/meeting/util.js +4 -1
  12. package/dist/meeting/util.js.map +1 -1
  13. package/dist/meeting-info/meeting-info-v2.js +359 -60
  14. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  15. package/dist/meetings/index.js +60 -1
  16. package/dist/meetings/index.js.map +1 -1
  17. package/dist/member/index.js +10 -0
  18. package/dist/member/index.js.map +1 -1
  19. package/dist/member/util.js +3 -0
  20. package/dist/member/util.js.map +1 -1
  21. package/dist/metrics/constants.js +9 -0
  22. package/dist/metrics/constants.js.map +1 -1
  23. package/dist/reachability/clusterReachability.js +52 -8
  24. package/dist/reachability/clusterReachability.js.map +1 -1
  25. package/dist/reachability/index.js +70 -45
  26. package/dist/reachability/index.js.map +1 -1
  27. package/dist/reachability/reachability.types.js +14 -0
  28. package/dist/reachability/reachability.types.js.map +1 -1
  29. package/dist/reachability/request.js +19 -3
  30. package/dist/reachability/request.js.map +1 -1
  31. package/dist/types/config.d.ts +1 -0
  32. package/dist/types/meeting/index.d.ts +8 -0
  33. package/dist/types/meeting-info/meeting-info-v2.d.ts +80 -0
  34. package/dist/types/meetings/index.d.ts +29 -0
  35. package/dist/types/member/index.d.ts +1 -0
  36. package/dist/types/metrics/constants.d.ts +9 -0
  37. package/dist/types/reachability/clusterReachability.d.ts +13 -1
  38. package/dist/types/reachability/index.d.ts +2 -1
  39. package/dist/types/reachability/reachability.types.d.ts +5 -0
  40. package/dist/webinar/index.js +1 -1
  41. package/package.json +22 -22
  42. package/src/config.ts +1 -0
  43. package/src/locus-info/controlsUtils.ts +2 -2
  44. package/src/meeting/index.ts +51 -7
  45. package/src/meeting/util.ts +2 -1
  46. package/src/meeting-info/meeting-info-v2.ts +247 -6
  47. package/src/meetings/index.ts +72 -1
  48. package/src/member/index.ts +11 -0
  49. package/src/member/util.ts +3 -0
  50. package/src/metrics/constants.ts +9 -0
  51. package/src/reachability/clusterReachability.ts +47 -1
  52. package/src/reachability/index.ts +15 -0
  53. package/src/reachability/reachability.types.ts +6 -0
  54. package/src/reachability/request.ts +7 -0
  55. package/test/unit/spec/locus-info/controlsUtils.js +8 -0
  56. package/test/unit/spec/meeting/index.js +62 -4
  57. package/test/unit/spec/meeting/utils.js +55 -0
  58. package/test/unit/spec/meeting-info/meetinginfov2.js +443 -114
  59. package/test/unit/spec/meetings/index.js +78 -1
  60. package/test/unit/spec/member/index.js +7 -0
  61. package/test/unit/spec/member/util.js +24 -0
  62. package/test/unit/spec/reachability/clusterReachability.ts +47 -1
  63. package/test/unit/spec/reachability/index.ts +12 -0
  64. package/test/unit/spec/reachability/request.js +47 -2
@@ -7,10 +7,7 @@ import sinon from 'sinon';
7
7
  import MockWebex from '@webex/test-helper-mock-webex';
8
8
  import Device from '@webex/internal-plugin-device';
9
9
  import Mercury from '@webex/internal-plugin-mercury';
10
- import {
11
- DESTINATION_TYPE,
12
- WBXAPPAPI_SERVICE,
13
- } from '@webex/plugin-meetings/src/constants';
10
+ import {DESTINATION_TYPE, WBXAPPAPI_SERVICE} from '@webex/plugin-meetings/src/constants';
14
11
 
15
12
  import Meetings from '@webex/plugin-meetings/src/meetings';
16
13
  import MeetingInfo, {
@@ -20,6 +17,9 @@ import MeetingInfo, {
20
17
  MeetingInfoV2PolicyError,
21
18
  MeetingInfoV2JoinWebinarError,
22
19
  MeetingInfoV2JoinForbiddenError,
20
+ MeetingInfoV2MeetingIsInProgressError,
21
+ MeetingInfoV2StaticMeetingLinkAlreadyExists,
22
+ MeetingInfoV2StaticLinkDoesNotExistError,
23
23
  } from '@webex/plugin-meetings/src/meeting-info/meeting-info-v2';
24
24
  import MeetingInfoUtil from '@webex/plugin-meetings/src/meeting-info/utilv2';
25
25
  import Metrics from '@webex/plugin-meetings/src/metrics';
@@ -93,6 +93,304 @@ describe('plugin-meetings', () => {
93
93
  meetingInfo = new MeetingInfo(webex);
94
94
  });
95
95
 
96
+ describe('#fetchStaticMeetingLink', () => {
97
+ it('should fetch static meeting link for given conversation url', async () => {
98
+ const conversationUrl = 'conv.fakeconversationurl.com';
99
+ const body = {spaceUrl: conversationUrl};
100
+ const requestResponse = {statusCode: 200, body};
101
+ webex.request.resolves(requestResponse);
102
+ const result = await meetingInfo.fetchStaticMeetingLink(conversationUrl);
103
+
104
+ assert.calledWith(webex.request, {
105
+ method: 'POST',
106
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/query`,
107
+ body,
108
+ });
109
+
110
+ assert(Metrics.sendBehavioralMetric.calledOnce);
111
+ assert.calledWith(
112
+ Metrics.sendBehavioralMetric,
113
+ BEHAVIORAL_METRICS.FETCH_STATIC_MEETING_LINK_SUCCESS
114
+ );
115
+
116
+ assert.deepEqual(result, requestResponse);
117
+ });
118
+
119
+ it('should not fetch static meeting link for given conversation url if no preferred webex site', async () => {
120
+ webex.meetings.preferredWebexSite = undefined;
121
+
122
+ const conversationUrl = 'conv.fakeconversationurl.com';
123
+ try {
124
+ await meetingInfo.fetchStaticMeetingLink(conversationUrl);
125
+
126
+ assert.calledWith(webex.request, {
127
+ method: 'POST',
128
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/query`,
129
+ body,
130
+ });
131
+ } catch (err) {
132
+ assert.deepEqual(err.message, 'No preferred webex site found');
133
+ assert.notCalled(webex.request);
134
+ }
135
+ });
136
+
137
+ it('handles error for MeetingInfoV2StaticLinkDoesNotExistError', async () => {
138
+ const conversationUrl = 'conv.fakeconversationurl.com';
139
+ webex.request = sinon
140
+ .stub()
141
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 403, body: {code: 400000}});
142
+ try {
143
+ await meetingInfo.fetchStaticMeetingLink(conversationUrl);
144
+ } catch (err) {
145
+ assert.equal(err.wbxAppApiCode, 400000);
146
+ assert.instanceOf(err, MeetingInfoV2StaticLinkDoesNotExistError);
147
+ assert.deepEqual(
148
+ err.message,
149
+ 'Meeting link does not exists for conversation, code=400000'
150
+ );
151
+ assert.calledWith(
152
+ Metrics.sendBehavioralMetric,
153
+ BEHAVIORAL_METRICS.MEETING_LINK_DOES_NOT_EXIST_ERROR,
154
+ {reason: 'a message', stack: 'a stack'}
155
+ );
156
+ }
157
+ });
158
+
159
+ it('handles generic error when fetching static link', async () => {
160
+ const conversationUrl = 'conv.fakeconversationurl.com';
161
+ webex.request = sinon
162
+ .stub()
163
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 500, body: {code: 400000}});
164
+ try {
165
+ await meetingInfo.fetchStaticMeetingLink(conversationUrl);
166
+ } catch (err) {
167
+ assert(Metrics.sendBehavioralMetric.calledOnce);
168
+ assert.calledWith(
169
+ Metrics.sendBehavioralMetric,
170
+ BEHAVIORAL_METRICS.FETCH_STATIC_MEETING_LINK_FAILURE,
171
+ {reason: 'a message', stack: 'a stack'}
172
+ );
173
+ }
174
+ });
175
+ });
176
+
177
+ describe('#enableStaticMeetingLink', () => {
178
+ const setup = () => {
179
+ const invitee = [];
180
+
181
+ invitee.push({
182
+ email: conversation.participants.items[0].emailAddress,
183
+ ciUserUuid: conversation.participants.items[0].entryUUID,
184
+ });
185
+
186
+ invitee.push({
187
+ email: conversation.participants.items[1].emailAddress,
188
+ ciUserUuid: conversation.participants.items[1].entryUUID,
189
+ });
190
+
191
+ return {invitee};
192
+ };
193
+
194
+ it('should enable static meeting link', async () => {
195
+ const {invitee} = setup();
196
+ const installedOrgID = '12345';
197
+ const conversationUrl = 'conv.fakeconversationurl.com';
198
+ webex.request.resolves({
199
+ statusCode: 200,
200
+ body: conversation,
201
+ });
202
+ const result = await meetingInfo.enableStaticMeetingLink(conversationUrl);
203
+
204
+ assert.calledWith(webex.request, {
205
+ uri: conversationUrl,
206
+ qs: {includeParticipants: true},
207
+ disableTransform: true,
208
+ });
209
+
210
+ assert.calledWith(webex.request, {
211
+ method: 'POST',
212
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant`,
213
+ body: {
214
+ title: conversation.displayName,
215
+ spaceUrl: conversation.url,
216
+ keyUrl: conversation.encryptionKeyUrl,
217
+ kroUrl: conversation.kmsResourceObjectUrl,
218
+ invitees: invitee,
219
+ installedOrgID: undefined,
220
+ schedule: true,
221
+ },
222
+ });
223
+
224
+ assert(Metrics.sendBehavioralMetric.calledOnce);
225
+ assert.calledWith(
226
+ Metrics.sendBehavioralMetric,
227
+ BEHAVIORAL_METRICS.ENABLE_STATIC_METTING_LINK_SUCCESS
228
+ );
229
+
230
+ assert.deepEqual(result, {
231
+ body: conversation,
232
+ statusCode: 200,
233
+ });
234
+ });
235
+
236
+ it('should not enable static meeting link for given conversation url if no preferred webex site', async () => {
237
+ webex.meetings.preferredWebexSite = undefined;
238
+
239
+ const conversationUrl = 'conv.fakeconversationurl.com';
240
+ try {
241
+ await meetingInfo.enableStaticMeetingLink(conversationUrl);
242
+
243
+ assert.calledWith(webex.request, {
244
+ method: 'POST',
245
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant`,
246
+ body,
247
+ });
248
+ } catch (err) {
249
+ assert.deepEqual(err.message, 'No preferred webex site found');
250
+ assert.notCalled(webex.request);
251
+ }
252
+ });
253
+
254
+ it('handles error for MeetingInfoV2MeetingIsInProgressError', async () => {
255
+ const conversationUrl = 'conv.fakeconversationurl.com';
256
+ webex.request = sinon
257
+ .stub()
258
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 403, body: {code: 33003}});
259
+ try {
260
+ await meetingInfo.enableStaticMeetingLink(conversationUrl);
261
+ } catch (err) {
262
+ assert.equal(err.wbxAppApiCode, 33003);
263
+ assert.instanceOf(err, MeetingInfoV2MeetingIsInProgressError);
264
+ assert.deepEqual(err.message, 'Meeting is in progress, code=33003, enable=true');
265
+ assert.calledWith(
266
+ Metrics.sendBehavioralMetric,
267
+ BEHAVIORAL_METRICS.MEETING_IS_IN_PROGRESS_ERROR,
268
+ {reason: 'a message', stack: 'a stack'}
269
+ );
270
+ }
271
+ });
272
+
273
+ it('handles error for MeetingInfoV2StaticMeetingLinkAlreadyExists', async () => {
274
+ const conversationUrl = 'conv.fakeconversationurl.com';
275
+ webex.request = sinon
276
+ .stub()
277
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 409, body: {code: 409000}});
278
+ try {
279
+ await meetingInfo.enableStaticMeetingLink(conversationUrl);
280
+ } catch (err) {
281
+ assert.equal(err.wbxAppApiCode, 409000);
282
+ assert.instanceOf(err, MeetingInfoV2StaticMeetingLinkAlreadyExists);
283
+ assert.deepEqual(err.message, 'Static meeting link already exists, code=409000');
284
+ assert.calledWith(
285
+ Metrics.sendBehavioralMetric,
286
+ BEHAVIORAL_METRICS.STATIC_MEETING_LINK_ALREADY_EXISTS_ERROR,
287
+ {reason: 'a message', stack: 'a stack'}
288
+ );
289
+ }
290
+ });
291
+
292
+ it('handles generic error when enabling static link', async () => {
293
+ const conversationUrl = 'conv.fakeconversationurl.com';
294
+ webex.request = sinon
295
+ .stub()
296
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 500, body: {code: 400000}});
297
+ try {
298
+ await meetingInfo.enableStaticMeetingLink(conversationUrl);
299
+ } catch (err) {
300
+ assert(Metrics.sendBehavioralMetric.calledOnce);
301
+ assert.calledWith(
302
+ Metrics.sendBehavioralMetric,
303
+ BEHAVIORAL_METRICS.ENABLE_STATIC_METTING_LINK_FAILURE,
304
+ {reason: 'a message', stack: 'a stack'}
305
+ );
306
+ }
307
+ });
308
+ });
309
+
310
+ describe('#disableStaticMeetingLink', () => {
311
+ it('should disable static meeting link for given conversation url', async () => {
312
+ const conversationUrl = 'conv.fakeconversationurl.com';
313
+ const body = {spaceUrl: conversationUrl};
314
+ const requestResponse = {statusCode: 204};
315
+ webex.request.resolves(requestResponse);
316
+ const result = await meetingInfo.disableStaticMeetingLink(conversationUrl);
317
+
318
+ assert.calledWith(webex.request, {
319
+ method: 'POST',
320
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/deletePersistentMeeting`,
321
+ body,
322
+ });
323
+
324
+ assert(Metrics.sendBehavioralMetric.calledOnce);
325
+ assert.calledWith(
326
+ Metrics.sendBehavioralMetric,
327
+ BEHAVIORAL_METRICS.DISABLE_STATIC_MEETING_LINK_SUCCESS
328
+ );
329
+
330
+ assert.deepEqual(result, requestResponse);
331
+ });
332
+
333
+ it('should not disable static meeting link for given conversation url if no preferred webex site', async () => {
334
+ webex.meetings.preferredWebexSite = undefined;
335
+
336
+ const conversationUrl = 'conv.fakeconversationurl.com';
337
+ try {
338
+ await meetingInfo.disableStaticMeetingLink(conversationUrl);
339
+
340
+ assert.calledWith(webex.request, {
341
+ method: 'POST',
342
+ uri: `https://${webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/deletePersistentMeeting`,
343
+ body,
344
+ });
345
+ } catch (err) {
346
+ assert.deepEqual(err.message, 'No preferred webex site found');
347
+ assert.notCalled(webex.request);
348
+ }
349
+ });
350
+
351
+ it('handles error for MeetingInfoV2MeetingIsInProgressError for disable', async () => {
352
+ const conversationUrl = 'conv.fakeconversationurl.com';
353
+ webex.request = sinon.stub().rejects({
354
+ stack: 'a stack',
355
+ message: 'a message',
356
+ statusCode: 403,
357
+ body: {code: 33003},
358
+ });
359
+ try {
360
+ await meetingInfo.disableStaticMeetingLink(conversationUrl);
361
+ } catch (err) {
362
+ assert.equal(err.wbxAppApiCode, 33003);
363
+ assert.instanceOf(err, MeetingInfoV2MeetingIsInProgressError);
364
+ assert.deepEqual(err.message, 'Meeting is in progress, code=33003, enable=false');
365
+ assert.calledWith(
366
+ Metrics.sendBehavioralMetric,
367
+ BEHAVIORAL_METRICS.MEETING_IS_IN_PROGRESS_ERROR,
368
+ {reason: 'a message', stack: 'a stack'}
369
+ );
370
+ }
371
+ });
372
+
373
+ it('handles generic error when disabling static link', async () => {
374
+ const conversationUrl = 'conv.fakeconversationurl.com';
375
+ webex.request = sinon.stub().rejects({
376
+ stack: 'a stack',
377
+ message: 'a message',
378
+ statusCode: 500,
379
+ body: {code: 400000},
380
+ });
381
+ try {
382
+ await meetingInfo.disableStaticMeetingLink(conversationUrl);
383
+ } catch (err) {
384
+ assert(Metrics.sendBehavioralMetric.calledOnce);
385
+ assert.calledWith(
386
+ Metrics.sendBehavioralMetric,
387
+ BEHAVIORAL_METRICS.DISABLE_STATIC_MEETING_LINK_FAILURE,
388
+ {reason: 'a message', stack: 'a stack'}
389
+ );
390
+ }
391
+ });
392
+ });
393
+
96
394
  describe('#fetchMeetingInfo', () => {
97
395
  it('should fetch meeting info for the destination type', async () => {
98
396
  const body = {meetingKey: '1234323'};
@@ -151,14 +449,20 @@ describe('plugin-meetings', () => {
151
449
  const body = {meetingKey: '1234323'};
152
450
  const requestResponse = {statusCode: 200, body};
153
451
 
154
- sinon
155
- .stub(MeetingInfoUtil, 'getDestinationType')
156
- .returns(Promise.resolve({type: DESTINATION_TYPE.SIP_URI, destination: 'example@something.webex.com'}));
452
+ sinon.stub(MeetingInfoUtil, 'getDestinationType').returns(
453
+ Promise.resolve({
454
+ type: DESTINATION_TYPE.SIP_URI,
455
+ destination: 'example@something.webex.com',
456
+ })
457
+ );
157
458
  sinon.stub(MeetingInfoUtil, 'getRequestBody').returns(Promise.resolve(body));
158
459
  sinon.stub(MeetingInfoUtil, 'getDirectMeetingInfoURI').returns('https://example.com');
159
460
  webex.request.resolves(requestResponse);
160
461
 
161
- const result = await meetingInfo.fetchMeetingInfo('example@something.webex.com', DESTINATION_TYPE.SIP_URI);
462
+ const result = await meetingInfo.fetchMeetingInfo(
463
+ 'example@something.webex.com',
464
+ DESTINATION_TYPE.SIP_URI
465
+ );
162
466
 
163
467
  assert.calledWith(MeetingInfoUtil.getDestinationType, {
164
468
  destination: 'example@something.webex.com',
@@ -186,10 +490,15 @@ describe('plugin-meetings', () => {
186
490
 
187
491
  webex.request.resolves(requestResponse);
188
492
 
189
- const result = await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, 'abc', {
190
- id: '999',
191
- code: 'aabbcc11',
192
- });
493
+ const result = await meetingInfo.fetchMeetingInfo(
494
+ '1234323',
495
+ DESTINATION_TYPE.MEETING_ID,
496
+ 'abc',
497
+ {
498
+ id: '999',
499
+ code: 'aabbcc11',
500
+ }
501
+ );
193
502
 
194
503
  assert.calledWith(webex.request, {
195
504
  method: 'POST',
@@ -218,7 +527,13 @@ describe('plugin-meetings', () => {
218
527
 
219
528
  webex.request.resolves(requestResponse);
220
529
 
221
- const result = await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, null, null, installedOrgID);
530
+ const result = await meetingInfo.fetchMeetingInfo(
531
+ '1234323',
532
+ DESTINATION_TYPE.MEETING_ID,
533
+ null,
534
+ null,
535
+ installedOrgID
536
+ );
222
537
 
223
538
  assert.calledWith(webex.request, {
224
539
  method: 'POST',
@@ -245,7 +560,14 @@ describe('plugin-meetings', () => {
245
560
 
246
561
  webex.request.resolves(requestResponse);
247
562
 
248
- const result = await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, null, null, null, locusId);
563
+ const result = await meetingInfo.fetchMeetingInfo(
564
+ '1234323',
565
+ DESTINATION_TYPE.MEETING_ID,
566
+ null,
567
+ null,
568
+ null,
569
+ locusId
570
+ );
249
571
 
250
572
  assert.calledWith(webex.request, {
251
573
  method: 'POST',
@@ -268,11 +590,19 @@ describe('plugin-meetings', () => {
268
590
 
269
591
  it('should fetch meeting info with provided extraParams', async () => {
270
592
  const requestResponse = {statusCode: 200, body: {meetingKey: '1234323'}};
271
- const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'}
593
+ const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
272
594
 
273
595
  webex.request.resolves(requestResponse);
274
596
 
275
- const result = await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, null, null, null, null, extraParams);
597
+ const result = await meetingInfo.fetchMeetingInfo(
598
+ '1234323',
599
+ DESTINATION_TYPE.MEETING_ID,
600
+ null,
601
+ null,
602
+ null,
603
+ null,
604
+ extraParams
605
+ );
276
606
 
277
607
  assert.calledWith(webex.request, {
278
608
  method: 'POST',
@@ -305,7 +635,7 @@ describe('plugin-meetings', () => {
305
635
  it('create adhoc meeting when conversationUrl and installedOrgID passed with enableAdhocMeetings toggle', async () => {
306
636
  sinon.stub(meetingInfo, 'createAdhocSpaceMeeting').returns(Promise.resolve());
307
637
 
308
- const installedOrgID = '12345'
638
+ const installedOrgID = '12345';
309
639
 
310
640
  await meetingInfo.fetchMeetingInfo(
311
641
  'conversationUrl',
@@ -324,7 +654,6 @@ describe('plugin-meetings', () => {
324
654
  meetingInfo.createAdhocSpaceMeeting.restore();
325
655
  });
326
656
 
327
-
328
657
  it('should not call createAdhocSpaceMeeting if enableAdhocMeetings toggle is off', async () => {
329
658
  webex.config.meetings.experimental.enableAdhocMeetings = false;
330
659
  sinon.stub(meetingInfo, 'createAdhocSpaceMeeting').returns(Promise.resolve());
@@ -350,7 +679,9 @@ describe('plugin-meetings', () => {
350
679
  it('should throw an error MeetingInfoV2AdhocMeetingError if not able to start adhoc meeting for a conversation', async () => {
351
680
  webex.config.meetings.experimental.enableAdhocMeetings = true;
352
681
 
353
- webex.request = sinon.stub().rejects({stack: 'a stack', message: 'a message', statusCode: 403, body: {code: 400000}});
682
+ webex.request = sinon
683
+ .stub()
684
+ .rejects({stack: 'a stack', message: 'a message', statusCode: 403, body: {code: 400000}});
354
685
  try {
355
686
  await meetingInfo.createAdhocSpaceMeeting('conversationUrl');
356
687
  } catch (err) {
@@ -416,7 +747,8 @@ describe('plugin-meetings', () => {
416
747
  );
417
748
  assert.fail('fetchMeetingInfo should have thrown, but has not done that');
418
749
  } catch (err) {
419
- const submitInternalEventCalls = webex.internal.newMetrics.submitInternalEvent.getCalls();
750
+ const submitInternalEventCalls =
751
+ webex.internal.newMetrics.submitInternalEvent.getCalls();
420
752
  const submitClientEventCalls = webex.internal.newMetrics.submitClientEvent.getCalls();
421
753
 
422
754
  if (sendCAevents) {
@@ -427,7 +759,7 @@ describe('plugin-meetings', () => {
427
759
  assert.deepEqual(submitClientEventCalls[0].args[0], {
428
760
  name: 'client.meetinginfo.request',
429
761
  options: {
430
- meetingId: 'meeting-id'
762
+ meetingId: 'meeting-id',
431
763
  },
432
764
  });
433
765
 
@@ -480,11 +812,14 @@ describe('plugin-meetings', () => {
480
812
  ],
481
813
  ({meetingId, sendCAevents, shouldSendCAevents, confIdStr}) => {
482
814
  it('should send CA metric if meetingId is provided and send CA events is authorized', async () => {
483
- const requestResponse = {statusCode: 200, body: {meetingKey: '1234323', meetingId: '123', confID: '321'}};
815
+ const requestResponse = {
816
+ statusCode: 200,
817
+ body: {meetingKey: '1234323', meetingId: '123', confID: '321'},
818
+ };
484
819
  if (confIdStr) {
485
820
  requestResponse.body.confIdStr = confIdStr;
486
821
  }
487
- const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'}
822
+ const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
488
823
 
489
824
  webex.request.resolves(requestResponse);
490
825
 
@@ -517,10 +852,11 @@ describe('plugin-meetings', () => {
517
852
  BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_SUCCESS
518
853
  );
519
854
 
520
- const submitInternalEventCalls = webex.internal.newMetrics.submitInternalEvent.getCalls();
855
+ const submitInternalEventCalls =
856
+ webex.internal.newMetrics.submitInternalEvent.getCalls();
521
857
  const submitClientEventCalls = webex.internal.newMetrics.submitClientEvent.getCalls();
522
858
 
523
- if(shouldSendCAevents) {
859
+ if (shouldSendCAevents) {
524
860
  assert.deepEqual(submitInternalEventCalls[0].args[0], {
525
861
  name: 'internal.client.meetinginfo.request',
526
862
  });
@@ -528,7 +864,7 @@ describe('plugin-meetings', () => {
528
864
  name: 'client.meetinginfo.request',
529
865
  options: {
530
866
  meetingId,
531
- }
867
+ },
532
868
  });
533
869
 
534
870
  assert.deepEqual(submitInternalEventCalls[1].args[0], {
@@ -544,20 +880,25 @@ describe('plugin-meetings', () => {
544
880
  options: {
545
881
  meetingId,
546
882
  globalMeetingId: requestResponse.body?.meetingId,
547
- webexConferenceIdStr: confIdStr ? requestResponse.body?.confIdStr : requestResponse.body?.confID,
548
- }
883
+ webexConferenceIdStr: confIdStr
884
+ ? requestResponse.body?.confIdStr
885
+ : requestResponse.body?.confID,
886
+ },
549
887
  });
550
888
  } else {
551
889
  assert.notCalled(webex.internal.newMetrics.submitClientEvent);
552
890
  assert.notCalled(webex.internal.newMetrics.submitInternalEvent);
553
891
  }
554
- })
892
+ });
555
893
  }
556
- )
894
+ );
557
895
 
558
896
  it('should send CA metric if meetingId is provided and send CA events is authorized', async () => {
559
- const requestResponse = {statusCode: 200, body: {meetingKey: '1234323', confID: '123', meetingId: '321'}};
560
- const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'}
897
+ const requestResponse = {
898
+ statusCode: 200,
899
+ body: {meetingKey: '1234323', confID: '123', meetingId: '321'},
900
+ };
901
+ const extraParams = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
561
902
 
562
903
  webex.request.resolves(requestResponse);
563
904
 
@@ -600,7 +941,7 @@ describe('plugin-meetings', () => {
600
941
  name: 'client.meetinginfo.request',
601
942
  options: {
602
943
  meetingId: 'meetingId',
603
- }
944
+ },
604
945
  });
605
946
 
606
947
  assert.deepEqual(submitInternalEventCalls[1].args[0], {
@@ -617,47 +958,41 @@ describe('plugin-meetings', () => {
617
958
  meetingId: 'meetingId',
618
959
  globalMeetingId: requestResponse.body?.meetingId,
619
960
  webexConferenceIdStr: requestResponse.body?.confID,
620
- }
961
+ },
621
962
  });
622
963
  });
623
964
 
624
- forEach(
625
- [
626
- {sendCAevents: true},
627
- {sendCAevents: false},
628
- ],
629
- ({sendCAevents}) => {
630
- it(`should not send CA metric if meetingId is not provided disregarding if sendCAevents is ${sendCAevents}`, async () => {
631
- const message = 'a message';
632
- const meetingInfoData = 'meeting info';
965
+ forEach([{sendCAevents: true}, {sendCAevents: false}], ({sendCAevents}) => {
966
+ it(`should not send CA metric if meetingId is not provided disregarding if sendCAevents is ${sendCAevents}`, async () => {
967
+ const message = 'a message';
968
+ const meetingInfoData = 'meeting info';
633
969
 
634
- webex.request = sinon.stub().rejects({
635
- statusCode: 403,
636
- body: {message, code: 403102, data: {meetingInfo: meetingInfoData}},
637
- url: 'http://api-url.com',
638
- });
639
- try {
640
- await meetingInfo.fetchMeetingInfo(
641
- '1234323',
642
- DESTINATION_TYPE.MEETING_ID,
643
- 'abc',
644
- {
645
- id: '999',
646
- code: 'aabbcc11',
647
- },
648
- null,
649
- null,
650
- undefined,
651
- {meetingId: undefined, sendCAevents}
652
- );
653
- assert.fail('fetchMeetingInfo should have thrown, but has not done that');
654
- } catch (err) {
655
- assert.notCalled(webex.internal.newMetrics.submitClientEvent);
656
- assert.notCalled(webex.internal.newMetrics.submitInternalEvent);
657
- }
970
+ webex.request = sinon.stub().rejects({
971
+ statusCode: 403,
972
+ body: {message, code: 403102, data: {meetingInfo: meetingInfoData}},
973
+ url: 'http://api-url.com',
658
974
  });
659
- }
660
- );
975
+ try {
976
+ await meetingInfo.fetchMeetingInfo(
977
+ '1234323',
978
+ DESTINATION_TYPE.MEETING_ID,
979
+ 'abc',
980
+ {
981
+ id: '999',
982
+ code: 'aabbcc11',
983
+ },
984
+ null,
985
+ null,
986
+ undefined,
987
+ {meetingId: undefined, sendCAevents}
988
+ );
989
+ assert.fail('fetchMeetingInfo should have thrown, but has not done that');
990
+ } catch (err) {
991
+ assert.notCalled(webex.internal.newMetrics.submitClientEvent);
992
+ assert.notCalled(webex.internal.newMetrics.submitInternalEvent);
993
+ }
994
+ });
995
+ });
661
996
 
662
997
  it('should throw MeetingInfoV2PasswordError for 403 response', async () => {
663
998
  const FAKE_MEETING_INFO = {blablabla: 'some_fake_meeting_info'};
@@ -786,23 +1121,24 @@ describe('plugin-meetings', () => {
786
1121
  ciUserUuid: conversation.participants.items[1].entryUUID,
787
1122
  });
788
1123
 
789
- return {invitee}
790
- }
1124
+ return {invitee};
1125
+ };
791
1126
 
792
1127
  it('Make a request to /spaceInstant when conversationUrl', async () => {
793
1128
  const {invitee} = setup();
794
1129
 
795
1130
  webex.request.resolves({
796
1131
  statusCode: 200,
797
- body: conversation
1132
+ body: conversation,
798
1133
  });
799
1134
 
800
- const result = await meetingInfo.createAdhocSpaceMeeting(conversationUrl,installedOrgID);
1135
+ const result = await meetingInfo.createAdhocSpaceMeeting(conversationUrl, installedOrgID);
801
1136
 
802
- assert.calledWith(
803
- webex.request,
804
- {uri:conversationUrl, qs: {includeParticipants: true}, disableTransform: true}
805
- )
1137
+ assert.calledWith(webex.request, {
1138
+ uri: conversationUrl,
1139
+ qs: {includeParticipants: true},
1140
+ disableTransform: true,
1141
+ });
806
1142
 
807
1143
  assert.calledWith(webex.request, {
808
1144
  method: 'POST',
@@ -813,14 +1149,15 @@ describe('plugin-meetings', () => {
813
1149
  keyUrl: conversation.encryptionKeyUrl,
814
1150
  kroUrl: conversation.kmsResourceObjectUrl,
815
1151
  invitees: invitee,
816
- installedOrgID: installedOrgID
1152
+ installedOrgID: installedOrgID,
1153
+ schedule: false,
817
1154
  },
818
1155
  });
819
1156
  assert.calledOnce(Metrics.sendBehavioralMetric);
820
1157
  assert.calledWith(Metrics.sendBehavioralMetric, BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
821
1158
  assert.deepEqual(result, {
822
1159
  body: conversation,
823
- statusCode: 200
1160
+ statusCode: 200,
824
1161
  });
825
1162
  });
826
1163
  it('Make a request to /spaceInstant when conversationUrl with installed org ID', async () => {
@@ -845,13 +1182,13 @@ describe('plugin-meetings', () => {
845
1182
  kroUrl: conversation.kmsResourceObjectUrl,
846
1183
  invitees: invitee,
847
1184
  installedOrgID,
1185
+ schedule: false,
848
1186
  },
849
1187
  });
850
1188
  assert(Metrics.sendBehavioralMetric.calledOnce);
851
1189
  assert.calledWith(Metrics.sendBehavioralMetric, BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
852
1190
  });
853
1191
 
854
-
855
1192
  forEach(
856
1193
  [
857
1194
  {errorCode: 403049},
@@ -885,7 +1222,6 @@ describe('plugin-meetings', () => {
885
1222
  BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR,
886
1223
  {code: errorCode}
887
1224
  );
888
-
889
1225
  }
890
1226
  });
891
1227
  }
@@ -926,47 +1262,40 @@ describe('plugin-meetings', () => {
926
1262
  BEHAVIORAL_METRICS.JOIN_WEBINAR_ERROR,
927
1263
  {code: errorCode}
928
1264
  );
929
-
930
1265
  }
931
1266
  });
932
1267
  }
933
1268
  );
934
1269
 
935
- forEach(
936
- [
937
- {errorCode: 403003},
938
- ],
939
- ({errorCode}) => {
940
- it(`should throw a MeetingInfoV2JoinForbiddenError for error code ${errorCode}`, async () => {
941
- const message = 'a message';
942
- const meetingInfoData = 'meeting info';
1270
+ forEach([{errorCode: 403003}], ({errorCode}) => {
1271
+ it(`should throw a MeetingInfoV2JoinForbiddenError for error code ${errorCode}`, async () => {
1272
+ const message = 'a message';
1273
+ const meetingInfoData = 'meeting info';
943
1274
 
944
- webex.request = sinon.stub().rejects({
945
- statusCode: 403,
946
- body: {message, code: errorCode, data: {meetingInfo: meetingInfoData}},
1275
+ webex.request = sinon.stub().rejects({
1276
+ statusCode: 403,
1277
+ body: {message, code: errorCode, data: {meetingInfo: meetingInfoData}},
1278
+ });
1279
+ try {
1280
+ await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, 'abc', {
1281
+ id: '999',
1282
+ code: 'aabbcc11',
947
1283
  });
948
- try {
949
- await meetingInfo.fetchMeetingInfo('1234323', DESTINATION_TYPE.MEETING_ID, 'abc', {
950
- id: '999',
951
- code: 'aabbcc11',
952
- });
953
- } catch (err) {
954
- assert.instanceOf(err, MeetingInfoV2JoinForbiddenError);
955
- assert.deepEqual(err.message, `${message}, code=${errorCode}`);
956
- assert.equal(err.wbxAppApiCode, errorCode);
957
- assert.deepEqual(err.meetingInfo, meetingInfoData);
958
-
959
- assert(Metrics.sendBehavioralMetric.calledOnce);
960
- assert.calledWith(
961
- Metrics.sendBehavioralMetric,
962
- BEHAVIORAL_METRICS.JOIN_FORBIDDEN_ERROR,
963
- {code: errorCode}
964
- );
1284
+ } catch (err) {
1285
+ assert.instanceOf(err, MeetingInfoV2JoinForbiddenError);
1286
+ assert.deepEqual(err.message, `${message}, code=${errorCode}`);
1287
+ assert.equal(err.wbxAppApiCode, errorCode);
1288
+ assert.deepEqual(err.meetingInfo, meetingInfoData);
965
1289
 
966
- }
967
- });
968
- }
969
- );
1290
+ assert(Metrics.sendBehavioralMetric.calledOnce);
1291
+ assert.calledWith(
1292
+ Metrics.sendBehavioralMetric,
1293
+ BEHAVIORAL_METRICS.JOIN_FORBIDDEN_ERROR,
1294
+ {code: errorCode}
1295
+ );
1296
+ }
1297
+ });
1298
+ });
970
1299
  });
971
1300
  });
972
1301
  });