Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/@webex/plugin-meetings/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ export const DISPLAY_HINTS = {

// AI
ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED: 'ATTENDEE_REQUEST_AI_ASSISTANT_ENABLED',
ATTENDEE_REQUEST_AI_ASSISTANT_DECLINED_ALL: 'ATTENDEE_REQUEST_AI_ASSISTANT_DECLINED_ALL',
};

export const INTERSTITIAL_DISPLAY_HINTS = [DISPLAY_HINTS.VOIP_IS_ENABLED];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ interface IInMeetingActions {
canEnablePollingQA?: boolean;
canDisablePollingQA?: boolean;
canAttendeeRequestAiAssistantEnabled?: boolean;
isAttendeeRequestAiAssistantDeclinedAll?: boolean;
}

/**
Expand Down Expand Up @@ -340,6 +341,8 @@ export default class InMeetingActions implements IInMeetingActions {

canAttendeeRequestAiAssistantEnabled = null;

isAttendeeRequestAiAssistantDeclinedAll = null;

/**
* Returns all meeting action options
* @returns {Object}
Expand Down Expand Up @@ -452,6 +455,7 @@ export default class InMeetingActions implements IInMeetingActions {
canEnablePollingQA: this.canEnablePollingQA,
canDisablePollingQA: this.canDisablePollingQA,
canAttendeeRequestAiAssistantEnabled: this.canAttendeeRequestAiAssistantEnabled,
isAttendeeRequestAiAssistantDeclinedAll: this.isAttendeeRequestAiAssistantDeclinedAll,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/@webex/plugin-meetings/src/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4553,6 +4553,8 @@ export default class Meeting extends StatelessWebexPlugin {
this.userDisplayHints,
this.roles
),
isAttendeeRequestAiAssistantDeclinedAll:
MeetingUtil.attendeeRequestAiAssistantDeclinedAll(this.userDisplayHints),
}) || changed;
}
if (changed) {
Expand Down
3 changes: 3 additions & 0 deletions packages/@webex/plugin-meetings/src/meeting/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ const MeetingUtil = {
return false;
},

attendeeRequestAiAssistantDeclinedAll: (displayHints = []) =>
displayHints.includes(DISPLAY_HINTS.ATTENDEE_REQUEST_AI_ASSISTANT_DECLINED_ALL),

selfSupportsFeature: (feature: SELF_POLICY, userPolicies: Record<SELF_POLICY, boolean>) => {
if (!userPolicies) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe('plugin-meetings', () => {
canEnablePollingQA: null,
canDisablePollingQA: null,
canAttendeeRequestAiAssistantEnabled: null,
isAttendeeRequestAiAssistantDeclinedAll: null,

...expected,
};
Expand Down Expand Up @@ -230,6 +231,7 @@ describe('plugin-meetings', () => {
'canEnablePollingQA',
'canDisablePollingQA',
'canAttendeeRequestAiAssistantEnabled',
'isAttendeeRequestAiAssistantDeclinedAll',
].forEach((key) => {
it(`get and set for ${key} work as expected`, () => {
const inMeetingActions = new InMeetingActions();
Expand Down
72 changes: 34 additions & 38 deletions packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('plugin-meetings', () => {
stopReachability: sinon.stub(),
isSubnetReachable: sinon.stub().returns(true),
};
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false)
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
webex.internal.llm.on = sinon.stub();
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
{},
Expand Down Expand Up @@ -11899,6 +11899,7 @@ describe('plugin-meetings', () => {
let isSpokenLanguageAutoDetectionEnabledSpy;
let showAutoEndMeetingWarningSpy;
let canAttendeeRequestAiAssistantEnabledSpy;
let attendeeRequestAiAssistantDeclinedAllSpy;
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.

beforeEach(() => {
Expand Down Expand Up @@ -11939,13 +11940,18 @@ describe('plugin-meetings', () => {
MeetingUtil,
'canAttendeeRequestAiAssistantEnabled'
);
attendeeRequestAiAssistantDeclinedAllSpy = sinon.spy(
MeetingUtil,
'attendeeRequestAiAssistantDeclinedAll'
);
});

afterEach(() => {
inMeetingActionsSetSpy.restore();
waitingForOthersToJoinSpy.restore();
showAutoEndMeetingWarningSpy.restore();
canAttendeeRequestAiAssistantEnabledSpy.restore();
attendeeRequestAiAssistantDeclinedAllSpy.restore();
});

forEach(
Expand Down Expand Up @@ -12501,6 +12507,7 @@ describe('plugin-meetings', () => {
userDisplayHints,
meeting.roles
);
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);

assert.calledWith(ControlsOptionsUtil.hasHints, {
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
Expand Down Expand Up @@ -12709,7 +12716,7 @@ describe('plugin-meetings', () => {
meeting.joinedWith = {state: 'JOINED'};
meeting.locusInfo = {
url: 'a url',
info: {datachannelUrl: 'a datachannel url'}
info: {datachannelUrl: 'a datachannel url'},
};

const result = await meeting.updateLLMConnection();
Expand Down Expand Up @@ -12757,7 +12764,7 @@ describe('plugin-meetings', () => {
);
assert.equal(result, 'something');
});
it('disconnects if the locus url has changed', async () => {
it('disconnects if the locus url has changed', async () => {
meeting.joinedWith = {state: 'JOINED'};

webex.internal.llm.isConnected.returns(true);
Expand All @@ -12766,15 +12773,15 @@ describe('plugin-meetings', () => {
meeting.locusInfo = {
url: 'a different url',
info: {datachannelUrl: 'a datachannel url'},
self: {}
self: {},
};

const result = await meeting.updateLLMConnection();

assert.calledWithExactly(
webex.internal.llm.disconnectLLM,
{code: 3050, reason: 'done (permanent)'}
);
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
code: 3050,
reason: 'done (permanent)',
});

assert.calledWithExactly(
webex.internal.llm.registerAndConnect,
Expand Down Expand Up @@ -12816,15 +12823,15 @@ describe('plugin-meetings', () => {
meeting.locusInfo = {
url: 'a url',
info: {datachannelUrl: 'a different datachannel url'},
self: {}
self: {},
};

const result = await meeting.updateLLMConnection();

assert.calledWithExactly(
webex.internal.llm.disconnectLLM,
{code: 3050, reason: 'done (permanent)'}
);
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
code: 3050,
reason: 'done (permanent)',
});

assert.calledWithExactly(
webex.internal.llm.registerAndConnect,
Expand Down Expand Up @@ -12911,11 +12918,7 @@ describe('plugin-meetings', () => {
'a datachannel url',
'token-123'
);
assert.calledWithExactly(
webex.internal.llm.setDatachannelToken,
'token-123',
'default'
);
assert.calledWithExactly(webex.internal.llm.setDatachannelToken, 'token-123', 'default');
});
it('prefers refreshed token over locus self token', async () => {
meeting.joinedWith = {state: 'JOINED'};
Expand All @@ -12925,9 +12928,7 @@ describe('plugin-meetings', () => {
self: {datachannelToken: 'locus-token'},
};

webex.internal.llm.getDatachannelToken
.withArgs('default')
.returns('refreshed-token');
webex.internal.llm.getDatachannelToken.withArgs('default').returns('refreshed-token');

await meeting.updateLLMConnection();

Expand Down Expand Up @@ -12958,8 +12959,10 @@ describe('plugin-meetings', () => {
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);

webex.internal.llm.getDatachannelToken
.withArgs(true).returns('refreshed-ps-token') // refreshed practice token
.withArgs(false).returns('refreshed-normal-token'); // refreshed normal token
.withArgs(true)
.returns('refreshed-ps-token') // refreshed practice token
.withArgs(false)
.returns('refreshed-normal-token'); // refreshed normal token

await meeting.updateLLMConnection();

Expand All @@ -12981,7 +12984,7 @@ describe('plugin-meetings', () => {
meeting.locusInfo = {
url: 'a url',
info: {datachannelUrl: 'a datachannel url'},
self: {datachannelToken: 'token-123'}
self: {datachannelToken: 'token-123'},
};

webex.internal.llm.getDatachannelToken.returns(undefined);
Expand All @@ -12995,11 +12998,7 @@ describe('plugin-meetings', () => {
'a datachannel url',
'token-123'
);
assert.calledWithExactly(
webex.internal.llm.setDatachannelToken,
'token-123',
'default'
);
assert.calledWithExactly(webex.internal.llm.setDatachannelToken, 'token-123', 'default');
});
});

Expand Down Expand Up @@ -14577,7 +14576,7 @@ describe('plugin-meetings', () => {
meeting.locusUrl = 'https://locus.example.com';
meeting.meetingRequest = {
fetchDatachannelToken: sinon.stub().resolves({
body: { datachannelToken: 'mock-token' },
body: {datachannelToken: 'mock-token'},
}),
};
meeting.members = {
Expand All @@ -14593,14 +14592,11 @@ describe('plugin-meetings', () => {

sinon.assert.calledOnce(meeting.meetingRequest.fetchDatachannelToken);

sinon.assert.calledWith(
meeting.meetingRequest.fetchDatachannelToken,
{
locusUrl: 'https://locus.example.com',
requestingParticipantId: 'self-123',
isPracticeSession: true,
}
);
sinon.assert.calledWith(meeting.meetingRequest.fetchDatachannelToken, {
locusUrl: 'https://locus.example.com',
requestingParticipantId: 'self-123',
isPracticeSession: true,
});
});

it('returns the correct structured result', async () => {
Expand Down
24 changes: 24 additions & 0 deletions packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,30 @@ describe('plugin-meetings', () => {
});
});

describe('attendeeRequestAiAssistantDeclinedAll', () => {
it('returns true when display hint is present', () => {
assert.isTrue(
MeetingUtil.attendeeRequestAiAssistantDeclinedAll([
'ATTENDEE_REQUEST_AI_ASSISTANT_DECLINED_ALL',
])
);
});

it('returns false when display hint is not present', () => {
assert.isFalse(MeetingUtil.attendeeRequestAiAssistantDeclinedAll([]));
});

it('returns false when display hint is absent among other hints', () => {
assert.isFalse(
MeetingUtil.attendeeRequestAiAssistantDeclinedAll(['SOME_OTHER_HINT', 'ANOTHER_HINT'])
);
});

it('returns false when called with no arguments', () => {
assert.isFalse(MeetingUtil.attendeeRequestAiAssistantDeclinedAll());
});
});

describe('bothLeaveAndEndMeetingAvailable', () => {
it('works as expected', () => {
assert.deepEqual(
Expand Down
Loading