@webex/plugin-meetings 3.12.0-next.39 → 3.12.0-next.40

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.
@@ -723,7 +723,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
723
723
  }, _callee1);
724
724
  }))();
725
725
  },
726
- version: "3.12.0-next.39"
726
+ version: "3.12.0-next.40"
727
727
  });
728
728
  var _default = exports.default = Webinar;
729
729
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -94,5 +94,5 @@
94
94
  "//": [
95
95
  "TODO: upgrade jwt-decode when moving to node 18"
96
96
  ],
97
- "version": "3.12.0-next.39"
97
+ "version": "3.12.0-next.40"
98
98
  }
@@ -11,6 +11,7 @@ const AIEnableRequest = WebexPlugin.extend({
11
11
  namespace: MEETINGS,
12
12
 
13
13
  props: {
14
+ locusUrl: 'string',
14
15
  approvalUrl: 'string',
15
16
  selfParticipantId: 'string',
16
17
  hasSubscribedToEvents: 'boolean',
@@ -39,6 +40,15 @@ const AIEnableRequest = WebexPlugin.extend({
39
40
  }
40
41
  },
41
42
 
43
+ /**
44
+ * Update the locus url
45
+ * @param {string} locusUrl
46
+ * @returns {void}
47
+ */
48
+ locusUrlUpdate(locusUrl: string) {
49
+ this.locusUrl = locusUrl;
50
+ },
51
+
42
52
  /**
43
53
  * Listen to locus approval request events and trigger a new event with necessary details when an AI enablement approval request is received
44
54
  * @returns {void}
@@ -46,6 +56,12 @@ const AIEnableRequest = WebexPlugin.extend({
46
56
  listenToApprovalRequests() {
47
57
  this.listenTo(this.webex.internal.mercury, `event:${LOCUSEVENT.APPROVAL_REQUEST}`, (event) => {
48
58
  if (event?.data?.approval?.resourceType === AI_ENABLE_REQUEST.RESOURCE_TYPE) {
59
+ if (event?.data?.locusUrl !== this.locusUrl) {
60
+ this.webex.logger.info('AIEnableRequest: Ignoring approval request for different locus');
61
+
62
+ return;
63
+ }
64
+
49
65
  const {receivers, initiator, actionType, url} = event.data.approval;
50
66
  const approverId = receivers?.[0]?.participantId;
51
67
  const isApprover = !!approverId && approverId === this.selfParticipantId;
@@ -937,7 +937,7 @@ export default class Meeting extends StatelessWebexPlugin {
937
937
  this.simultaneousInterpretation = new SimultaneousInterpretation({}, {parent: this.webex});
938
938
 
939
939
  // @ts-ignore
940
- this.aiEnableRequest = new AIEnableRequest({}, {parent: this.webex});
940
+ this.aiEnableRequest = new AIEnableRequest({locusUrl: this.locusUrl}, {parent: this.webex});
941
941
 
942
942
  /**
943
943
  * @instance
@@ -3461,6 +3461,7 @@ export default class Meeting extends StatelessWebexPlugin {
3461
3461
  this.breakouts.locusUrlUpdate(url);
3462
3462
  this.simultaneousInterpretation.locusUrlUpdate(url);
3463
3463
  this.annotation.locusUrlUpdate(url);
3464
+ this.aiEnableRequest.locusUrlUpdate(url);
3464
3465
  this.locusUrl = url;
3465
3466
  this.locusId = this.locusUrl?.split('/').pop();
3466
3467
  this.recordingController.setLocusUrl(this.locusUrl);
@@ -55,6 +55,27 @@ describe('plugin-meetings', () => {
55
55
  });
56
56
  });
57
57
 
58
+ describe('#locusUrlUpdate', () => {
59
+ it('should update the locusUrl property', () => {
60
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
61
+
62
+ aiEnableRequest.locusUrlUpdate(testLocusUrl);
63
+
64
+ assert.equal(aiEnableRequest.locusUrl, testLocusUrl);
65
+ });
66
+
67
+ it('should handle updating locusUrl multiple times', () => {
68
+ const firstUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-1';
69
+ const secondUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-2';
70
+
71
+ aiEnableRequest.locusUrlUpdate(firstUrl);
72
+ assert.equal(aiEnableRequest.locusUrl, firstUrl);
73
+
74
+ aiEnableRequest.locusUrlUpdate(secondUrl);
75
+ assert.equal(aiEnableRequest.locusUrl, secondUrl);
76
+ });
77
+ });
78
+
58
79
  describe('#selfParticipantIdUpdate', () => {
59
80
  it('should update the selfParticipantId property', () => {
60
81
  const testSelfParticipantId = 'participant-123';
@@ -254,6 +275,71 @@ describe('plugin-meetings', () => {
254
275
  sinon.assert.notCalled(triggerSpy);
255
276
  });
256
277
 
278
+ it('should not trigger event when locusUrl does not match', () => {
279
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
280
+ const differentLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/different-id';
281
+
282
+ aiEnableRequest.locusUrl = testLocusUrl;
283
+
284
+ // Reset the spy after setting locusUrl to avoid counting property change events
285
+ triggerSpy.resetHistory();
286
+
287
+ aiEnableRequest.listenToApprovalRequests();
288
+
289
+ const event = {
290
+ data: {
291
+ locusUrl: differentLocusUrl,
292
+ approval: {
293
+ resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
294
+ receivers: [{participantId: testSelfParticipantId}],
295
+ initiator: {participantId: testInitiatorId},
296
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
297
+ url: testUrl,
298
+ },
299
+ },
300
+ };
301
+
302
+ webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
303
+
304
+ sinon.assert.notCalled(triggerSpy);
305
+ });
306
+
307
+ it('should trigger event when locusUrl matches', () => {
308
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
309
+
310
+ aiEnableRequest.locusUrl = testLocusUrl;
311
+
312
+ // Reset the spy after setting locusUrl to avoid counting property change events
313
+ triggerSpy.resetHistory();
314
+
315
+ aiEnableRequest.listenToApprovalRequests();
316
+
317
+ const event = {
318
+ data: {
319
+ locusUrl: testLocusUrl,
320
+ approval: {
321
+ resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
322
+ receivers: [{participantId: testSelfParticipantId}],
323
+ initiator: {participantId: testInitiatorId},
324
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
325
+ url: testUrl,
326
+ },
327
+ },
328
+ };
329
+
330
+ webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
331
+
332
+ sinon.assert.calledOnce(triggerSpy);
333
+ sinon.assert.calledWith(triggerSpy, AI_ENABLE_REQUEST.EVENTS.APPROVAL_REQUEST_ARRIVED, {
334
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
335
+ isApprover: true,
336
+ isInitiator: false,
337
+ initiatorId: testInitiatorId,
338
+ approverId: testSelfParticipantId,
339
+ url: testUrl,
340
+ });
341
+ });
342
+
257
343
  it('should handle events with different action types', () => {
258
344
  aiEnableRequest.listenToApprovalRequests();
259
345
 
@@ -11152,6 +11152,7 @@ describe('plugin-meetings', () => {
11152
11152
  meeting.annotation.locusUrlUpdate = sinon.stub();
11153
11153
  meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
11154
11154
  meeting.webinar.locusUrlUpdate = sinon.stub();
11155
+ meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
11155
11156
 
11156
11157
  meeting.locusInfo.emit(
11157
11158
  {function: 'test', file: 'test'},
@@ -11166,6 +11167,7 @@ describe('plugin-meetings', () => {
11166
11167
  assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
11167
11168
  assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
11168
11169
  assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
11170
+ assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
11169
11171
  assert.equal(meeting.locusUrl, newLocusUrl);
11170
11172
  assert(meeting.locusId, '12345');
11171
11173
 
@@ -13354,7 +13356,9 @@ describe('plugin-meetings', () => {
13354
13356
  info: {datachannelUrl: 'a datachannel url'},
13355
13357
  };
13356
13358
 
13357
- webex.internal.llm.getDatachannelToken.withArgs('llm-default-session').returns('token-123');
13359
+ webex.internal.llm.getDatachannelToken
13360
+ .withArgs('llm-default-session')
13361
+ .returns('token-123');
13358
13362
 
13359
13363
  await meeting.updateLLMConnection();
13360
13364