Skip to content

Commit 0f8f8aa

Browse files
akulakumrsarika
authored andcommitted
fix(multy-party-conference): address-review-comments
1 parent 0fc7bbb commit 0f8f8aa

9 files changed

Lines changed: 177 additions & 190 deletions

File tree

packages/contact-center/task/src/CallControl/index.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ import {CallControlProps} from '../task.types';
88
import {CallControlComponent} from '@webex/cc-components';
99

1010
const CallControlInternal: React.FunctionComponent<CallControlProps> = observer(
11-
({
12-
onHoldResume,
13-
onEnd,
14-
onWrapUp,
15-
onRecordingToggle,
16-
onToggleMute,
17-
consultTransferOptions,
18-
multiPartyConferenceEnabled,
19-
}) => {
11+
({onHoldResume, onEnd, onWrapUp, onRecordingToggle, onToggleMute, consultTransferOptions, conferenceEnabled}) => {
2012
const {
2113
logger,
2214
currentTask,
@@ -42,7 +34,7 @@ const CallControlInternal: React.FunctionComponent<CallControlProps> = observer(
4234
deviceType,
4335
featureFlags,
4436
isMuted,
45-
multiPartyConferenceEnabled,
37+
conferenceEnabled,
4638
agentId,
4739
}),
4840
wrapupCodes,
@@ -65,7 +57,7 @@ const CallControl: React.FunctionComponent<CallControlProps> = (props) => {
6557
if (store.onErrorCallback) store.onErrorCallback('CallControl', error);
6658
}}
6759
>
68-
<CallControlInternal {...props} multiPartyConferenceEnabled={props.multiPartyConferenceEnabled ?? true} />
60+
<CallControlInternal {...props} conferenceEnabled={props.conferenceEnabled ?? true} />
6961
</ErrorBoundary>
7062
);
7163
};

packages/contact-center/task/src/CallControlCAD/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const CallControlCADInternal: React.FunctionComponent<CallControlProps> = observ
1616
onToggleMute,
1717
callControlClassName,
1818
callControlConsultClassName,
19-
multiPartyConferenceEnabled,
19+
conferenceEnabled,
2020
consultTransferOptions,
2121
}) => {
2222
const {
@@ -43,7 +43,7 @@ const CallControlCADInternal: React.FunctionComponent<CallControlProps> = observ
4343
deviceType,
4444
featureFlags,
4545
isMuted,
46-
multiPartyConferenceEnabled,
46+
conferenceEnabled,
4747
agentId,
4848
}),
4949
wrapupCodes,
@@ -68,7 +68,7 @@ const CallControlCAD: React.FunctionComponent<CallControlProps> = (props) => {
6868
if (store.onErrorCallback) store.onErrorCallback('CallControlCAD', error);
6969
}}
7070
>
71-
<CallControlCADInternal {...props} multiPartyConferenceEnabled={props.multiPartyConferenceEnabled ?? true} />
71+
<CallControlCADInternal {...props} conferenceEnabled={props.conferenceEnabled ?? true} />
7272
</ErrorBoundary>
7373
);
7474
};

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,9 @@ export function getConferenceButtonVisibility(
177177
isCall: boolean,
178178
isChat: boolean,
179179
isBeingConsulted: boolean,
180-
multiPartyConferenceEnabled: boolean
180+
conferenceEnabled: boolean
181181
): Visibility {
182-
const isVisible =
183-
((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted && multiPartyConferenceEnabled;
182+
const isVisible = ((isBrowser && isCall && webRtcEnabled) || isChat) && !isBeingConsulted && conferenceEnabled;
184183

185184
return {isVisible, isEnabled: true};
186185
}
@@ -194,9 +193,9 @@ export function getExitConferenceButtonVisibility(
194193
consultCallHeld: boolean,
195194
isHeld: boolean,
196195
isConsultCompleted: boolean,
197-
multiPartyConferenceEnabled: boolean
196+
conferenceEnabled: boolean
198197
): Visibility {
199-
const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted && multiPartyConferenceEnabled;
198+
const isVisible = isConferenceInProgress && !isConsultInitiatedOrAccepted && conferenceEnabled;
200199
const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld;
201200
// Disable if: conference with consult not held OR (held AND in conference AND consult completed)
202201
const isEnabled = !isConferenceWithConsultNotHeld && !(isHeld && isConferenceInProgress && isConsultCompleted);
@@ -213,9 +212,9 @@ export function getMergeConferenceButtonVisibility(
213212
consultCallHeld: boolean,
214213
isConferenceInProgress: boolean,
215214
isCustomerInCall: boolean,
216-
multiPartyConferenceEnabled: boolean
215+
conferenceEnabled: boolean
217216
): Visibility {
218-
const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall && multiPartyConferenceEnabled;
217+
const isVisible = isConsultInitiatedOrAccepted && isCustomerInCall && conferenceEnabled;
219218
const isConferenceWithConsultNotHeld = isConferenceInProgress && isConsultInitiatedOrAccepted && !consultCallHeld;
220219
const isEnabled = isConsultAccepted && consultCallHeld && !isConferenceWithConsultNotHeld;
221220

@@ -288,9 +287,9 @@ export function getMergeConferenceConsultButtonVisibility(
288287
isConsultInitiated: boolean,
289288
consultCallHeld: boolean,
290289
isCustomerInCall: boolean,
291-
multiPartyConferenceEnabled: boolean
290+
conferenceEnabled: boolean
292291
): Visibility {
293-
const isVisible = (isConsultAccepted || isConsultInitiated) && multiPartyConferenceEnabled;
292+
const isVisible = (isConsultAccepted || isConsultInitiated) && conferenceEnabled;
294293
const isEnabled = !consultCallHeld && isConsultAccepted && isCustomerInCall;
295294

296295
return {isVisible, isEnabled};
@@ -374,7 +373,7 @@ export function getWrapupButtonVisibility(task: ITask): Visibility {
374373
* @param featureFlags Feature flags configuration object
375374
* @param task The task object
376375
* @param agentId The agent ID
377-
* @param multiPartyConferenceEnabled Whether multiparty conference is enabled
376+
* @param conferenceEnabled Whether conference is enabled
378377
* @param logger Optional logger instance
379378
* @returns An object containing the visibility and state of various controls
380379
*/
@@ -383,7 +382,7 @@ export function getControlsVisibility(
383382
featureFlags: {[key: string]: boolean},
384383
task: ITask,
385384
agentId: string,
386-
multiPartyConferenceEnabled: boolean,
385+
conferenceEnabled: boolean,
387386
logger?: ILogger
388387
) {
389388
try {
@@ -406,7 +405,7 @@ export function getControlsVisibility(
406405

407406
// Calculate task state flags
408407
const isTransferVisibility = isBrowser ? webRtcEnabled : true;
409-
const isConferenceInProgress = (task?.data?.isConferenceInProgress && multiPartyConferenceEnabled) ?? false;
408+
const isConferenceInProgress = (task?.data?.isConferenceInProgress && conferenceEnabled) ?? false;
410409
const isConsultInProgress = getIsConsultInProgress(task);
411410
const isHeld = findHoldStatus(task, 'mainCall', agentId);
412411
const isCustomerInCall = getIsCustomerInCall(task);
@@ -472,23 +471,23 @@ export function getControlsVisibility(
472471
isCall,
473472
isChat,
474473
isBeingConsulted,
475-
multiPartyConferenceEnabled
474+
conferenceEnabled
476475
),
477476
exitConference: getExitConferenceButtonVisibility(
478477
isConferenceInProgress,
479478
isConsultInitiatedOrAccepted,
480479
consultCallHeld,
481480
isHeld,
482481
isConsultCompleted,
483-
multiPartyConferenceEnabled
482+
conferenceEnabled
484483
),
485484
mergeConference: getMergeConferenceButtonVisibility(
486485
isConsultInitiatedOrAcceptedOnly,
487486
isConsultAccepted,
488487
consultCallHeld,
489488
isConferenceInProgress,
490489
isCustomerInCall,
491-
multiPartyConferenceEnabled
490+
conferenceEnabled
492491
),
493492

494493
// Consult controls
@@ -528,7 +527,7 @@ export function getControlsVisibility(
528527
isConsultInitiated,
529528
consultCallHeld,
530529
isCustomerInCall,
531-
multiPartyConferenceEnabled
530+
conferenceEnabled
532531
),
533532
muteUnmuteConsult: getMuteUnmuteConsultButtonVisibility(
534533
isBrowser,

packages/contact-center/task/src/helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export const useCallControl = (props: useCallControlProps) => {
280280
deviceType,
281281
featureFlags,
282282
isMuted,
283-
multiPartyConferenceEnabled,
283+
conferenceEnabled,
284284
agentId,
285285
} = props;
286286
const [isRecording, setIsRecording] = useState(true);
@@ -868,8 +868,8 @@ export const useCallControl = (props: useCallControlProps) => {
868868
};
869869

870870
const controlVisibility = useMemo(
871-
() => getControlsVisibility(deviceType, featureFlags, currentTask, agentId, multiPartyConferenceEnabled, logger),
872-
[deviceType, featureFlags, currentTask, agentId, multiPartyConferenceEnabled, logger]
871+
() => getControlsVisibility(deviceType, featureFlags, currentTask, agentId, conferenceEnabled, logger),
872+
[deviceType, featureFlags, currentTask, agentId, conferenceEnabled, logger]
873873
);
874874

875875
// Add useEffect for auto wrap-up timer

packages/contact-center/task/src/task.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ export type CallControlProps = Partial<
2020
| 'callControlClassName'
2121
| 'callControlConsultClassName'
2222
| 'onToggleMute'
23-
| 'multiPartyConferenceEnabled'
23+
| 'conferenceEnabled'
2424
| 'consultTransferOptions'
2525
>
2626
>;
2727

2828
export type useCallControlProps = Pick<
2929
ControlProps,
30-
'currentTask' | 'logger' | 'deviceType' | 'featureFlags' | 'isMuted' | 'multiPartyConferenceEnabled' | 'agentId'
30+
'currentTask' | 'logger' | 'deviceType' | 'featureFlags' | 'isMuted' | 'conferenceEnabled' | 'agentId'
3131
> &
3232
Partial<Pick<ControlProps, 'onHoldResume' | 'onEnd' | 'onWrapUp' | 'onRecordingToggle' | 'onToggleMute'>>;
3333

packages/contact-center/task/tests/CallControl/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('CallControl Component', () => {
104104
expect(useCallControlSpy).toHaveBeenCalledWith({
105105
currentTask: null,
106106
onHoldResume: onHoldResumeCb,
107-
multiPartyConferenceEnabled: true,
107+
conferenceEnabled: true,
108108
onEnd: onEndCb,
109109
onWrapUp: onWrapUpCb,
110110
onRecordingToggle: onRecordingToggleCb,

packages/contact-center/task/tests/CallControlCAD/index.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ describe('CallControlCAD Component', () => {
111111
featureFlags: store.featureFlags,
112112
deviceType: '',
113113
isMuted: false,
114-
multiPartyConferenceEnabled: true,
114+
conferenceEnabled: true,
115115
agentId: store.agentId,
116116
});
117117
});
118118

119-
it('should use default multiPartyConferenceEnabled value when not provided', () => {
119+
it('should use default conferenceEnabled value when not provided', () => {
120120
const useCallControlSpy = jest.spyOn(helper, 'useCallControl').mockReturnValue({
121121
currentTask: mockTask,
122122
endCall: jest.fn(),
@@ -185,12 +185,12 @@ describe('CallControlCAD Component', () => {
185185
// Should default to true when not provided
186186
expect(useCallControlSpy).toHaveBeenCalledWith(
187187
expect.objectContaining({
188-
multiPartyConferenceEnabled: true,
188+
conferenceEnabled: true,
189189
})
190190
);
191191
});
192192

193-
it('should use provided multiPartyConferenceEnabled value', () => {
193+
it('should use provided conferenceEnabled value', () => {
194194
const useCallControlSpy = jest.spyOn(helper, 'useCallControl').mockReturnValue({
195195
currentTask: mockTask,
196196
endCall: jest.fn(),
@@ -255,18 +255,13 @@ describe('CallControlCAD Component', () => {
255255
});
256256

257257
render(
258-
<CallControlCAD
259-
onHoldResume={onHoldResumeCb}
260-
onEnd={onEndCb}
261-
onWrapUp={onWrapUpCb}
262-
multiPartyConferenceEnabled={false}
263-
/>
258+
<CallControlCAD onHoldResume={onHoldResumeCb} onEnd={onEndCb} onWrapUp={onWrapUpCb} conferenceEnabled={false} />
264259
);
265260

266261
// Should use the provided value
267262
expect(useCallControlSpy).toHaveBeenCalledWith(
268263
expect.objectContaining({
269-
multiPartyConferenceEnabled: false,
264+
conferenceEnabled: false,
270265
})
271266
);
272267
});

0 commit comments

Comments
 (0)