gameos-jackpot-widget v1.2.1
GameOS Jackpot Widgets
Usage:
Install “gameos-jackpot-widget”.
npm install gameos-jackpot-widget
In your root file add import.
import { applyPolyfills, defineCustomElements } from 'gameos-jackpot-widget/loader';
In that file apply polyfills that you imported before
applyPolyfills().then(() => {
defineCustomElements(window);
});
Then you can use the gameos-jackpot-widget tag where you need it.
Attributes:
widget-id: String
: Widget ID;jwt: String
: JSON Web Token that is using for authorization;language: String (optional)
: Language of text on Total widget and for Opt-in jackpots, in case you provided a specific language description. List of supported languages: English, Portuguese, Spanish, Japanese, Hindi. By default English, value should be in lowercase, eg., “spanish”.
To get jwt you should at first generate access_token by making an API request POST ‘oauth2/authorize/’ with a provided token in headers.
headers: {
"Authorization": "Basic eyJhbGciOiJIUz351iIsInR5cCI6IkpXVCJ9.eyJ3b2Zfc2VjX2lkIjoiMjI3ZmJjMzQtZTkzNS00ODdjLTlhOTItNWRhYzYzYjZhZTE1IiwijxkydG5lcl9pZCI6IlNreVNvZnRUZWNoIiwiZXhwaXJhdGlvbl9kYXRlIjoiMjAyMy0xMS0wMyAxMTo0Mjo0Ny43ODA2MjkrMDA6MDAifQ.MqlpORCdBrJz4WnTtTLIHI2cbVKGKTXkfX_YMSJgZFt"
}
Response example:
{
"access_token": "UksndZQCrWAj8glCVnJzOIAo5V8viW",
"token_type": "Bearer",
"expires_in": 86154.498971
}
After you generate access_token you can get jwt by making an API request POST ‘api/widget/authorize/’ with an access_token in headers.
headers: {
"Authorization": "Bearer cCjIkGfFfPbbBkSI0agLIed0oeiikk"
}
And player_id in the body.
{
"player_id": "d1b89312-cexx-11ed-8qb1-31eec7i3ne3c"
}
Response example:
[
{
"jwt": "eyJhbGciOiJIUz351iIsInR5cCI6IkpXVCJ9.eyJ3b2Zfc2VjX2lkIjoiMjI3ZmJjMzQtZTkzNS00ODdjLTlhOTItNWRhYzYzYjZhZTE1IiwijxkydG5lcl9pZCI6IlNreVNvZnRUZWNoIiwiZXhwaXJhdGlvbl9kYXRlIjoiMjAyMy0xMS0wMyAxMTo0Mjo0Ny43ODA2MjkrMDA6MDAifQ.MqlpORCdBrJz4WnTtTLIHI2cbVKGKTXkfX_YMSJgZF8",
},
]
“jwt” expires in 24 hours, so you will receive an event “jwtExpired” after the token expires so that you can make an API call, the same as for getting a new one, to refresh it.
To get “widget-id” you should create a widget on the Widgets page in the back office https://app.gameos.ai/jackpots/widgets. There you can create, edit and archive widget, you can also change widget configurations, e.g. color, type or saturation. Changes will be applied to the widget after page refresh where it’s integrated.
Example usage:
Import package:
import 'gos-jackpot-widget'
Pass attributes:
<gos-jackpot-widget
widget-id='k32hsv9s-jooo-90x2-0xi2-ica9123ljjsq'
jwt='eyJhbGciOiJIUzUxMiIsInR5cCIockpXVCJ9.eyJwYXJ0bmVyX2lk2jxoiSlNfVGVhbSIsImV4cGlyYXRpb25fZGF0ZSI6IjIwMjQtMDYtMDEgMDY6MjM6MTIuODgxNDk2KzAwOjAwIn0.BQlbjslkBPASQRF3DZnK6SqECxbev6JwWLgPFuq3nZ8YihqyvS5qLsUXNFqls7oBWf45p-_3som79HlYYmc-Ag'
>
</gos-jackpot-widget>
Publishing:
To publish a new version of “gameos-jackpot-widget”. to npm, follow these steps: 1. Update the version number in package.json according to semantic versioning. 2. Commit the changes:
git commit -am 'Bump version to x.x.x'
- Push the changes to the repository:
git push origin main
- Publish to npm:
npm publish
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago