Getting started
DATA.BET's Single Page Application (SPA) is a standalone betting solution that can be easily integrated into your product.
Before running the SPA, it is necessary to authorize and generate a token for the player. This token must be passed to the SPA startup script.
Betting Loader
To integrate betting into your product, import the betting Loader script:
1 2 3 4 |
|
After the script's execution, the bettingLoader object will be available globally on the window object.
Its interface is as follows:
1 2 3 4 5 6 |
|
To start the SPA, use method load
with AppInitOptions and a callback function that provides BettingAPI.
AppInitOptions
AppInitOptions is the top-level configuration object for the SPA, which has the following structure:
1 2 3 4 5 6 7 8 9 10 |
|
Its properties are as follows:
Property | Description | Type | Required |
---|---|---|---|
token | Token of the current player | string | yes |
locale | Selected language | Locale code | yes |
currency | Currency code in the ISO:4217 format | string | yes |
rootElement | Identifier of the DOM element in which betting will be embedded | string | yes |
isAuthorized | Player's authorization status | boolean | yes |
url | All endpoints for betting | BettingUrl | yes |
features | A set of Features that are responsible for connecting various SPA functionality. | Record<FeatureKeys, boolean> | no |
defaultSettings | Default settings for the SPA. | DefaultSettings | yes |
Betting URL
The BettingURL object contains all the necessary endpoints for the SPA:
1 2 3 4 5 6 |
|
Property | Description | Type | Required |
---|---|---|---|
gqlEndpoint | Path to the GraphQL server | string | yes |
staticEndpoint | Path to the server where all the statistics are stored (js/css/assets ) | string | yes |
bettingPath | Basic URL of the application | string | yes |
pagePath | Application URL for a specific page | string | yes |
Features
The SPA provides an option for enabling or disabling various new, or experimental features:
DisableAutofocus
disable autofocus when entering the maximum bet in a betslip.AppRankPersonalized
enables the personal ranking feature for live pages.BetBooster
enables the bet booster subscription feature.HideLocalNavigation
hides the navigation tabs for esports or classic sports.HideMainVideoWidget
hides the main video widget.DisableCashout
disables cashout in a betslip.TopWidgetHideCrossTab
hides the cross tab in the topWidget.ShowFreebet
shows the freebets.ShowOutright
shows the outright.ShowSearch
shows the search component.ShowExpressGenerator
shows the express generator.ShowBetBuilder
shows the betbuilder tab.ShowInsurance
shows the bet insurance.ShowFormatSettings
shows the select component to control the odd format and view.ShowScoreboardWidget
shows the scoreboard widget.ShowTopEventsWidget
shows the top events widget.MatchEmbeddedVideoLink
enables the embedded video link for streams.
Default settings
The DefaultSetting options are used to customize the display of lines and odds.
1 2 3 4 |
|
Property | Description | Type | Required |
---|---|---|---|
lineFormat | Default line format for the SPA. | LineFormat | yes |
oddFormat | Default odd format for the SPA. | OddFormat | yes |
Betting API
BettingAPI is a set of methods for setup and interaction with betting. The interface is as follows:
1 2 3 4 5 6 7 |
|
BettingAPI methods are as follows:
Method | Description | Type |
---|---|---|
init | Initiates the process of betting's rendering | () => void |
registerCallbacks | Method for registering betting callbacks | (callbacks: BettingCallbacks): void |
selectOddFormat | Changes odd format | (oddFormat: OddFormat) => void |
updateThemeConfig | Method for customizing the theme | (themeConfig: Partial<ThemeConfig>) => void |
setLocale | Change locale for static text | (locale: Locale => Promise<void> |
Betting callbacks
Betting callbacks are used to customize the SPA behavior.
1 2 3 4 |
|
The available callbacks are as follows:
Method | Description | Type |
---|---|---|
getBannersByIDs | The Function of retrieving banners by identifiers | (bannerIds: string[]) => Promise<BannerInfo[]> |
getErrorTitle | The Function of getting custom error message by error code | (errorCode: string) => string |
Banner info
BannerInfo is an object that contains information about the banner.
1 2 3 4 5 6 7 8 9 |
|
Property | Description | Type | Required |
---|---|---|---|
id | Banner's unique identifier | string | yes |
imageHref | URL of the page to which a user will go after clicking on the banner's image | string | yes |
imageSrc | Path to the banner's image | string | yes |
title | Alt text of the banner's image | string | yes |
subtitle | The Subtitle of the banner's image content | string | no |
buttonText | Text on the button of the banner | string | yes |
buttonHref | URL of the page to which a user will go after clicking on a button | string | yes |
Routes
The next routes are available for bettingPath
endpoint (see Betting URL
):
Route | Description | Desktop | Mobile |
---|---|---|---|
/sports | Displays the main page with live/pre-match matches grouped by sport. They can be switched in the left menu, the default is live. Classic sports. | + | + |
/esports | Displays the main page with live/pre-match matches grouped by sport. They can be switched in the left menu, the default is live. Cyber sports. | + | + |
/sports/{sportSlug} | Displays a list of matches for the selected sport. Classic sports. | + | + |
/esports/{sportsSlug} | Displays a list of matches for the selected sport. Cyber sports. | + | + |
/sports/{sportSlug}/match/{matchSlug} | Displays all data about a given sport event. Classic sport. | + | + |
/esports/{sportSlug}/match/{matchSlug} | Displays all data about a given sport event. Cyber sports. | + | + |
/sports/{sportSlug}/tournament/{tournamentSlug} | Displays the list of matches of a given tournament. Classic sport. | + | + |
/esports/{sportSlug}/tournament/{tournamentSlug} | Displays the list of matches of a given tournament. Cyber sports. | + | + |
/freebets | Displays the list of freebets for an authorized player. | + | + |
Reach route supports two query variables:
sportEventStatusSlug
is used for filtering matches in both the categorizer and match list by sport event status. Supported values arelive
andprematch
.time
is used for filtering matches in both the categorizer and match list by event time. Represents the number of hours before the event starts. Supported values for this query parameter are0
,3
,6
,12
,24
,48
. Available forsportEventStatusSlug=prematch
only.
Setup example
Here is a minimal example of how to set up the SPA:
1 2 3 4 |
|
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 |
|
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 |
|