Event Game Management
Welcome to Fans United Custom Event Game Management Widget. The widget allows staff members with sufficient permissions to create new games. You can use this widget as it is and embed it in your platform, or you can use the Management Panel to create games. Event Game is a game where users must predict outcomes of custom fixtures with flexible question types (boolean, numeric, enum, or free input). With successful installation, you can create and edit Event Games.
Installation and usage
The easiest way to use fansunited-widget-event is to install it from npm as follows:
npm install fansunited-widget-eventor:
yarn add fansunited-widget-eventHere is an example how you can integrate Fans United Event Game Management Widget:
import 'fansunited-widget-event/style.css';
import { EventGameManager } from 'fansunited-widget-event';
const App = () => {
return <EventGameManager fansUnitedApiKey={'your-api-key'} fansUnitedClientId={'your-client-id'} />;
};Notes
-
The widget is bundled as a React component and its usage is as simple as the above example
-
Don't worry about your project's CSS. The widget's styling is done with Joy UI which is based on headless unstyle react components. This means that the widget's CSS will NOT affect yours. One important thing is that you need to import
style.cssfile from package folder:
import 'fansunited-widget-event/style.css';
N.B: If you are using an entry point for importing all your stylings, you need to import fansunited-widget-event/style.css there as
well
- Easy translation in every language. For more information check our Translation heading.
Props
type EventGameManagerProps = {
fansUnitedApiKey: string;
fansUnitedClientId: string;
fansUnitedLanguage?: string;
fansUnitedEnvironment?: string;
sportal365Project?: string;
sportal365Infrastructure?: 'shared' | 'betway';
labels?: LabelsModel;
hideSignOutButton?: boolean;
};Fans United Event Game Management Widget depends on Fans United JS SDK and
Fans United Client API. Thats why fansUnitedApiKey and fansUnitedClientId are
required. They will be provided to you from Fans United team. For other optional props here is some information:
-
fansUnitedLanguage- for our sports APIs FansUnited platform supports different languages. For now they are Bulgarian (bg), English (en), Romanian (ro), Greek (el), Slovak (sk), Serbian (sr) and Hungarian (hu). If no value given it will be set to English (en). -
fansUnitedEnvironment- You can run the widget in the following environments: staging, production and watg. If no value given it will be set to production (prod). -
labels- you can easily translate all labels, UI messages, descriptions, placeholders and etc. with this prop. By default, Fans United Event Game Management Widget is available in English so if no value is given, the widget will be translated in English. -
sportal365Project- The Sportal365 project. Used as a request header when communicating with Sportal365 APIs. -
sportal365Infrastructure- The Sportal365 infrastructure. Used to determine what authorization should be used when communicating with Sportal365 APIs. If no value given (when sportal365Project props is provided) it will be set to shared . -
hideSignOutButton- The prop is used to hide the sign out button which is positioned on the top right corner on the main screen of the widget.
Translation
You can easily translate Fans United Event Game Management Widget in your language! You just need to pass an object to labels prop
with concrete keys and values and that's it! Here's an example how you can do it:
import 'fansunited-widget-event/style.css';
import { EventGameManager } from 'fansunited-widget-event';
const labels = {
userNotFound: 'User not found. Please try again.',
signOut: 'Sign out',
create: 'Create',
noGamesFound: "No games were found. You can create a game by clicking the button 'Create'",
status: 'Status',
statusDescription:
'Select the status of the game. When status is OPEN, fixture configuration (points, outcome type, valid outcomes) will be locked to prevent changes after users start making predictions.',
pending: 'Pending',
settled: 'Settled',
live: 'Live',
open: 'Open',
canceled: 'Canceled',
closed: 'Closed',
enableTiebreaker: 'Enable tiebreaker',
enableTiebreakerDescription: `When enabled the game's leaderboard will have a classic user ranking (1,2,3). In case of same points, the user who placed their predictions with tiebreaker closest to the game stat total will be placed further. When disabled and 2 or more people have the same points, the ranking will be 1,1,3,4,5,5,7,8.`,
totalStats: 'Total stats',
totalStatsDescription:
'Define the tiebreaker metric that users will predict to break ties in the leaderboard. This can be any measurable game statistic such as "Fastest lap time in seconds", "Total three-point field goals", "Combined score of both teams", etc. When users have equal points, their predicted value for this metric will be compared against the actual result, and the closest prediction will rank higher. This provides a flexible way to determine final rankings when multiple users achieve the same score.',
sortOrder: 'Sort order',
ascending: 'Ascending',
descending: 'Descending',
itemsPerPage: 'Items per page',
back: 'Back',
manageGameTitle: 'Manage Event Game',
manageGameDescription: 'Using this form, you can manage Event games.',
title: 'Title',
description: 'Description',
cutoffTime: 'Cutoff time',
configuration: 'Configuration',
id: 'ID',
points: 'Points',
customFields: 'Custom fields',
images: 'Images',
mainImage: 'Main',
coverImage: 'Cover',
mobileImage: 'Mobile',
uploadImage: 'Upload Image',
sportal365Images: 'Sportal365 Images',
search: 'Search',
searchImage: 'Search image',
hideFilters: 'Hide filters',
showFilters: 'Show filters',
hideMoreImages: 'Hide more images',
showMoreImages: 'Show more images',
addImages: 'Add images',
participants: 'Participants',
participantsDescription: 'Add participants to the game.',
additionalFields: 'Additional fields',
addParticipant: 'Add participant',
participantNumber: 'Participant number',
name: 'Name',
group: 'Group',
undecided: 'Undecided',
removeParticipant: 'Remove participant',
clearImage: 'Clear image',
copyUrl: 'Copy URL',
viewImage: 'View image',
cropImage: 'Crop image',
aspectRatio: 'Aspect ratio',
crop: 'Crop',
reset: 'Reset',
related: 'Related',
rules: 'Rules',
type: 'Type',
relationship: 'Relationship',
entity: 'Entity',
creationDate: 'Created at',
acceptUntil: 'Accept Until',
actions: 'Actions',
timeFormat: 'DD.MM.YYYY, HH:mm',
edit: 'Edit',
clone: 'Clone',
close: 'Close',
pageNo: 'Page No',
save: 'Save',
resolvePredictions: 'Resolve predictions',
keyDynamicFields: 'Key',
valueDynamicFields: 'Value',
add: 'Add',
delete: 'Delete',
cloneGameTitle: 'Clone Event Game',
fixtures: 'Fixtures',
fixturesDescription: 'Create prediction questions for your game. Configure points, outcome types, and valid outcomes.',
addMatch: 'Add Match',
tbd: 'TBD',
vs: 'vs',
selectParticipant: 'Select participant',
removeFixture: 'Remove fixture',
participantOne: 'Participant one',
scoreParticipantOne: 'Score participant one',
participantTwo: 'Participant two',
scoreParticipantTwo: 'Score participant two',
home: 'Home',
startDate: 'Start date',
winner: 'Winner',
draw: 'Draw',
showResult: 'Show result',
hideResult: 'Hide result',
question: 'Question',
voidReason: 'Void Reason',
outcomeType: 'Outcome Type',
addFixture: 'Add Fixture',
active: 'Active',
void: 'Void',
fixtureStatusDescription: `Select the fixture status. 'Void' will display a void reason.`,
booleanDescription: 'Yes/No',
numberDescription: 'Numeric',
enumDescription: 'Specific option choice from predefined ones',
freeInputDescription: 'Open text',
validOutcomes: 'Valid Outcomes',
validOutcomesDescription: 'Configure the valid outcomes for this fixture',
minValue: 'Minimum value',
maxValue: 'Maximum value',
minMaxValuesHelperText: 'Configure the minimum and maximum values for numeric answers',
enumOptions: 'Options',
addOption: 'Add option',
enterOption: 'Enter option and press Enter',
configureOutcome: 'Configure the correct outcome for this fixture',
outcomeLabel: 'Outcome',
yesOption: 'Yes',
noOption: 'No',
fixtureConfigurationLockedInfo:
'Fixture configuration is locked because the game status is OPEN. Only question, status fields and outcome can be edited.',
predictionsStartingToResolveInfoMessage:
'Predictions for game __gameTitle__ are starting to resolve. Keep in mind that this operation can take a while if there are thousands of predictions.',
resolvingPredictionsInProgressInfoMessage: 'Resolving game predictions is already in progress...',
resolvingPredictionsMessage:
'Predictions for game __gameTitle__ are successfully resolved! Total resolved predictions: __predictionsLength__',
urlCopiedToClipboardMessage: 'URL copied to clipboard',
imageDeletedMessage: 'Image deleted',
imageResetMessage: 'The initial size of the image has been restored',
uploadingImageMessage: 'You have successfully uploaded image',
generateSignedInUrlErrorMessage: 'There was a problem generating signed in URL to store the image in bucket. Please try again',
uploadingImageErrorMessage: 'There was a problem with uploading image to bucket. Please try again',
encryptingImageErrorMessage: 'There was a problem with encrypting image before uploading it to bucket. Please try again',
searchSportal365ImagesErrorMessage: 'There was a problem with searching images from Sportal 365 API. Please try again',
provideIdGameErrorMessage: 'You need to provide an ID to your game!',
provideTitleGameErrorMessage: 'You need to provide a title to your game!',
gamesErrorMessage: 'There was a problem retrieving information about the games.',
createGameMessage: 'You have successfully created a game.',
createGameErrorMessage: 'There was a problem with creating the game. Please try again.',
editGameMessage: 'You have successfully edited a game.',
editGameErrorMessage: 'There was a problem with editing the game. Please try again.',
requiredFieldValidationMessage: 'The following field is required: ',
cutoffValidationMessage: 'Cutoff time should be maximum 15 minutes before earliest fixture start date!',
fixturesValidationMessage: 'Fixture __fixtureNumber__: __propertyLabel__ is required!',
fixtureMinMaxValidationMessage: 'Fixture __fixtureNumber__: Minimum value must be less than maximum value!',
fixtureEnumOptionsValidationMessage: 'Fixture __fixtureNumber__: At least two options are required!',
relatedEntitiesErrorMessage: 'There was a problem with fetching entities for related. Please try again.',
};
const App = () => {
return <EventGameManager fansUnitedApiKey={'your-api-key'} fansUnitedClientId={'your-client-id'} labels={labels} />;
};Here is all information about LabelsModel:
| Key | Description | Default Value |
|---|---|---|
userNotFound | On login screen when client gives invalid information about email or password. | User not found. Please try again |
signOut | Used as label on sign out button. | Sign out |
create | Used as label on create button. | Create |
noGamesFound | When there are no created games for specific client, this message will appear on screen. | No games were found. You can create a game by clicking the button 'Create'. |
status | Label for status filter and status column. | Status |
statusDescription | Description for status select configuration. | Select the status of the game. When status is OPEN, fixture configuration (points, outcome type, valid outcomes) will be locked to prevent changes after users start making predictions. |
pending | Status option label. | Pending |
settled | Status option label. | Settled |
live | Status option label. | Live |
open | Status option label. | Open |
canceled | Status option label. | Canceled |
closed | Status option label. | Closed |
enableTiebreaker | Label for tiebreaker toggle switch. | Enable tiebreaker |
enableTiebreakerDescription | Description for tiebreaker toggle switch. | When enabled the game's leaderboard will have a classic user ranking (1,2,3). In case of same points, the user who placed their predictions with tiebreaker closest to the game stat total will be placed further. When disabled and 2 or more people have the same points, the ranking will be 1,1,3,4,5,5,7,8. |
totalStats | Label for total stats in tiebreaker configuration. | Total stats |
totalStatsDescription | Description for total stats in tiebreaker configuration. | Define the tiebreaker metric that users will predict to break ties in the leaderboard. This can be any measurable game statistic such as "Fastest lap time in seconds", "Total three-point field goals", "Combined score of both teams", etc. When users have equal points, their predicted value for this metric will be compared against the actual result, and the closest prediction will rank higher. This provides a flexible way to determine final rankings when multiple users achieve the same score. |
sortOrder | Label for sort order filter. | Sort order |
ascending | Sort order option label. | Ascending |
descending | Sort order option label. | Descending |
itemsPerPage | Label for items per page filter. | Items per page |
back | Label for back button (left arrow positioned on top-right corner). | Back |
manageGameTitle | Title on managing screen. | Manage Event Game |
manageGameDescription | Description on managing screen. | Using this form, you can manage Event games. |
title | Label for title column and input. | Title |
description | Label for description rich text input. | Description |
cutoffTime | Title for cutoff time input. | Cutoff time |
configuration | Label for configuration accordion. | Configuration |
id | Label for read only ID input. | ID |
points | Label for points number input. | Points |
customFields | Label for custom fields accordion. | Custom fields |
type | Label for type input in related relationship. | Type |
relationship | Label for relationship input in related relationship. | Relationship |
entity | Label for entity input in related relationship. | Entity |
images | Label for images accordion. | Images |
mainImage | Title for main image. | Main |
coverImage | Title for cover image. | Cover |
mobileImage | Title for mobile image. | Mobile |
uploadImage | Label for upload button in images accordion. | Upload Image |
sportal365Images | Label for sportal365 images button. | Sportal365 Images |
urlCopiedToClipboardMessage | Toast info message when image URL is copied. | URL copied to clipboard |
imageDeletedMessage | Toast info message when image is deleted. | Image deleted |
imageResetMessage | Toast info message when image size is restored. | The initial size of the image has been restored |
uploadingImageMessage | Toast success message when uploading image to bucket. | You have successfully uploaded image |
generateSignedInUrlErrorMessage | Toast error message when trying to receive a signed in URL. | There was a problem generating signed in URL to store the image in bucket. Please try again |
uploadingImageErrorMessage | Toast error message when uploading image to bucket. | There was a problem with uploading image to bucket. Please try again |
encryptingImageErrorMessage | Toast error message when encrypting image before uploading it to bucket. | There was a problem with encrypting image before uploading it to bucket. Please try again |
searchSportal365ImagesErrorMessage | Toast error message when searching images from Sportal 365 API. | There was a problem with searching images from Sportal 365 API. Please try again |
clearImage | Tooltip for clear image button. | Clear image |
copyUrl | Tooltip for copy url image button. | Copy URL |
viewImage | Tooltip for view image button. | View image |
cropImage | Tooltip for crop image button. | Crop image |
aspectRatio | Label for aspect ratio select. | Aspect ratio |
crop | Label for crop button. | Crop |
reset | Label for reset button. | Reset |
search | Label for search button. | Search |
searchImage | Placeholder for input search in sportal365. | Search image |
hideFilters | Label for hide filters for sportal365 images hyperlink. | Hide filters |
showFilters | Label for show filters for sportal365 images hyperlink. | Show filters |
hideMoreImages | Label for hide more images hyperlink. | Hide more images |
showMoreImages | Label for show more images hyperlink. | Show more images |
addImages | Label for additional fields. | Add images |
participants | Label for participants. | Participants |
participantsDescription | Description for participants tab. | Add participants to the game. |
additionalFields | Heading text for toggle actions on participants. | Additional fields |
addParticipant | Label for add participant button. | Add participant |
participantNumber | Placeholder text when no participant is fulfilled. | Participant number |
name | Label for name. | Name |
group | Label for group input. | Group |
undecided | Label for undecided toggle switch. | Undecided |
removeParticipant | Label for remove participant button. | Remove participant |
related | Label for related accordion. | Related |
rules | Label for rules accordion. | Rules |
creationDate | Label for creation date column. | Created at |
acceptUntil | Label for predictions cutoff time column. | Accept Until |
actions | Label for actions column. | Actions |
timeFormat | Time format for whole widget. Widgets uses dayjs as a date dependency. | DD.MM.YYYY, HH:mm |
edit | Label for edit action button. | Edit |
clone | Label for clone action button. | Clone |
close | Label for close action button. | Close |
pageNo | Label left of pagination buttons. | Page No |
save | Label for save management button. | Save |
resolvePredictions | Tooltip for resolving predictions button. | Resolve predictions |
keyDynamicFields | Label for key input in custom fields. | Key |
valueDynamicFields | Label for value input in custom fields. | Value |
add | Label for tooltip add button. | Add |
delete | Label for delete button. | Delete |
cloneGameTitle | Title on cloning modal. | Clone Event Game |
fixtures | Label for fixtures tab. | Fixtures |
fixturesDescription | Description in fixtures tab. | Create prediction questions for your game. Configure points, outcome types, and valid outcomes. |
addMatch | Label for add match button. | Add Match |
tbd | Label for TBD. | TBD |
vs | Label for versus. | vs |
selectParticipant | Label for option in select participant select when no name is available for participant. | Select participant |
removeFixture | Label for remove fixture button in fixtures. | Remove fixture |
participantOne | Label for participant one select in fixtures. | Participant one |
scoreParticipantOne | Label for participant one score in fixtures. | Score participant one |
participantTwo | Label for participant two select in fixtures. | Participant two |
scoreParticipantTwo | Label for participant two score in fixtures. | Score participant two |
home | Label for checkbox next to participants in fixtures. | Home |
startDate | Label for start date calendar input in fixtures. | Start date |
winner | Label for winner select in fixtures. | Winner |
draw | Label for option in winner select in fixtures. | Draw |
showResult | Label for toggle button in fixtures. | Show result |
hideResult | Label for toggle button in fixtures. | Hide result |
question | Label for question input in event game fixtures. | Question |
voidReason | Label for void reason input in event game fixtures. | Void Reason |
outcomeType | Label for outcome type select in event game fixtures. | Outcome Type |
addFixture | Label for add fixture button in event game fixtures. | Add Fixture |
active | Label for active status in event game fixtures. | Active |
void | Label for void status in event game fixtures. | Void |
fixtureStatusDescription | Description for fixture status select. | Select the fixture status. 'Void' will display a void reason. |
booleanDescription | Description for boolean outcome type. | Yes/No |
numberDescription | Description for number outcome type. | Numeric |
enumDescription | Description for enum outcome type. | Specific option choice from predefined ones |
freeInputDescription | Description for free input outcome type. | Open text |
validOutcomes | Label for valid outcomes section. | Valid Outcomes |
validOutcomesDescription | Description for valid outcomes section. | Configure the valid outcomes for this fixture |
minValue | Label for minimum value input. | Minimum value |
maxValue | Label for maximum value input. | Maximum value |
minMaxValuesHelperText | Helper text for min/max values. | Configure the minimum and maximum values for numeric answers |
enumOptions | Label for enum options. | Options |
addOption | Label for add option button. | Add option |
enterOption | Placeholder for enter option input. | Enter option and press Enter |
configureOutcome | Label for configure outcome toggle. | Configure the correct outcome for this fixture |
outcomeLabel | Label for outcome input. | Outcome |
yesOption | Label for yes option in boolean outcome. | Yes |
noOption | Label for no option in boolean outcome. | No |
fixtureConfigurationLockedInfo | Info message when fixture configuration is locked. | Fixture configuration is locked because the game status is OPEN. Only question, status fields and outcome can be edited. |
provideIdGameErrorMessage | Toast error message when no ID is provided when cloning a game. | You need to provide an ID to your game! |
provideTitleGameErrorMessage | Toast error message when no title is provided when cloning a game. | You need to provide a title to your game! |
gamesErrorMessage | Toast error message when request for fetching games fails. | There was a problem retrieving information about the games. |
createGameMessage | Toast success message when creating a game. | You have successfully created a game. |
createGameErrorMessage | Toast error message when creating a game fails. | There was a problem with creating the game. Please try again. |
editGameMessage | Toast success message when editing a game. | You have successfully edited a game. |
editGameErrorMessage | Toast error message when editing a game fails. | There was a problem with editing the game. Please try again. |
requiredFieldValidationMessage | Common error toast validation message when main required field is missing. | The following field is required: |
cutoffValidationMessage | Error toast validation message for cutoff time. | Cutoff time should be maximum 15 minutes before earliest fixture start date! |
fixturesValidationMessage | Error toast validation message for fixtures. fixtureNumber and propertyLabel are variables provided from the widget. | Fixture fixtureNumber: propertyLabel is required! |
fixtureMinMaxValidationMessage | Error toast validation message for NUMBER outcome type when minimum value is not less than maximum value. fixtureNumber is a variable provided from the widget. | Fixture fixtureNumber: Minimum value must be less than maximum value! |
fixtureEnumOptionsValidationMessage | Error toast validation message for ENUM outcome type when less than two options are provided. fixtureNumber is a variable provided from the widget. | Fixture fixtureNumber: At least two options are required! |
relatedEntitiesErrorMessage | Error toast message when request to fetch entities for related fails. | There was a problem with fetching entities for related. Please try again. |
predictionsStartingToResolveInfoMessage | Info toast message for resolving predictions per game. gameTitle is a variable provided from the widget. | Predictions for game gameTitle are starting to resolve. Keep in mind that this operation can take a while if there are thousands of predictions. |
resolvingPredictionsInProgressInfoMessage | Info toast message for resolving predictions in progress per game. | Resolving game predictions is already in progress... |
resolvingPredictionsMessage | Success toast message for resolving predictions per game. gameTitle and predictionsLength are variables provided from the widget. | Predictions for game gameTitle are successfully resolved! Total resolved predictions: predictionsLength |
Updated 10 days ago
