Skip to content

Commit 27075a0

Browse files
committed
fix: changed or added feature flag to disable conference feature
1 parent 2ff45cd commit 27075a0

4 files changed

Lines changed: 55 additions & 26 deletions

File tree

packages/contact-center/task/src/Utils/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export const MEDIA_TYPE_TELEPHONY = 'telephony';
33
export const MEDIA_TYPE_CHAT = 'chat';
44
export const MEDIA_TYPE_EMAIL = 'email';
55
export const MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE = 7;
6-
export const MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE = 2;

packages/contact-center/task/src/Utils/task-util.ts

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
MEDIA_TYPE_CHAT,
1818
MEDIA_TYPE_EMAIL,
1919
MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE,
20-
MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE,
2120
} from './constants';
2221
import {DeviceTypeFlags} from '../task.types';
2322

@@ -177,9 +176,11 @@ export function getConferenceButtonVisibility(
177176
webRtcEnabled: boolean,
178177
isCall: boolean,
179178
isChat: boolean,
180-
isBeingConsulted: boolean
179+
isBeingConsulted: boolean,
180+
multiPartyConferenceEnabled: boolean
181181
): Visibility {
182-
const isVisible = ((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted;
182+
const isVisible =
183+
((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted && multiPartyConferenceEnabled;
183184

184185
return {isVisible, isEnabled: true};
185186
}
@@ -199,9 +200,10 @@ export function getExitConferenceButtonVisibility(
199200
isConsultInitiatedOrAccepted: boolean,
200201
consultCallHeld: boolean,
201202
isHeld: boolean,
202-
isConsultCompleted: boolean
203+
isConsultCompleted: boolean,
204+
multiPartyConferenceEnabled: boolean
203205
): Visibility {
204-
const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted;
206+
const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted && multiPartyConferenceEnabled;
205207
const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld;
206208
// Disable if: conference with consult not held OR (held AND in conference AND consult completed)
207209
const isEnabled = !isConferenceWithConsultNotHeld && !(isHeld && isConferenceInProgress && isConsultCompleted);
@@ -217,9 +219,10 @@ export function getMergeConferenceButtonVisibility(
217219
isConsultAccepted: boolean,
218220
consultCallHeld: boolean,
219221
isConferenceInProgress: boolean,
220-
isCustomerInCall: boolean
222+
isCustomerInCall: boolean,
223+
multiPartyConferenceEnabled: boolean
221224
): Visibility {
222-
const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall;
225+
const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall && multiPartyConferenceEnabled;
223226
const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld;
224227
const isEnabled = isConsultAccepted && consultCallHeld && !isConferenceWithConsultNotHeld;
225228

@@ -291,9 +294,10 @@ export function getMergeConferenceConsultButtonVisibility(
291294
isConsultAccepted: boolean,
292295
isConsultInitiated: boolean,
293296
consultCallHeld: boolean,
294-
isCustomerInCall: boolean
297+
isCustomerInCall: boolean,
298+
multiPartyConferenceEnabled: boolean
295299
): Visibility {
296-
const isVisible = isConsultAccepted || isConsultInitiated;
300+
const isVisible = (isConsultAccepted || isConsultInitiated) && multiPartyConferenceEnabled;
297301
const isEnabled = !consultCallHeld && isConsultAccepted && isCustomerInCall;
298302

299303
return {isVisible, isEnabled};
@@ -419,9 +423,6 @@ export function getControlsVisibility(
419423

420424
// Calculate conference participants count
421425
const conferenceParticipantsCount = getConferenceParticipantsCount(task);
422-
const maxParticipantsInConference = multiPartyConferenceEnabled
423-
? MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE
424-
: MAX_PARTICIPANTS_IN_THREE_PARTY_CONFERENCE;
425426

426427
// Calculate consult status flags (REUSED CONDITIONS)
427428
const isConsultInitiated = taskConsultStatus === ConsultStatus.CONSULT_INITIATED;
@@ -472,20 +473,29 @@ export function getControlsVisibility(
472473

473474
// Transfer and conference controls
474475
transfer: getTransferButtonVisibility(isTransferVisibility, isConferenceInProgress, isConsultInitiatedOrAccepted),
475-
conference: getConferenceButtonVisibility(isBrowser, webRtcEnabled, isCall, isChat, isBeingConsulted),
476+
conference: getConferenceButtonVisibility(
477+
isBrowser,
478+
webRtcEnabled,
479+
isCall,
480+
isChat,
481+
isBeingConsulted,
482+
multiPartyConferenceEnabled
483+
),
476484
exitConference: getExitConferenceButtonVisibility(
477485
isConferenceInProgress,
478486
isConsultInitiatedOrAccepted,
479487
consultCallHeld,
480488
isHeld,
481-
isConsultCompleted
489+
isConsultCompleted,
490+
multiPartyConferenceEnabled
482491
),
483492
mergeConference: getMergeConferenceButtonVisibility(
484493
isConsultInitiatedOrAcceptedOnly,
485494
isConsultAccepted,
486495
consultCallHeld,
487496
isConferenceInProgress,
488-
isCustomerInCall
497+
isCustomerInCall,
498+
multiPartyConferenceEnabled
489499
),
490500

491501
// Consult controls
@@ -495,7 +505,7 @@ export function getControlsVisibility(
495505
isConsultInProgress,
496506
isCustomerInCall,
497507
conferenceParticipantsCount,
498-
maxParticipantsInConference,
508+
MAX_PARTICIPANTS_IN_MULTIPARTY_CONFERENCE,
499509
isBeingConsulted,
500510
isHeld,
501511
isConsultCompleted,
@@ -524,7 +534,8 @@ export function getControlsVisibility(
524534
isConsultAccepted,
525535
isConsultInitiated,
526536
consultCallHeld,
527-
isCustomerInCall
537+
isCustomerInCall,
538+
multiPartyConferenceEnabled
528539
),
529540
muteUnmuteConsult: getMuteUnmuteConsultButtonVisibility(
530541
isBrowser,

packages/contact-center/task/tests/utils/task-util.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('getControlsVisibility', () => {
5757
consultCallHeld: false,
5858
};
5959

60-
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls);
60+
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls);
6161
});
6262

6363
it('should show correct controls when station logis is BROWSER, webRtcEnabled is disbaled and media type is telehphony', () => {
@@ -98,7 +98,7 @@ describe('getControlsVisibility', () => {
9898
consultCallHeld: false,
9999
};
100100

101-
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls);
101+
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls);
102102
});
103103

104104
it('should show correct controls when station logis is BROWSER, isEndCallEnabled is disbaled and media type is telehphony', () => {
@@ -139,7 +139,7 @@ describe('getControlsVisibility', () => {
139139
consultCallHeld: false,
140140
};
141141

142-
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls);
142+
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls);
143143
});
144144

145145
it('should show correct controls when station logis is BROWSER, isEndConsultEnabled is disbaled and media type is telehphony', () => {
@@ -186,7 +186,7 @@ describe('getControlsVisibility', () => {
186186
consultCallHeld: false,
187187
};
188188

189-
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls);
189+
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls);
190190
});
191191

192192
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', () => {
227227
consultCallHeld: false,
228228
};
229229

230-
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', false)).toEqual(expectedControls);
230+
expect(getControlsVisibility(deviceType, featureFlags, mockTask, 'agent1', true)).toEqual(expectedControls);
231231
});
232232

233233
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', () => {
271271
consultCallHeld: false,
272272
};
273273

274-
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls);
274+
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls);
275275
});
276276

277277
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', () => {
315315
consultCallHeld: false,
316316
};
317317

318-
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls);
318+
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls);
319319
});
320320

321321
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', () => {
359359
consultCallHeld: false,
360360
};
361361

362-
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', false)).toEqual(expectedControls);
362+
expect(getControlsVisibility(deviceType, featureFlags, task, 'agent1', true)).toEqual(expectedControls);
363363
});
364364

365365
it('should handle errors when accessing featureFlags and return safe defaults', () => {

widgets-samples/cc/samples-cc-react-app/src/App.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ function App() {
7474
const savedintegrationEnv = window.localStorage.getItem('integrationEnv');
7575
return savedintegrationEnv === 'true';
7676
});
77+
const [multiPartyConferenceEnabled, setMultiPartyConferenceEnabled] = useState(() => {
78+
const savedMultiPartyConferenceEnabled = window.localStorage.getItem('multiPartyConferenceEnabled');
79+
return savedMultiPartyConferenceEnabled !== null ? savedMultiPartyConferenceEnabled === 'true' : true;
80+
});
7781

7882
const handleSaveStart = () => {
7983
setShowLoader(true);
@@ -339,6 +343,9 @@ function App() {
339343
useEffect(() => {
340344
window.localStorage.setItem('integrationEnv', JSON.stringify(integrationEnv));
341345
}, [integrationEnv]);
346+
useEffect(() => {
347+
window.localStorage.setItem('multiPartyConferenceEnabled', JSON.stringify(multiPartyConferenceEnabled));
348+
}, [multiPartyConferenceEnabled]);
342349

343350
useEffect(() => {
344351
store.setIncomingTaskCb(onIncomingTaskCB);
@@ -556,6 +563,16 @@ function App() {
556563
setintegrationEnv(!integrationEnv);
557564
}}
558565
/>
566+
<Checkbox
567+
checked={multiPartyConferenceEnabled}
568+
aria-label="multi party conference enabled checkbox"
569+
id="multi-party-conference-enabled-checkbox"
570+
label="Enable Multi-Party Conference"
571+
// @ts-expect-error: TODO: https://github.com/momentum-design/momentum-design/pull/1118
572+
onchange={() => {
573+
setMultiPartyConferenceEnabled(!multiPartyConferenceEnabled);
574+
}}
575+
/>
559576
{store.isAgentLoggedIn && (
560577
<Button
561578
id="logoutAgent"
@@ -753,6 +770,7 @@ function App() {
753770
onWrapUp={onWrapUp}
754771
onRecordingToggle={onRecordingToggle}
755772
onToggleMute={onToggleMute}
773+
multiPartyConferenceEnabled={multiPartyConferenceEnabled}
756774
/>
757775
</fieldset>
758776
</section>
@@ -771,6 +789,7 @@ function App() {
771789
callControlClassName={'call-control-outer'}
772790
callControlConsultClassName={'call-control-consult-outer'}
773791
onToggleMute={onToggleMute}
792+
multiPartyConferenceEnabled={multiPartyConferenceEnabled}
774793
/>
775794
</fieldset>
776795
</section>

0 commit comments

Comments
 (0)