This repository was archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
70 lines (57 loc) · 1.81 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
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<meta content="utf-8" http-equiv="encoding" />
<meta http-equiv="x-ua-compatible" content="IE=edge">
<title>Basiq JS Control demo</title>
<script type="text/javascript" src="dist/basiq.client.min.js"></script>
</head>
<body>
<h1>Basiq control demo</h1>
<a href="#" id="connectYourAcc">Connect your account</a>
<script type="text/javascript">
let userId = parseQueryVariables("userId"),
accessToken = parseQueryVariables("accessToken"),
demo = parseQueryVariables("demo"),
connectionId = parseQueryVariables("connectionId"),
statements = parseQueryVariables("statements");
blinkHost = parseQueryVariables("blinkHost");
let ui = new Basiq({
blinkHost: blinkHost,
userId: userId,
accessToken: accessToken,
demo: !!demo && demo === "true",
connectionId: connectionId,
statements: statements !== "false"
});
ui.addListener("handshake", function (data, event) {
console.log("Handshake:", data, event);
});
ui.addListener("connection", function (data) {
console.log("Connection:", data);
});
ui.addListener(["cancellation"], function () {
ui.hide();
});
document.getElementById("connectYourAcc").onclick = function () {
ui.render();
};
function parseQueryVariables(name) {
let queryString = window.location.search.substring(1),
query = {},
pairs = queryString.split("&");
for (let i = 0; i < pairs.length; i++) {
let pair = pairs[i].split("=");
query[decodeURIComponent(pair[0])] = decodeURIComponent(
pair[1] || ""
);
}
if (name) {
return query[name];
}
return query;
}
</script>
</body>
</html>