diff --git a/packages/contact-center/store/package.json b/packages/contact-center/store/package.json index ed21aefcc..13ecb6248 100644 --- a/packages/contact-center/store/package.json +++ b/packages/contact-center/store/package.json @@ -59,4 +59,4 @@ "webpack-cli": "5.1.4", "webpack-merge": "6.0.1" } -} \ No newline at end of file +} diff --git a/packages/contact-center/task/src/Utils/constants.ts b/packages/contact-center/task/src/Utils/constants.ts index dcad63c28..c9f9cb695 100644 --- a/packages/contact-center/task/src/Utils/constants.ts +++ b/packages/contact-center/task/src/Utils/constants.ts @@ -3,4 +3,3 @@ export const MEDIA_TYPE_TELEPHONY = 'telephony'; export const MEDIA_TYPE_CHAT = 'chat'; export const MEDIA_TYPE_EMAIL = 'email'; export const MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE = 7; -export const MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE = 2; diff --git a/packages/contact-center/task/src/Utils/task-util.ts b/packages/contact-center/task/src/Utils/task-util.ts index 24f997584..4559486a7 100644 --- a/packages/contact-center/task/src/Utils/task-util.ts +++ b/packages/contact-center/task/src/Utils/task-util.ts @@ -17,7 +17,6 @@ import { MEDIA_TYPE_CHAT, MEDIA_TYPE_EMAIL, MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE, - MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE, } from './constants'; import {DeviceTypeFlags} from '../task.types'; @@ -177,9 +176,11 @@ export function getConferenceButtonVisibility( webRtcEnabled: boolean, isCall: boolean, isChat: boolean, - isBeingConsulted: boolean + isBeingConsulted: boolean, + multiPartyConferenceEnabled: boolean ): Visibility { - const isVisible = ((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted; + const isVisible = + ((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted && multiPartyConferenceEnabled; return {isVisible, isEnabled: true}; } @@ -199,9 +200,10 @@ export function getExitConferenceButtonVisibility( isConsultInitiatedOrAccepted: boolean, consultCallHeld: boolean, isHeld: boolean, - isConsultCompleted: boolean + isConsultCompleted: boolean, + multiPartyConferenceEnabled: boolean ): Visibility { - const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted; + const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted && multiPartyConferenceEnabled; const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld; // Disable if: conference with consult not held OR (held AND in conference AND consult completed) const isEnabled = !isConferenceWithConsultNotHeld && !(isHeld && isConferenceInProgress && isConsultCompleted); @@ -217,9 +219,10 @@ export function getMergeConferenceButtonVisibility( isConsultAccepted: boolean, consultCallHeld: boolean, isConferenceInProgress: boolean, - isCustomerInCall: boolean + isCustomerInCall: boolean, + multiPartyConferenceEnabled: boolean ): Visibility { - const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall; + const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall && multiPartyConferenceEnabled; const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld; const isEnabled = isConsultAccepted && consultCallHeld && !isConferenceWithConsultNotHeld; @@ -291,9 +294,10 @@ export function getMergeConferenceConsultButtonVisibility( isConsultAccepted: boolean, isConsultInitiated: boolean, consultCallHeld: boolean, - isCustomerInCall: boolean + isCustomerInCall: boolean, + multiPartyConferenceEnabled: boolean ): Visibility { - const isVisible = isConsultAccepted || isConsultInitiated; + const isVisible = (isConsultAccepted || isConsultInitiated) && multiPartyConferenceEnabled; const isEnabled = !consultCallHeld && isConsultAccepted && isCustomerInCall; return {isVisible, isEnabled}; @@ -419,9 +423,6 @@ export function getControlsVisibility( // Calculate conference participants count const conferenceParticipantsCount = getConferenceParticipantsCount(task); - const maxParticipantsInConference = multiPartyConferenceEnabled - ? MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE - : MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE; // Calculate consult status flags (REUSED CONDITIONS) const isConsultInitiated = taskConsultStatus === ConsultStatus.CONSULT_INITIATED; @@ -472,20 +473,29 @@ export function getControlsVisibility( // Transfer and conference controls transfer: getTransferButtonVisibility(isTransferVisibility, isConferenceInProgress, isConsultInitiatedOrAccepted), - conference: getConferenceButtonVisibility(isBrowser, webRtcEnabled, isCall, isChat, isBeingConsulted), + conference: getConferenceButtonVisibility( + isBrowser, + webRtcEnabled, + isCall, + isChat, + isBeingConsulted, + multiPartyConferenceEnabled + ), exitConference: getExitConferenceButtonVisibility( isConferenceInProgress, isConsultInitiatedOrAccepted, consultCallHeld, isHeld, - isConsultCompleted + isConsultCompleted, + multiPartyConferenceEnabled ), mergeConference: getMergeConferenceButtonVisibility( isConsultInitiatedOrAcceptedOnly, isConsultAccepted, consultCallHeld, isConferenceInProgress, - isCustomerInCall + isCustomerInCall, + multiPartyConferenceEnabled ), // Consult controls @@ -495,7 +505,7 @@ export function getControlsVisibility( isConsultInProgress, isCustomerInCall, conferenceParticipantsCount, - maxParticipantsInConference, + MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE, isBeingConsulted, isHeld, isConsultCompleted, @@ -524,7 +534,8 @@ export function getControlsVisibility( isConsultAccepted, isConsultInitiated, consultCallHeld, - isCustomerInCall + isCustomerInCall, + multiPartyConferenceEnabled ), muteUnmuteConsult: getMuteUnmuteConsultButtonVisibility( isBrowser, diff --git a/packages/contact-center/task/tests/utils/task-util.ts b/packages/contact-center/task/tests/utils/task-util.ts index 22fe1ad88..1083db07d 100644 --- a/packages/contact-center/task/tests/utils/task-util.ts +++ b/packages/contact-center/task/tests/utils/task-util.ts @@ -57,7 +57,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is BROWSER, webRtcEnabled is disbaled and media type is telehphony', () => { @@ -98,7 +98,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is BROWSER, isEndCallEnabled is disbaled and media type is telehphony', () => { @@ -139,7 +139,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is BROWSER, isEndConsultEnabled is disbaled and media type is telehphony', () => { @@ -186,7 +186,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is AGENT_DN, all flags are enabled and media type is telehphony', () => { @@ -227,7 +227,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is EXTENSION, all flags are enabled and media type is telehphony', () => { @@ -271,7 +271,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is EXTENSION, all flags are enabled and media type is chat', () => { @@ -315,7 +315,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls); }); it('should show correct controls when station logis is BROWSER, all flags are enabled and media type is email', () => { @@ -359,7 +359,7 @@ describe('getControlsVisibility', () => { consultCallHeld: false, }; - expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls); + expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls); }); it('should handle errors when accessing featureFlags and return safe defaults', () => { diff --git a/widgets-samples/cc/samples-cc-react-app/src/App.tsx b/widgets-samples/cc/samples-cc-react-app/src/App.tsx index 8ffda809e..0a8fc5b4e 100644 --- a/widgets-samples/cc/samples-cc-react-app/src/App.tsx +++ b/widgets-samples/cc/samples-cc-react-app/src/App.tsx @@ -74,6 +74,10 @@ function App() { const savedintegrationEnv = window.localStorage.getItem('integrationEnv'); return savedintegrationEnv === 'true'; }); + const [multiPartyConferenceEnabled, setMultiPartyConferenceEnabled] = useState(() => { + const savedMultiPartyConferenceEnabled = window.localStorage.getItem('multiPartyConferenceEnabled'); + return savedMultiPartyConferenceEnabled !== null ? savedMultiPartyConferenceEnabled === 'true' : true; + }); const handleSaveStart = () => { setShowLoader(true); @@ -339,6 +343,9 @@ function App() { useEffect(() => { window.localStorage.setItem('integrationEnv', JSON.stringify(integrationEnv)); }, [integrationEnv]); + useEffect(() => { + window.localStorage.setItem('multiPartyConferenceEnabled', JSON.stringify(multiPartyConferenceEnabled)); + }, [multiPartyConferenceEnabled]); useEffect(() => { store.setIncomingTaskCb(onIncomingTaskCB); @@ -556,6 +563,16 @@ function App() { setintegrationEnv(!integrationEnv); }} /> + { + setMultiPartyConferenceEnabled(!multiPartyConferenceEnabled); + }} + /> {store.isAgentLoggedIn && (