For the widget to render you need to provide matchId and dataProviderConfig properties. In case you are using data adapter implementation you also need to set dataProvider property to 'custom'. Other properties are optional.
Parameters
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
props |
object |
<required> |
||
matchId |
string |
<required> |
Sportradar match ID. |
|
dataProviderConfig |
UOFDataProviderConfig Widgets.CustomBet.UOFProxy.UOFDataProviderConfig | DataAdapterProviderConfig Widgets.CustomBet.DataAdapter.DataAdapterProviderConfig |
<required> |
Configuration props for type of data ingestion of widget. UOF example here, Custom example here |
|
dataProvider |
string | uofProxy | Selection of the type of data provider you are going to use. Options are 'uofProxy' and 'custom' |
|
sportId |
string | Sport ID. If not provided it will over go calling match info to get sport id. |
||
buttonTitle |
string | Custom Bet | If set will the text on the CTA button. |
|
buttonIcon |
string | URL to a button icon image. |
||
productTitle |
string | If set, it will change the widgets title. |
||
validMarketIds |
array.<string> | If set, it will display only markets specified in the array, must be used on widget initialization, changed dynamically will reset the state of the widget. |
||
blockedMarketIds |
array.<string> | If set, it will hide markets and markets with specifiers defined in the array, must be used on widget initialization, changed dynamically will reset the state of the widget. Example: ["30", "18:total=5.5"] |
||
addToBetslipTimeoutMs |
integer | 10000 | Number in ms, that the widget will wait for the onAddToBetslip callback response before displaying a timeout/error. |
|
useSessionStorage |
string | false | Set if you want to 'remember' selections after closing and reopening widget. |
|
isInline |
string | false | Set to true if the widget will open inline and not as a popup. |
|
overlayWidth |
string | 720 | Width of the popup window. Default size is 720px. |
|
overlayParent |
string | Set if you want to specify the exact parent element where the popup will render. |
||
isDialogInFullScreen |
boolean | false | CustomBet widget overlay takes up full viewport width and height. |
|
hideBetAssist |
boolean | false | When set to |
|
useClientTheming |
string | false | When set to |
|
dbg |
string | false | Set to true to get some extra information on markets and outcomes, can be useful in development or debugging sessions. Mean to be used in development env. only. |
|
showExpandOnItems |
number | 3 | Number of outcomes that is shown in the bet builder before collapsing into 1 item. Is shown only on Mobile size |
|
minNumberOfSelections |
number | 1 | Minimum number of outcomes that needs to be added to the bet builder in order to toi be able to add to betslip |
|
selectedOutcomes |
Array.<UniqueOutcome> | Array of UniqueOutcome objects, that can be used to load selections into the bet builder. UniqueOutcome must have all required properties defined here, but no need for methods. |
||
mainMarkets |
array.<string> | An array of market IDs to display in the main category. If not specified, the default markets will be used. You can find all available markets for each sport here. |
||
categoryFeaturedItems |
Record.<categoryId, Array.<marketId>> | Custom configuration for featured items in each category (excluding the main category). It's an object where the category ID is the key and an array of market IDs is the value. List of categories with its market id's can be found here. For examples, refer to: here. |
||
disableCache |
boolean | false | Set to true to disable internal caching of provider response data. |
Widgets
Type Definitions
# AddToBetSlipHandleResult
Object to be passed into Widgets.CustomBet.CustomBet.addToBetSlip
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
succeeded |
boolean |
<required> |
True if outcomes were successfully validated and added to bet slip. |
reason |
string | Reason for failed action, if present it will be displayed in the widget. |
# CBError
Error object required to display correct error.
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
number |
|
||||||||||||
message |
string | Text that will be displayed for error, localization required. |
# CalculateArgs
Properties:
Name | Type | Description |
---|---|---|
matchId |
string | Sportradar match ID. |
selectedOutcomes |
Array.<UniqueOutcome> Array.<Widgets.CustomBet.CustomBet.UniqueOutcome> | Array of all the selected outcomes in the widget. |
# SRMarket
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string |
<required> |
Sportradar id for this market. |
specifiers |
string | For markets that have same id but different specficer. |
# Status
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
isActive |
boolean |
<required> |
|
message |
object | Optional message to be displayed as status. |
|
title |
string |
<required> |
Main text of status message. |
superscript |
string |
<required> |
Superscripted text of status message. |
hasIcon |
boolean |
<required> |
If true, it shows unavaiable icon before superscripted text. |
Example
{
isActive: false,
message: {
title: "What will be the score? 2 : 2",
superscript: "Can't combine with",
hasIcon: true
}
}
# addToBetSlip(args, callback)
This function is called when the user clicks "Add to bet slip" button. Here you receive selected outcomes and validate them befire adding them to your bet slip or reject them.
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
args |
Object |
<required> |
Object with data. |
matchId |
string |
<required> |
Match id of match that outcomes belong to. |
selectedOutcomes |
Array.<UniqueOutcome> Array.<Widgets.CustomBet.CustomBet.UniqueOutcome> |
<required> |
Array of outcomes that were selected in the widget. |
displayedOdds |
string | Snapshot of odds returned by last calculation, CAUTION: ODDS ARE NOT UP TO DATE |
|
callback |
AddToBetSlipHandleResult Widgets.CustomBet.CustomBet.AddToBetSlipHandleResult | boolean |
<required> |
To accept or reject call this function. If data is not received in time set by addToBetslipTimeoutMs widget prop or by defalt in 10000ms. |
Example
Upon succesfull validation your call callback parameter and pass in Widgets.CustomBet.CustomBet.AddToBetSlipHandleResult object.
function betslipCallback(args, callback) {
if (validation(args) is succesfull) {
callback(
{
succeeded: true
}
)
} else {
callback(
{
succeeded: false,
reason: 'Reason why it failed'
}
)
}
}