-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
80 lines (76 loc) · 2.87 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <script src="./dist/gived.js" data-gived-campaign-id='tcp'></script> -->
<script src="./dist/gived.js"></script>
<!-- <script>
window.gived = new Gived({
protocol: 'http',
domain: 'localhost:3000',
campaignId: 'azure',
enableCampaignManager: true,
campaignNameOverride: 'Test Name'
});
gived.showCampaignManager();
</script> -->
<script>
// var script = document.createElement('script');
// script.src = './dist/gived.js';
// script = document.head.appendChild(script);
// script.onload = function () {
// setTimeout(function () {
// var gived = new Gived({
// cdnOverride: 'http://localhost:8080/dist',
// protocol: 'http',
// domain: 'localhost:3000',
// campaignId: 'azure',
// enableCampaignManager: true,
// campaignNameOverride: 'Test Name'
// });
// // gived.showCampaignManager();
// }, 0);
// }
</script>
</head>
<body>
<button data-gived-amount="500" data-gived-tier="Post-Modern Fraud" data-gived-recurring='false'>of course i am a
post-modern fraud</button>
<button class='login-btn'>Login</button>
<button class='refresh-btn'>Refresh</button>
<button class='update-btn'>Update</button>
<button class='sub-btn'>sub</button>
<button class='pay-btn'>pay</button>
</body>
<script>
const gived = new Gived({
campaignId: 'test',
domain: 'localhost:3000',
api: 'http://localhost:12180',
cdn: 'http://localhost:8080/dist',
});
gived.getCampaignData().then(d => console.log('Campaign Data', d));
const loginBtn = document.querySelector('.login-btn');
loginBtn.onclick = async function () {
const user = await gived.login();
}
const refreshBtn = document.querySelector('.refresh-btn');
refreshBtn.onclick = async function () {
console.log(await gived.getUser(true));
}
const updateDataBtn = document.querySelector('.update-btn');
updateDataBtn.onclick = async function () {
const data = await gived.getData(true);
console.log(await gived.setData({ ...data, number: (data.number || 0) + 1 }));
}
const subButton = document.querySelector('.sub-btn');
subButton.onclick = async function () {
await gived.showGived(500, 'Subscriber', true);
}
const payButton = document.querySelector('.pay-btn');
payButton.onclick = async function () {
await gived.showGived(500, 'Purchaser', false, { forName: 'My Friend', forAddress: '5 Candy Lane, SW17YU' });
}
</script>
</html>