-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
84 lines (71 loc) · 3.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex" />
<!--Removes Google Crawler from indexing page-->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>WebMessaging</title>
</head>
<body>
<script type="text/javascript" charset="utf-8">
(function (g, e, n, es, ys) {
g['_genesysJs'] = e;
g[e] = g[e] || function () {
(g[e].q = g[e].q || []).push(arguments)
};
g[e].t = 1 * new Date();
g[e].c = es;
ys = document.createElement('script'); ys.async = 1; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys);
})(window, 'Genesys', 'https://apps.mypurecloud.jp/genesys-bootstrap/genesys.min.js', {
environment: 'prod-apne1',
deploymentId: 'deploymentId' //put in deploymentId
});
//Subscribe to conversation
Genesys("subscribe", "MessagingService.messagesReceived", function (o) {
try {
console.log(o.data.messages[0].text);
popIframe()
} catch (err) {
console.error(err);
}
});
//You can add customAttributes to the interaction
function setData(key, value) {
Genesys("command", "Database.set", { messaging: { customAttributes: { [key]: value } } })
}
//Bootstrap iFrame Invite
function popIframe() {
document.getElementById('iFramePop').className = 'toast show'
}
//Bootstrap iFrame Invite
function closeIframe() {
document.getElementById('iFramePop').className = 'toast hide'
}
</script>
<div class="row align-items-center">
<h1 style="text-align: center;">Genesys WebMessaging iFrame popup</h1>
</div>
<div class="container">
<button onclick="popIframe()" class="btn btn-secondary">Pop Invite</button>
<button onclick="closeIframe()" class="btn btn-secondary">Close Invite</button>
</div>
<!--Visuals for the popup window you can change the colors to suit the widget-->
<div class="position-absolute top-50 start-50 translate-middle" style="z-index: 999999999">
<div id="iFramePop" class="toast hide" role="alert" aria-live="assertive" aria-atomic="true"
style="height: 35rem">
<div class="toast-header" style="background-color: #3b6aaf;">
<strong class="me-auto" style="color: white;">iFrame</strong>
<button type="button" class="btn-close btn-close-white" aria-label="Close"
onclick="closeIframe(); setData('iframePop', 'done')"></button>
</div>
<div id="iFramePopBody" class="toast-body" style="height: 100%;">
<!--For the example im getting the URL from a parameter this could be statically set or pulled from teh page etc in the real world-->
<iframe id="iFrameSrc" src="https://www.bing.com" height="100%" width="100%"></iframe>
</div>
</div>
</div>
</body>
</html>