@livelike/embet 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +26 -12
- package/embet.cjs.js +50 -10
- package/embet.cjs.min.js +3 -2
- package/embet.esm.js +453 -419
- package/embet.esm.min.js +3 -2
- package/embet.umd.js +50 -10
- package/embet.umd.min.js +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Initialize the SDK with the LiveLike.init function. A Client ID in the clientId parameter is required to initialization to succeed.
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```html
|
|
8
8
|
<html>
|
|
9
9
|
<body>
|
|
10
10
|
<script src="https://unpkg.com/@livelike/embet/embet.umd.js"></script>
|
|
@@ -23,18 +23,18 @@ Initialize the SDK with the LiveLike.init function. A Client ID in the clientId
|
|
|
23
23
|
|
|
24
24
|
LiveLike's user profile can get fetched and updated at any time.
|
|
25
25
|
|
|
26
|
-
```
|
|
27
|
-
LiveLike.getUserProfile({accessToken:
|
|
26
|
+
```js
|
|
27
|
+
LiveLike.getUserProfile({accessToken: "<Access token>"}).then(profile => console.log(profile))
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
The profile's nickname or custom data can be updated
|
|
31
31
|
|
|
32
|
-
```
|
|
32
|
+
```js
|
|
33
33
|
LiveLike.updateUserProfile({
|
|
34
|
-
accessToken:
|
|
34
|
+
accessToken: "<Access token>",
|
|
35
35
|
options: {
|
|
36
|
-
nickname:
|
|
37
|
-
custom_data:
|
|
36
|
+
nickname: "<New Nickname>",
|
|
37
|
+
custom_data: JSON.stringify({ custom: 'data' })
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
.then(profile => console.log(profile))
|
|
@@ -43,20 +43,33 @@ LiveLike.updateUserProfile({
|
|
|
43
43
|
### Profile initialization
|
|
44
44
|
|
|
45
45
|
When a user loads the application for the first time, a LiveLike profile will be generated and return in the init method. You can use this to save the `access_token` property to your existing user's profile. Loading this profile will allow you to pass the `access_token` property to the init function, which will initialize the application with that user profile, allowing for persistent profiles across devices.
|
|
46
|
-
```
|
|
47
|
-
|
|
48
46
|
|
|
47
|
+
```js
|
|
49
48
|
fetchSavedUserProfile()
|
|
50
49
|
.then(savedUserProfile => {
|
|
51
50
|
const savedAccessToken = savedUserProfile.access_token;
|
|
52
51
|
|
|
53
52
|
embet.init({
|
|
54
|
-
clientId: '',
|
|
53
|
+
clientId: '<Client Id>',
|
|
55
54
|
accessToken: savedAccessToken
|
|
56
55
|
})
|
|
57
56
|
})
|
|
58
57
|
```
|
|
59
58
|
|
|
59
|
+
## Widget setup
|
|
60
|
+
|
|
61
|
+
To add widgets to the page, the `embet-widgets` element can be used.
|
|
62
|
+
|
|
63
|
+
The `embet-widgets` element has optional `programid` and `customid` attributes.
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<embet-widgets programid="<Program Id>"></embet-widgets>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<embet-widgets customid="my-custom-id"></embet-widgets>
|
|
71
|
+
```
|
|
72
|
+
|
|
60
73
|
## Widgets
|
|
61
74
|
|
|
62
75
|
The three widgets currently available are the `live-moneyline`, `live-spread`, and `live-total` widgets. These are signified by the widget payload's custom_data `type` property ` type: 'LIVE SPREAD' | 'LIVE MONEYLINE' | 'LIVE TOTAL'`
|
|
@@ -644,7 +657,8 @@ You can call the 'LiveLike.applyTheme` method at any time to update the widget's
|
|
|
644
657
|
The `widgets` property is required, and currently the "Prediction" widget is being used as a base, so the `Prediction` property must be used when updating the theme.
|
|
645
658
|
|
|
646
659
|
The example below shows what is required. Any properties added within the `prediction` object are optional.
|
|
647
|
-
|
|
660
|
+
|
|
661
|
+
```js
|
|
648
662
|
LiveLike.applyTheme({
|
|
649
663
|
widgets: {
|
|
650
664
|
prediction: {
|
|
@@ -656,7 +670,7 @@ LiveLike.applyTheme({
|
|
|
656
670
|
|
|
657
671
|
Example showing a change to the header's padding and background color, and the footer's background color.
|
|
658
672
|
|
|
659
|
-
```
|
|
673
|
+
```js
|
|
660
674
|
LiveLike.applyTheme({
|
|
661
675
|
widgets: {
|
|
662
676
|
prediction: {
|