Skip to content

Commit

Permalink
Misc supervisor-barge-coach fixes, test fixes (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
dremin authored Jan 11, 2025
1 parent e9a83aa commit ca40b9d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions plugin-flex-ts-template-v2/__mocks__/@twilio/flex-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ module.exports = {
},
},
),
useFlexSelector: (callback) => callback(getMockedReduxState()),
// Component wrappers
withTaskContext: (WrappedComponent) => {
return () => ({
Expand Down
1 change: 1 addition & 0 deletions plugin-flex-ts-template-v2/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ module.exports = {
coverageReporters: ['json', 'lcov', 'text', 'clover', 'cobertura'],
globalSetup: '<rootDir>/globalSetupTests.js',
setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
transformIgnorePatterns: ['/node_modules/(?!@twilio-paste/icons/.*)'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import zhHans from './zh-hans.json';

// Export the template names as an enum for better maintainability when accessing them elsewhere
export enum StringTemplates {
InternalDial = 'InternalDial',
CallAgent = 'PSInternalCallCallAgent',
SelectAgent = 'PSInternalCallSelectAgent',
CallQueue = 'PSInternalCallCallQueue',
Expand All @@ -15,7 +14,6 @@ export enum StringTemplates {

export const stringHook = () => ({
'en-US': {
[StringTemplates.InternalDial]: 'Internal Dial',
[StringTemplates.CallAgent]: 'Call Agent',
[StringTemplates.SelectAgent]: 'Select an agent',
[StringTemplates.CallQueue]: 'Call Queue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,20 @@ export const SupervisorBargeCoachButtons = ({ task }: SupervisorBargeCoachProps)
setIsLoading(true);

switch (mode) {
case 'barge':
case 'barge': {
// Barge-in will "unmute" their line if the are muted and disable coaching if enabled
await enterBargeMode(conferenceSid, participantSid);
const agentParticipant = conference?.participants.find(
(p) => p.participantType === 'worker' && monitoringTask?.workerSid === p.workerSid,
);
const agentSid = agentParticipant?.callSid;
if (!agentSid) {
setIsLoading(false);
return;
}
await enterBargeMode(conferenceSid, participantSid, agentSid);
break;
case 'coaching':
}
case 'coaching': {
// Coaching will "unmute" their line if the are muted and coach the specific agent using their call SID
const agentParticipant = conference?.participants.find(
(p) => p.participantType === 'worker' && monitoringTask?.workerSid === p.workerSid,
Expand All @@ -96,6 +105,7 @@ export const SupervisorBargeCoachButtons = ({ task }: SupervisorBargeCoachProps)
}
await enterCoachMode(conferenceSid, participantSid, agentSid);
break;
}
case 'monitoring':
// Mute their line and disable coaching
await enterListenMode(conferenceSid, participantSid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"PSBargeCoachAgentSeekingAssistance": "Agente buscando asistencia",
"PSBargeCoachBarge": "Intervenir",
"PSBargeCoachCoach": "Entrenador",
"PSBargeCoachListen": "Escuchar",
"PSBargeCoachAgentCoachedBy": "Estás siendo entrenado por:",
"PSBargeCoachActiveSupervisors": "Supervisores activos:",
"PSBargeCoachNone": "Ninguno",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"PSBargeCoachBarge": "Chamada",
"PSBargeCoachAgentSeekingAssistance": "Agente buscando assistência",
"PSBargeCoachCoach": "Treinar",
"PSBargeCoachListen": "Ouvir",
"PSBargeCoachAgentCoachedBy": "Você está sendo assistido por:",
"PSBargeCoachAssistanceAlertsEnabled": "Alertas de Assistência do Agente Habilitados",
"PSBargeCoachAssistanceAlertsDisabled": "Alertas de Assistência do Agente Desativados",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export const enterListenMode = async (conferenceSid: string, participantSid?: st
Manager.getInstance().store.dispatch(listen());
};

export const enterBargeMode = async (conferenceSid: string, participantSid: string) => {
await BargeCoachService.updateParticipantBargeCoach(conferenceSid, participantSid, '', false, false);
export const enterBargeMode = async (conferenceSid: string, participantSid: string, agentCallSid: string) => {
await BargeCoachService.updateParticipantBargeCoach(conferenceSid, participantSid, agentCallSid, false, false);
updateSyncDoc(conferenceSid, 'barge');
Manager.getInstance().store.dispatch(barge());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,4 @@ export const supervisorBrowserRefresh = async () => {
SyncDoc.initSyncDocSupervisors(agentWorkerSID, '', myWorkerSID, '', '', 'remove');
localStorage.removeItem('agentWorkerSID');
}
// This is here if the Supervisor refreshes and has toggled alerts to false
// By default alerts set to true
const privateToggle = localStorage.getItem('privateToggle');
if (privateToggle === 'false') {
Flex.Manager.getInstance().store.dispatch(
setBargeCoachStatus({
coachingStatusPanel: false,
}),
);
}
};

0 comments on commit ca40b9d

Please sign in to comment.