Type Definitions
# OnActionInterface
Defines the structure of an action object that can be dispatched in the application. Each action includes:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | number |
<required> |
A string literal from TriggerActionEnum signifying the kind of event (e.g., 'Close', 'Click', 'BetConciergeOutcome'). |
data |
string | Object | An optional payload that provides additional information needed to handle the action. This can be an object, string, or undefined if no extra data is needed. |
Example
// A complete switch-case example illustrating multiple action types:
onAction: function(action) {
switch (action.type) {
case 'Close': {
const { data } = action;
// ... implement logic to close the widget
break;
}
case 'Click': {
const { data } = action;
// ... implement logic for handling terms link or statistics link clicks
break;
}
case 'Error': {
const { data } = action;
// ... implement logic for handling widget errors
break;
}
case 'BetConciergeOutcome': {
const { data } = action;
// ... implement logic for handling clicks on AI market suggestions
break;
}
// ... add new cases here for other actions
default:
// Handle unknown or unanticipated action types
console.warn(`Unknown action type: ${action.type}`);
break;
}
}
# WidgetProps
Properties passed to the Bet Concierge widget, on initialization.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
matchId |
string | number |
<required> |
Sportradar ID of the match. |
jwt |
string |
<required> |
Users’s JWT Token for authentication. |
onAction |
function | OnActionInterface Widgets.BetConcierge.Integration.TechnicalGuide.OnActionInterface | Handles application-wide actions by routing them to the appropriate logic based on the action type. |
|
title |
string | Title of the widget - replaces 'Bet Concierge'. |
|
numberOfSuggestedQuestions |
range(0, 5) | Number of AI suggested questions in each category. |
|
disableChatHistory |
boolean | When set to |
|
enableCustomBet |
boolean | Set this prop to true when implementing Custom Bet feature. This will enable |
|
enableTerms |
boolean | Terms and conditions page is displayed on the widget load. When user clicks on |
|
enableTermsLink |
boolean | When set to |
|
disableStatsLink |
boolean | When set to |
|
disableHeader |
boolean | When set to |
Example
defaultProps = {
disableHeader: false,
disableStatsLink: false,
numberOfSuggestedQuestions: 3,
enableTermsLink: false,
enableTerms: false,
disableChatHistory: false,
enableCustomBet: false,
}