-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
103 lines (94 loc) · 2.23 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Rollup Bundle</title>
</head>
<body>
<h1>Hello Usher?</h1>
<div id="response">
<p>
<button onclick="convertEvent1()">Convert EventId 1</button>
</p>
<p>
<button onclick="convertEvent2()">Convert EventId 2</button>
</p>
<p>
<a id="anchor-el" href="https://usher.so?ref=test-app" target="_blank">Go to Usher</a>
</p>
</div>
<script src="/build/index.js"></script>
<script>
var responseEl = document.querySelector("#response");
const usher = window.Usher({ apiUrl: "https://app.staging.usher.so/api" })
responseEl.innerHTML += "<p>Yes, I'm here...</p>";
const chain = "arweave"
const campaignId = "ida4Pebl2uULdI_rN8waEw65mVH9uIFTY1JyeZt1PBM"
usher.anchor("#anchor-el", {
id: campaignId,
chain: chain
})
function convertOnLoad() {
renderProgress("Converting EventId: 0 (on load)...")
usher
.convert({
id: campaignId,
chain: chain,
eventId: 0,
commit: 10,
metadata: {
hello: "world",
key: "value"
}
})
.then(renderResult)
.catch(console.error)
}
function convertEvent1() {
renderProgress("Converting EventId: 1 (manual)...")
usher
.convert({
id: campaignId,
chain: chain,
eventId: 1,
commit: 10,
metadata: {
hello: "world",
key: "value"
}
})
.then(renderResult)
.catch(console.error)
}
function convertEvent2() {
renderProgress("Converting EventId: 2 (manual)...")
usher
.convert({
id: campaignId,
chain: chain,
eventId: 2,
commit: 10,
metadata: {
hello: "world",
key: "value"
}
})
.then(renderResult)
.catch(console.error)
}
function renderProgress(message) {
responseEl.innerHTML += `<b>${message}</b>`;
}
function renderResult(conversion) {
console.log('Conversion Result: ', conversion);
const message = conversion
? `<p>I've converted a user (conversion: ${conversion.conversion})</p>`
: "<p>Conversion failed</p>"
responseEl.innerHTML += message;
}
setTimeout(() => {
convertOnLoad();
}, 5000);
</script>
</body>
</html>