Skip to content

Commit de47b18

Browse files
authored
fix(station-logout): implement-station-logout-with-sample-toggles (#461)
1 parent 0e610d3 commit de47b18

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,8 @@ iframe {
106106
.table-border{
107107
border: 1px solid silver;
108108
padding: '8px';
109+
}
110+
111+
.stationLogoutButtonClass{
112+
margin-top: 0.313rem;
109113
}

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
store,
1010
OutdialCall,
1111
} from '@webex/cc-widgets';
12+
import {StationLogoutSuccess} from '@webex/plugin-cc';
1213
import Webex from 'webex/contact-center';
1314
import {ThemeProvider, IconProvider, Icon, Button, Checkbox, Text, Select, Option} from '@momentum-design/components/dist/react';
1415
import {PopoverNext} from '@momentum-ui/react-collaboration';
@@ -310,6 +311,16 @@ function App() {
310311
console.log('onStateChange invoked', status);
311312
};
312313

314+
const stationLogout = () => {
315+
store.cc.stationLogout({logoutReason: 'User requested logout'})
316+
.then((res: StationLogoutSuccess) => {
317+
console.log('Agent logged out successfully', res.data.type);
318+
})
319+
.catch((error: Error) => {
320+
console.log('Agent logout failed', error);
321+
});
322+
};
323+
313324
return (
314325
<div className="app mds-typography">
315326
<ThemeProvider
@@ -409,7 +420,7 @@ function App() {
409420
<div className="box" style={{ flex: 1 }}>
410421
<section className="section-box">
411422
<fieldset className="fieldset">
412-
<legend className="legend-box">&nbsp;Sample App Toggles&nbsp;</legend>
423+
<legend className="legend-box">&nbsp;Sample App Toggles and Operations&nbsp;</legend>
413424
<Checkbox
414425
checked={currentTheme === 'DARK'}
415426
aria-label="theme checkbox"
@@ -432,6 +443,11 @@ function App() {
432443
setShowAgentProfile(!showAgentProfile);
433444
}}
434445
/>
446+
{store.isAgentLoggedIn && (
447+
<Button id="logoutAgent" onClick={stationLogout} color="positive" className='stationLogoutButtonClass'>
448+
Station Logout
449+
</Button>
450+
)}
435451
</fieldset>
436452
</section>
437453
<br/>

0 commit comments

Comments
 (0)