This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
86 lines (78 loc) · 2.49 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
85
86
<!DOCTYPE html>
<html>
<head>
<title>This is the title of the webpage!</title>
<script>
(function () {
var windowObj = window;
var documentObj = document;
var ZygSDK = function () {
ZygSDK.enqueue(arguments);
};
// Initialize an empty queue
ZygSDK.q = [];
// Enqueue function to push events into the queue
ZygSDK.enqueue = function (event) {
ZygSDK.q.push(event);
};
// Assign ZygSDK function to the global window object
windowObj.ZygSDK = ZygSDK;
// Function to load the ZygSDK widget script
var loadZygSDKWidget = function () {
var scriptElement = documentObj.createElement("script");
scriptElement.setAttribute("type", "text/javascript");
scriptElement.setAttribute("async", "true");
scriptElement.setAttribute("src", "build/sdk.js");
var firstScript = documentObj.getElementsByTagName("script")[0];
firstScript.parentNode.insertBefore(scriptElement, firstScript);
};
if (documentObj.readyState === "complete") {
loadZygSDKWidget();
} else if (windowObj.addEventListener) {
windowObj.addEventListener("load", loadZygSDKWidget, false);
}
})();
window.ZygEnv = "development";
// ZygSDK("init", {
// widgetId: "wdcqpq5pktidu1dh95akn0",
// customerEmail: "[email protected]",
// customerHash: "97389dc07ad04ffb58b560f80eab1cf4f9f500c6199c16deab5f90abc9b17872",
// traits: {
// name: "Haleigh",
// },
// });
ZygSDK("init", {
widgetId: "wdcr51aoctidudvsmjeop0",
customer: {
traits: {
name: "James Doe",
},
},
tabs: ["home", "conversations"],
defaultTab: "home",
homeLinks: [
{
id: 1,
title: "Book a Demo",
href: "https://www.zyg.ai/",
previewText: "Book a demo with our team",
},
],
});
</script>
</head>
<body>
<h1>Foo Bar Software</h1>
<p>Chat with our embedded support widget.</p>
<script>
window.addEventListener("zygsdk:loaded", function () {
window.ZygSDK.on("ready", function () {
console.log("ZygSDK is ready!");
});
window.ZygSDK.on("authenticated", function () {
console.log("Customer is authenticated!");
});
});
</script>
</body>
</html>