Skip to content
Draft
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
92 changes: 80 additions & 12 deletions workspace-toolkit/samples/components.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en-US">
<head>
<title>Workspace Toolkit - Components</title>
<meta charset='utf-8' />
Expand Down Expand Up @@ -300,6 +300,24 @@
min-width: 50px;
padding: 10px;
}
pre {
text-align: left;
}
.sessionErrorBtnActionsContainer {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-around;
width: 100%;
margin: 10px 0px 0px 0px;
}
.appUrl-container {
display: none;
}
.logoutUrl-container {
display: none;
}
</style>

<script>
Expand All @@ -322,7 +340,8 @@
window.genesys.wwe.Auth.login({
target: AUTH_MODE === 'pop' ? "authSignInBtnContainer" : 'iFrameAuthContainer',
createNode: true,
authMode: AUTH_MODE
authMode: AUTH_MODE,
enableSessionErrorDetails: true
}, function () {
// Login succeed

Expand Down Expand Up @@ -453,10 +472,10 @@
console.log(data);
}
},
function (progressType, message, allowLogout) {
// Login progress status
console.log("Login progress: " + progressType);
switch (progressType) {
function (notificationType, message, allowLogout) {
// Notification callback status
console.log("Notification callback: " + notificationType);
switch (notificationType) {
case "authenticationStarted":
// When the authentication has been prompted to the user
if (AUTH_MODE === 'iframe') {
Expand Down Expand Up @@ -495,6 +514,47 @@
case "popupOpened":
showComponents("none", "none", "block", "none", "none", "none", "none");
break;
case "sessionError":
// When something is wrong. Info in JSON format in 'message' property
console.log("Session error: " + JSON.stringify(message, null, '\t'));
var displayedMessage = 'Session error :<br><code>';
const messageKeys = Object.keys(message);
for (var i = 0; i < messageKeys.length; i++) {
displayedMessage += messageKeys[i] + ' = ' + message[messageKeys[i]] + '<br>';
}
displayedMessage += '</code>';
document.getElementById("error-message").innerHTML = displayedMessage;

// Get appUrl button
var goToAppUrlContainer = document.getElementById('goToAppUrlContainer');
var appUrlBtn = document.getElementById('appUrlBtn');
if (message.appUrl) {
appUrlBtn.onclick = function() { window.location.href = message.appUrl; };
goToAppUrlContainer.style = 'display: block';
} else {
appUrlBtn.onclick = null;
goToAppUrlContainer.style = 'display: none';
}

// Get logoutUrl button
var goToLogoutUrlContainer = document.getElementById('goToLogoutUrlContainer');
var logoutUrlBtn = document.getElementById('logoutUrlBtn');

if (message.allowLogout || message.canChangeAccount) {
logoutUrlBtn.onclick = function() { window.location.href = message.logoutUrl; };
goToLogoutUrlContainer.style = 'display: block';
} else {
logoutUrlBtn.onclick = null;
goToLogoutUrlContainer.style = 'display: none';
}

document.getElementById("authSignInBtnContainer").addEventListener("click", function () {
showComponents("none", "none", "block", "none", "none", "none", "none");
});
showComponents("none", "flex", "none", "none", "none", "none", "flex");
document.getElementById("logoutContainer").style.display = 'none';
document.getElementById("iFrameAuth").style.display = 'none';
break;
default:
break;
}
Expand Down Expand Up @@ -651,7 +711,7 @@
label.innerText = 'WWE v' + info.version;
});
}

// Command called before closing an interaction
function checkBeforeClose() {
if (!document.getElementById('mandatoryCheckbox').checked) {
Expand Down Expand Up @@ -691,7 +751,7 @@
<div class="setup-container">
<div class="auth setup-row">
<label><b>Auth Mode:</b></label>
<select id="auth-mode">
<select title="Choose Authentication Mode" id="auth-mode">
<option value="iframe">Iframe</option>
<option value="pop">Popup</option>
</select>
Expand All @@ -712,9 +772,17 @@
</div>
<div id="errorView" style="display: none">
<span id="error-message">An error has occured.</span>
<div class="logout-container">
<div id="logoutContainer" class="logout-container">
<button class="gux-primary" onclick="window.authLogout()">Logout</button>
</div>
<div class="sessionErrorBtnActionsContainer">
<div id="goToLogoutUrlContainer" class="logoutUrl-container">
<button id="logoutUrlBtn" class="gux-primary">logoutUrl</button>
</div>
<div id="goToAppUrlContainer" class="appUrl-container">
<button id="appUrlBtn" class="gux-primary">appUrl</button>
</div>
</div>
</div>
<div id="loadingAPIView" style="display: none">
<div id="loadingMessage">Loading the API, please wait...</div>
Expand Down Expand Up @@ -765,7 +833,7 @@ <h2>Communicator</h2>
<h2>Interaction Bar</h2>
<div id="myCustomInteractionBar"></div>

Check this item to be able to close the voice interaction <input type="checkbox" id="mandatoryCheckbox">
Check this item to be able to close the voice interaction <input type="checkbox" id="mandatoryCheckbox" title="Mandatory Checkbox">

<h2>Interaction Container</h2>
<div id="myCustomInteractionContainer"></div>
Expand Down Expand Up @@ -809,7 +877,7 @@ <h2>Contact Directory</h2>
lastAuthMode = window.localStorage.getItem('toolkit.sample.auth-mode') || lastAuthMode;
lastEnvironmentUrl = window.localStorage.getItem('toolkit.sample.env-url') || lastEnvironmentUrl;
}

var authModeSelect = document.getElementById('auth-mode');
var environmentUrlInput = document.getElementById('environment-url');
var startButton = document.getElementById('start-btn');
Expand Down Expand Up @@ -860,7 +928,7 @@ <h2>Contact Directory</h2>
}
}
getCurrentSession();

// Adds the toolkit script dynamically, in order to support environment URL via input
function appendToolkitScript () {
if (toolkitScript) {
Expand Down