@webex/plugin-meetings 3.9.0-next.1 → 3.9.0-next.3

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.
@@ -1181,11 +1181,17 @@ export default class Members extends StatelessWebexPlugin {
1181
1181
  * @param {string} memberId - id of the participant who is receiving request
1182
1182
  * @param {string} requestingParticipantId - id of the participant who is sending request (optional)
1183
1183
  * @param {string} [alias] - alias name
1184
+ * @param {string} [suffix] - name suffix (optional)
1184
1185
  * @returns {Promise}
1185
1186
  * @public
1186
1187
  * @memberof Members
1187
1188
  */
1188
- public editDisplayName(memberId: string, requestingParticipantId: string, alias: string) {
1189
+ public editDisplayName(
1190
+ memberId: string,
1191
+ requestingParticipantId: string,
1192
+ alias: string,
1193
+ suffix?: string
1194
+ ) {
1189
1195
  if (!this.locusUrl) {
1190
1196
  return Promise.reject(
1191
1197
  new ParameterError(
@@ -1205,7 +1211,8 @@ export default class Members extends StatelessWebexPlugin {
1205
1211
  memberId,
1206
1212
  requestingParticipantId,
1207
1213
  alias,
1208
- locusUrl
1214
+ locusUrl,
1215
+ suffix
1209
1216
  );
1210
1217
 
1211
1218
  return this.membersRequest.editDisplayNameMember(options);
@@ -190,13 +190,21 @@ const MembersUtil = {
190
190
  * @param {String} requestingParticipantId id of the participant who is sending request (optional)
191
191
  * @param {String} alias alias name
192
192
  * @param {String} locusUrl url
193
+ * @param {String} suffix optional suffix
193
194
  * @returns {Object} consists of {memberID: string, requestingParticipantId: string, alias: string, locusUrl: string}
194
195
  */
195
- generateEditDisplayNameMemberOptions: (memberId, requestingParticipantId, alias, locusUrl) => ({
196
+ generateEditDisplayNameMemberOptions: (
196
197
  memberId,
197
198
  requestingParticipantId,
198
199
  alias,
199
200
  locusUrl,
201
+ suffix
202
+ ) => ({
203
+ memberId,
204
+ requestingParticipantId,
205
+ alias,
206
+ locusUrl,
207
+ suffix,
200
208
  }),
201
209
 
202
210
  getMuteMemberRequestParams: (options) => {
@@ -301,10 +309,18 @@ const MembersUtil = {
301
309
  * @returns {Object} request parameters (method, uri, body) needed to make a editDisplayName request
302
310
  */
303
311
  editDisplayNameMemberRequestParams: (options) => {
304
- const body = {
312
+ const body: {
313
+ aliasValue: string;
314
+ requestingParticipantId: string;
315
+ suffixValue?: string;
316
+ } = {
305
317
  aliasValue: options.alias,
306
318
  requestingParticipantId: options.requestingParticipantId,
307
319
  };
320
+
321
+ if (options.suffix !== undefined) {
322
+ body.suffixValue = options.suffix;
323
+ }
308
324
  const uri = `${options.locusUrl}/${PARTICIPANT}/${options.memberId}/${ALIAS}`;
309
325
 
310
326
  return {
@@ -12262,6 +12262,7 @@ describe('plugin-meetings', () => {
12262
12262
  meeting.deviceUrl = 'deviceUrl.com';
12263
12263
  webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp = sinon.stub();
12264
12264
  webex.internal.newMetrics.callDiagnosticLatencies.getShareDuration = sinon.stub().returns(1000);
12265
+ webex.internal.newMetrics.submitClientEvent = sinon.stub();
12265
12266
  });
12266
12267
  it('should stop the whiteboard share', async () => {
12267
12268
  const whiteboardShare = meeting.stopWhiteboardShare();
@@ -12363,6 +12364,9 @@ describe('plugin-meetings', () => {
12363
12364
  meeting.selfId = '9528d952-e4de-46cf-8157-fd4823b98377';
12364
12365
  meeting.deviceUrl = 'my-web-url';
12365
12366
  meeting.locusInfo.info = {isWebinar: false};
12367
+ webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp = sinon.stub();
12368
+ webex.internal.newMetrics.callDiagnosticLatencies.getShareDuration = sinon.stub().returns(1500);
12369
+ webex.internal.newMetrics.submitClientEvent = sinon.stub();
12366
12370
  });
12367
12371
 
12368
12372
  const USER_IDS = {
@@ -13508,7 +13512,54 @@ describe('plugin-meetings', () => {
13508
13512
  payloadTestHelper([data1, data2, data3]);
13509
13513
  });
13510
13514
  });
13511
- });
13515
+
13516
+ it('should send share stopped metric when whiteboard sharing stops', () => {
13517
+ // Start whiteboard sharing (this won't trigger metrics)
13518
+ const data1 = generateData(
13519
+ blankPayload,
13520
+ true, // isGranting: true
13521
+ false, // isContent: false (whiteboard)
13522
+ USER_IDS.ME,
13523
+ RESOURCE_URLS.WHITEBOARD_A
13524
+ );
13525
+
13526
+ // Stop whiteboard sharing (this should trigger metrics)
13527
+ const data2 = generateData(
13528
+ data1.payload,
13529
+ false, // isGranting: false (stopping share)
13530
+ false, // isContent: false (whiteboard)
13531
+ USER_IDS.ME
13532
+ );
13533
+
13534
+ // Trigger the events
13535
+ meeting.locusInfo.emit(
13536
+ {function: 'test', file: 'test'},
13537
+ EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES,
13538
+ data1.payload
13539
+ );
13540
+
13541
+ meeting.locusInfo.emit(
13542
+ {function: 'test', file: 'test'},
13543
+ EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES,
13544
+ data2.payload
13545
+ );
13546
+
13547
+ // Verify metrics were called when whiteboard sharing stopped
13548
+ assert.calledWith(webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp, {
13549
+ key: 'internal.client.share.stopped',
13550
+ });
13551
+
13552
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
13553
+ name: 'client.share.stopped',
13554
+ payload: {
13555
+ mediaType: 'whiteboard',
13556
+ shareDuration: 1500, // mocked return value
13557
+ },
13558
+ options: {
13559
+ meetingId: meeting.id,
13560
+ },
13561
+ });
13562
+ });
13512
13563
 
13513
13564
  describe('handleShareVideoStreamMuteStateChange', () => {
13514
13565
  it('should emit MEETING_SHARE_VIDEO_MUTE_STATE_CHANGE event with correct fields', () => {
@@ -13535,6 +13586,7 @@ describe('plugin-meetings', () => {
13535
13586
  });
13536
13587
  });
13537
13588
  });
13589
+ });
13538
13590
 
13539
13591
  describe('#startKeepAlive', () => {
13540
13592
  let clock;
@@ -973,7 +973,8 @@ describe('plugin-meetings', () => {
973
973
  expectedMemberId,
974
974
  expectedRequestingParticipantId,
975
975
  expectedAlias,
976
- expectedLocusUrl
976
+ expectedLocusUrl,
977
+ expectedSuffix
977
978
  ) => {
978
979
  await assert.isFulfilled(resultPromise);
979
980
  assert.calledOnceWithExactly(
@@ -981,13 +982,15 @@ describe('plugin-meetings', () => {
981
982
  expectedMemberId,
982
983
  expectedRequestingParticipantId,
983
984
  expectedAlias,
984
- expectedLocusUrl
985
+ expectedLocusUrl,
986
+ expectedSuffix
985
987
  );
986
988
  assert.calledOnceWithExactly(spies.editDisplayNameMember, {
987
989
  memberId: expectedMemberId,
988
990
  requestingParticipantId: expectedRequestingParticipantId,
989
991
  alias: expectedAlias,
990
992
  locusUrl: expectedLocusUrl,
993
+ suffix: expectedSuffix,
991
994
  });
992
995
  assert.strictEqual(resultPromise, spies.editDisplayNameMember.getCall(0).returnValue);
993
996
  };
@@ -1017,6 +1020,31 @@ describe('plugin-meetings', () => {
1017
1020
  });
1018
1021
 
1019
1022
  it('should make the correct request when called with respective parameters', async () => {
1023
+ const requestingParticipantId = uuid.v4();
1024
+ const memberId = uuid.v4();
1025
+ const alias = 'aliasName';
1026
+ const suffix = 'suffixName';
1027
+ const {members, spies} = setup(url1);
1028
+
1029
+ const resultPromise = members.editDisplayName(
1030
+ memberId,
1031
+ requestingParticipantId,
1032
+ alias,
1033
+ suffix
1034
+ );
1035
+
1036
+ await checkValid(
1037
+ resultPromise,
1038
+ spies,
1039
+ memberId,
1040
+ requestingParticipantId,
1041
+ alias,
1042
+ url1,
1043
+ suffix
1044
+ );
1045
+ });
1046
+
1047
+ it('should make the correct request when called with respective parameters - no suffix', async () => {
1020
1048
  const requestingParticipantId = uuid.v4();
1021
1049
  const memberId = uuid.v4();
1022
1050
  const alias = 'aliasName';
@@ -429,6 +429,61 @@ describe('plugin-meetings', () => {
429
429
  },
430
430
  });
431
431
  });
432
+
433
+ it('sends a POST request to the locus endpoint with suffix empty string', async () => {
434
+ const locusUrl = url1;
435
+ const memberId = 'test1';
436
+ const requestingParticipantId = 'test2';
437
+ const aliasValue = 'alias';
438
+
439
+ const options = {
440
+ memberId,
441
+ requestingParticipantId,
442
+ alias: aliasValue,
443
+ locusUrl,
444
+ suffix: '',
445
+ };
446
+
447
+ await membersRequest.editDisplayNameMember(options);
448
+
449
+ checkRequest({
450
+ method: 'POST',
451
+ uri: `${locusUrl}/participant/${memberId}/alias`,
452
+ body: {
453
+ aliasValue,
454
+ requestingParticipantId,
455
+ suffixValue: '',
456
+ },
457
+ });
458
+ });
459
+
460
+ it('sends a POST request to the locus endpoint with suffixValue', async () => {
461
+ const locusUrl = url1;
462
+ const memberId = 'test1';
463
+ const requestingParticipantId = 'test2';
464
+ const aliasValue = 'alias';
465
+ const suffixValue = 'suffix';
466
+
467
+ const options = {
468
+ memberId,
469
+ requestingParticipantId,
470
+ alias: aliasValue,
471
+ locusUrl,
472
+ suffix: suffixValue,
473
+ };
474
+
475
+ await membersRequest.editDisplayNameMember(options);
476
+
477
+ checkRequest({
478
+ method: 'POST',
479
+ uri: `${locusUrl}/participant/${memberId}/alias`,
480
+ body: {
481
+ aliasValue,
482
+ requestingParticipantId,
483
+ suffixValue,
484
+ },
485
+ });
486
+ });
432
487
  });
433
488
 
434
489
  describe('#moveToLobby', () => {
@@ -129,7 +129,32 @@ describe('plugin-meetings', () => {
129
129
  });
130
130
  });
131
131
  describe('#generateEditDisplayNameMemberOptions', () => {
132
- it('returns the correct options', () => {
132
+ it('returns the correct options with suffix when suffix is there', () => {
133
+ const locusUrl = 'urlTest1';
134
+ const memberId = 'test1';
135
+ const requestingParticipantId = 'test2';
136
+ const alias = 'alias';
137
+ const suffix = 'suffix';
138
+
139
+ assert.deepEqual(
140
+ MembersUtil.generateEditDisplayNameMemberOptions(
141
+ memberId,
142
+ requestingParticipantId,
143
+ alias,
144
+ locusUrl,
145
+ suffix
146
+ ),
147
+ {
148
+ memberId,
149
+ requestingParticipantId,
150
+ alias,
151
+ locusUrl,
152
+ suffix,
153
+ }
154
+ );
155
+ });
156
+
157
+ it('returns the correct options without suffix when suffix is not there', () => {
133
158
  const locusUrl = 'urlTest1';
134
159
  const memberId = 'test1';
135
160
  const requestingParticipantId = 'test2';
@@ -147,6 +172,7 @@ describe('plugin-meetings', () => {
147
172
  requestingParticipantId,
148
173
  alias,
149
174
  locusUrl,
175
+ suffix: undefined,
150
176
  }
151
177
  );
152
178
  });
@@ -306,7 +332,7 @@ describe('plugin-meetings', () => {
306
332
  const options = {
307
333
  invitee: {
308
334
  phoneNumber: '1234567890',
309
- isInternalNumber: false
335
+ isInternalNumber: false,
310
336
  },
311
337
  alertIfActive: false,
312
338
  };
@@ -315,7 +341,7 @@ describe('plugin-meetings', () => {
315
341
  invitees: [
316
342
  {
317
343
  address: '1234567890',
318
- isInternalNumber: false
344
+ isInternalNumber: false,
319
345
  },
320
346
  ],
321
347
  alertIfActive: false,
@@ -417,16 +443,10 @@ describe('plugin-meetings', () => {
417
443
  const memberId = 'test';
418
444
  const invitee = {memberId, isInternalNumber: false};
419
445
 
420
- assert.deepEqual(
421
- MembersUtil.cancelInviteByMemberIdOptions(
422
- invitee,
423
- locusUrl
424
- ),
425
- {
426
- invitee,
427
- locusUrl,
428
- }
429
- );
446
+ assert.deepEqual(MembersUtil.cancelInviteByMemberIdOptions(invitee, locusUrl), {
447
+ invitee,
448
+ locusUrl,
449
+ });
430
450
  });
431
451
  });
432
452
 
@@ -436,7 +456,7 @@ describe('plugin-meetings', () => {
436
456
  const memberId = 'test';
437
457
  const options = {
438
458
  locusUrl,
439
- invitee: {memberId, isInternalNumber: false}
459
+ invitee: {memberId, isInternalNumber: false},
440
460
  };
441
461
  const body = {
442
462
  actionType: 'REMOVE',
@@ -452,5 +472,87 @@ describe('plugin-meetings', () => {
452
472
  });
453
473
  });
454
474
  });
475
+
476
+ describe('#editDisplayNameMemberRequestParams', () => {
477
+ it('returns the correct params when suffix is available', () => {
478
+ const locusUrl = 'TestLocusUrl1';
479
+ const memberId = 'test1';
480
+ const alias = 'alias1';
481
+ const requestingParticipantId = '23131';
482
+ const suffix = 'suffix1';
483
+ const options = {
484
+ locusUrl: locusUrl,
485
+ memberId,
486
+ alias,
487
+ requestingParticipantId,
488
+ suffix,
489
+ };
490
+
491
+ const uri = `${locusUrl}/participant/${memberId}/alias`;
492
+
493
+ assert.deepEqual(MembersUtil.editDisplayNameMemberRequestParams(options), {
494
+ method: HTTP_VERBS.POST,
495
+ uri,
496
+ body: {
497
+ aliasValue: alias,
498
+ requestingParticipantId,
499
+ suffixValue: suffix,
500
+ },
501
+ });
502
+ });
503
+
504
+ it('returns the correct params when suffix is not available', () => {
505
+ const locusUrl = 'TestLocusUrl2';
506
+ const memberId = 'test2';
507
+ const alias = 'alias2';
508
+ const requestingParticipantId = '12345';
509
+
510
+ const options = {
511
+ locusUrl: locusUrl,
512
+ memberId,
513
+ alias,
514
+ requestingParticipantId,
515
+ };
516
+
517
+ const uri = `${locusUrl}/participant/${memberId}/alias`;
518
+
519
+ assert.deepEqual(MembersUtil.editDisplayNameMemberRequestParams(options), {
520
+ method: HTTP_VERBS.POST,
521
+ uri,
522
+ body: {
523
+ aliasValue: alias,
524
+ requestingParticipantId,
525
+ },
526
+ });
527
+ });
528
+
529
+ it('returns the correct params when suffix is empty string', () => {
530
+ const locusUrl = 'TestLocusUrl3';
531
+ const memberId = 'test3';
532
+ const alias = 'alias3';
533
+ const requestingParticipantId = '322424';
534
+ const suffix = '';
535
+
536
+ const options = {
537
+ locusUrl: locusUrl,
538
+ memberId,
539
+ alias,
540
+ suffix,
541
+ requestingParticipantId,
542
+ };
543
+
544
+ const uri = `${locusUrl}/participant/${memberId}/alias`;
545
+
546
+ assert.deepEqual(MembersUtil.editDisplayNameMemberRequestParams(options), {
547
+ method: HTTP_VERBS.POST,
548
+ uri,
549
+ body: {
550
+ aliasValue: alias,
551
+ requestingParticipantId,
552
+ suffixValue: suffix,
553
+ },
554
+ });
555
+ });
556
+ });
455
557
  });
456
558
  });