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
7 changes: 7 additions & 0 deletions packages/contact-center/store/src/storeEventsWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ class StoreWrapper implements IStoreWrapper {
// @ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
this.setTeamId(payload.teamId);
});
// CAI-7899: Ensure CC SDK listeners (incl. agent:stateChange) are attached even when
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont need to put the CAI ID in code unless its a TODO

// Mobius registration is skipped (non-WebRTC tabs e.g. Epic Hyperspace secondary windows,
// or Extension/AgentDN logins) and silent relogin doesn't run.
if (!listenersAdded) {
addEventListeners();
listenersAdded = true;
}
};

ccSDK.on(CC_EVENTS.AGENT_STATION_LOGIN_SUCCESS, handleLogin);
Expand Down
68 changes: 67 additions & 1 deletion widgets-samples/cc/samples-cc-react-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ function App() {
const savedAllowInternationalDn = window.localStorage.getItem('allowInternationalDn');
return savedAllowInternationalDn === 'true';
});
const [disableWebRTCRegistration, setDisableWebRTCRegistration] = useState(() => {
const savedDisableWebRTCRegistration = window.localStorage.getItem('disableWebRTCRegistration');
return savedDisableWebRTCRegistration === 'true';
});

const WEBRTC_DEPENDENT_WIDGETS = ['incomingTask', 'taskList', 'callControl', 'callControlCAD'];
const isWidgetDisabledByWebRTC = (widget: string) =>
disableWebRTCRegistration && WEBRTC_DEPENDENT_WIDGETS.includes(widget);

const handleSaveStart = () => {
setShowLoader(true);
Expand Down Expand Up @@ -138,6 +146,7 @@ function App() {
},
cc: {
allowMultiLogin: isMultiLoginEnabled,
disableWebRTCRegistration,
},
...(integrationEnv && {
services: {
Expand Down Expand Up @@ -224,6 +233,17 @@ function App() {
}
};

const toggleDisableWebRTCRegistration = () => {
const newValue = !disableWebRTCRegistration;
setDisableWebRTCRegistration(newValue);
if (newValue) {
setSelectedWidgets((prev) => ({
...prev,
...WEBRTC_DEPENDENT_WIDGETS.reduce((acc, w) => ({...acc, [w]: false}), {}),
}));
}
};

function playNotificationSound() {
const ctx = new AudioContext();
const osc = ctx.createOscillator();
Expand Down Expand Up @@ -328,6 +348,9 @@ function App() {
redirect_uri: redirectUri,
scope: requestedScopes,
},
cc: {
disableWebRTCRegistration,
},
},
};

Expand Down Expand Up @@ -365,6 +388,9 @@ function App() {
useEffect(() => {
window.localStorage.setItem('hideDesktopLogin', JSON.stringify(hideDesktopLogin));
}, [hideDesktopLogin]);
useEffect(() => {
window.localStorage.setItem('disableWebRTCRegistration', JSON.stringify(disableWebRTCRegistration));
}, [disableWebRTCRegistration]);

useEffect(() => {
store.setIncomingTaskCb(onIncomingTaskCB);
Expand Down Expand Up @@ -526,6 +552,7 @@ function App() {
name={widget}
checked={selectedWidgets[widget]}
onChange={handleCheckboxChange}
disabled={isWidgetDisabledByWebRTC(widget)}
data-testid={`samples:widget-${widget}`}
/>
 
Expand Down Expand Up @@ -633,7 +660,11 @@ function App() {
<Text>
<div
className="warning-note"
style={{color: 'var(--mds-color-theme-text-error-normal)', marginBottom: '10px'}}
style={{
color: 'var(--mds-color-theme-text-error-normal)',
marginBottom: '10px',
maxWidth: '320px',
}}
>
<strong>Note:</strong> The "Enable Multi Login" option must be set before initializing the
SDK. Changes to this setting after SDK initialization will not take effect. Please ensure
Expand All @@ -642,6 +673,41 @@ function App() {
</Text>
</PopoverNext>
</label>
<label style={{display: 'flex', flexDirection: 'row', alignItems: 'center', marginTop: '10px'}}>
<input
data-testid="samples:disable-webrtc-registration-checkbox"
type="checkbox"
id="disableWebRTCRegistrationFlag"
name="disableWebRTCRegistrationFlag"
onChange={toggleDisableWebRTCRegistration}
checked={disableWebRTCRegistration}
/>{' '}
&nbsp; Disable WebRTC Registration
<PopoverNext
trigger="mouseenter"
triggerComponent={<Icon name="info-badge-filled" />}
placement="auto-end"
closeButtonPlacement="top-left"
closeButtonProps={{'aria-label': 'Close'}}
>
<Text>
<div
className="warning-note"
style={{
color: 'var(--mds-color-theme-text-error-normal)',
marginBottom: '10px',
maxWidth: '320px',
}}
>
<strong>Note:</strong> Disabling WebRTC registration prevents browser-based calling. When
enabled, the "Incoming Task", "Task List", "Call Control", and "Call Control with CAD"
widgets will be unchecked and disabled because they depend on call handling. Set this
option before clicking the "Init Widgets" button — changes after SDK initialization will
not take effect.
</div>
</Text>
</PopoverNext>
</label>
</fieldset>
</section>
</div>
Expand Down
Loading