Skip to content

Commit 7cbe5ad

Browse files
authored
Merge pull request #110 from cormacmchale1/comchale/CX-16464
Updating Major Version and expanding the logout functionality
2 parents fd8f6fa + 57177d4 commit 7cbe5ad

File tree

4 files changed

+96
-8
lines changed

4 files changed

+96
-8
lines changed

lit-element/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test": "jest"
2323
},
2424
"dependencies": {
25-
"@wxcc-desktop/sdk": "^1.2.7",
25+
"@wxcc-desktop/sdk": "^2.0.1",
2626
"@wxcc-desktop/sdk-types": "^1.0.3"
2727
},
2828
"resolutions": {

lit-element/src/components/App.ts

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export default class MyCustomComponent extends LitElement {
3636
agentSessionId = "5a84d32c-691b-4500-b163-d6cdba2a3163";
3737

3838
@property({ type: String }) titleFor = "";
39+
@property({ type: String }) agentIdSignout = "";
40+
@property({ type: String }) orgIdSignout = "";
3941

4042
/**
4143
* Replace this with the logic to obtain interaction ID you need
@@ -71,7 +73,7 @@ export default class MyCustomComponent extends LitElement {
7173
async connectedCallback() {
7274
super.connectedCallback();
7375

74-
await Desktop.config.init();
76+
await Desktop.config.init({widgetName: "widgetName", widgetProvider: "widgetProvider"});
7577

7678
this.getCurrentInteractionId();
7779
this.subscribeAgentContactDataEvents();
@@ -187,10 +189,10 @@ export default class MyCustomComponent extends LitElement {
187189
"eAgentConsultConferenceEndFailed",
188190
msg => logger.info("AgentContact eAgentConsultConferenceEndFailed: ", msg)
189191
);
190-
Desktop.agentContact.addEventListener("eAgentMonitorStateChanged", msg =>
192+
Desktop.agentContact.addEventListener("eAgentMonitorStateChanged", (msg: any) =>
191193
logger.info("AgentContact eAgentMonitorStateChanged: ", msg)
192194
);
193-
Desktop.agentContact.addEventListener("eAgentMonitoringEnded", msg =>
195+
Desktop.agentContact.addEventListener("eAgentMonitoringEnded", (msg: any) =>
194196
logger.info("AgentContact eAgentMonitoringEnded: ", msg)
195197
);
196198
}
@@ -244,6 +246,18 @@ export default class MyCustomComponent extends LitElement {
244246
logger.info(wrapup);
245247
}
246248

249+
async logout()
250+
{
251+
await Desktop.logout.desktopLogout({ data: { logoutReason: "User requested logout" } });
252+
}
253+
async signoutAgent(agentId: string, orgId: any) {
254+
try {
255+
await Desktop.logout.signoutAgent({orgId, data: { agentId, logoutReason: "SupervisorSignout" }});
256+
} catch (e) {
257+
console.log(e);
258+
}
259+
}
260+
247261
async fireNotification() {
248262
const raw: Notifications.ItemMeta.Raw = {
249263
data: {
@@ -708,6 +722,31 @@ export default class MyCustomComponent extends LitElement {
708722
>Update Title</md-button
709723
>
710724
</md-tab-panel>
725+
726+
<md-tab slot="tab">Desktop.logout</md-tab>
727+
<md-tab-panel slot="panel">
728+
<div class="action-container">
729+
<h2>Signout Functionality</h2>
730+
<md-button @button-click=${() => this.logout()}
731+
>Self Signout</md-button>
732+
733+
<br>
734+
Enter AgentId :
735+
<input
736+
type="text"
737+
id="agentIdSignout"
738+
@change="${(e: any) => (this.agentIdSignout = e?.target?.value)}"
739+
/>
740+
Enter OrgId :
741+
<input
742+
type="text"
743+
id="orgIdSignout"
744+
@change="${(e: any) => (this.orgIdSignout = e?.target?.value)}"
745+
/>
746+
<md-button @click="${() => this.signoutAgent(this.agentIdSignout, this.orgIdSignout)}">
747+
Supervisor Signout Agent
748+
</md-button>
749+
</md-tab-panel>
711750
</md-tabs>
712751
<slot></slot>
713752
</div>

react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@types/react": "16.9.3",
1414
"@types/react-dom": "16.9.1",
1515
"@uuip/unified-ui-platform-sdk": "^1.3.6",
16-
"@wxcc-desktop/sdk": "1.3.16",
16+
"@wxcc-desktop/sdk": "2.0.1",
1717
"@wxcc-desktop/sdk-types": "1.0.10",
1818
"copy-webpack-plugin": "^5.0.2",
1919
"direflow-component": "3.5.3",

react/src/direflow-component/App.tsx

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const App: FC<IProps> = (props) => {
3434
);
3535

3636
const [titleFor, setTitleFor] = useState("");
37+
const [agentIdSignout, setAgentIdSignout] = useState("");
38+
const [orgIdSignout, setOrgIdSignout] = useState("");
3739
const newInteractionId = useRef<any>(null);
3840

3941
const [buddyAgents, setBuddyAgents] = useState(
@@ -69,7 +71,7 @@ const App: FC<IProps> = (props) => {
6971
useEffect(() => {}, [props.agentId, props.darkTheme]);
7072

7173
async function init() {
72-
await Desktop.config.init();
74+
await Desktop.config.init({widgetName: "widgetName", widgetProvider: "widgetProvider"});
7375
}
7476

7577
const subscribeScreenpopEvent = () => {
@@ -272,10 +274,10 @@ const App: FC<IProps> = (props) => {
272274
Desktop.monitoring.addEventListener("eMonitoringUnHoldFailed", (msg: any) =>
273275
logger.info("Monitoring eMonitoringUnHoldFailed: ", msg)
274276
);
275-
Desktop.monitoring.addEventListener("eBargedIn", (msg: any) =>
277+
Desktop.monitoring.addEventListener("eAgentMonitorStateChanged", (msg: any) =>
276278
logger.info("Monitoring eBargedIn: ", msg)
277279
);
278-
Desktop.monitoring.addEventListener("eBargeInFailed", (msg: any) =>
280+
Desktop.monitoring.addEventListener("eAgentMonitorStateChangeFailed", (msg: any) =>
279281
logger.info("Monitoring eBargeInFailed: ", msg)
280282
);
281283
};
@@ -300,6 +302,16 @@ const App: FC<IProps> = (props) => {
300302
}
301303
};
302304

305+
const logout = async () =>
306+
{
307+
await Desktop.logout.desktopLogout({ data: { logoutReason: "User requested logout" } });
308+
}
309+
310+
const signoutAgent = async (orgIdSignout: string, agentIdSignout:string) =>
311+
{
312+
await Desktop.logout.signoutAgent({orgId: orgIdSignout, data: { agentId: agentIdSignout, logoutReason: "SupervisorSignout" }});
313+
}
314+
303315
const getClientLocale = () => {
304316
logger.info("Client locale: ", Desktop.config.clientLocale);
305317
};
@@ -977,6 +989,43 @@ const App: FC<IProps> = (props) => {
977989
Update Title
978990
</md-button>
979991
</md-tab-panel>
992+
993+
<md-tab slot="tab">Desktop.logout</md-tab>
994+
<md-tab-panel slot="panel">
995+
<div className="action-container">
996+
<h2>Signout Functionality</h2>
997+
<md-button onClick={() => logout()}>
998+
Self Signout
999+
</md-button>
1000+
</div>
1001+
<br></br>
1002+
<h2>Supervisor sign out</h2>
1003+
<md-input
1004+
class="input-field"
1005+
shape="pill"
1006+
placeholder="AgentId"
1007+
clear=""
1008+
value=""
1009+
tabindex="0"
1010+
autoFocus
1011+
onInput={(e: any) => setAgentIdSignout(e.target.value)}
1012+
></md-input>
1013+
<md-input
1014+
class="input-field"
1015+
shape="pill"
1016+
placeholder="OrgId"
1017+
clear=""
1018+
value=""
1019+
tabindex="0"
1020+
autoFocus
1021+
onInput={(e: any) => setOrgIdSignout(e.target.value)}
1022+
></md-input>
1023+
<md-button onClick={() => signoutAgent(orgIdSignout, agentIdSignout)}>
1024+
Supervisor Signout
1025+
</md-button>
1026+
</md-tab-panel>
1027+
1028+
9801029
</md-tabs>
9811030
</div>
9821031
</Styled>

0 commit comments

Comments
 (0)