Top X management

Welcome to Fans United Top X Management Widget. The widget allows staff members with sufficient permissions to create new games/editions. You can use this widget as it is and embed it in your platform, or you can use the Management Panel to create games. Top X is a game where users must predict a specified number of correct scores for a prize. With successfull installiation, you can create and edit a Top X game or see the report about specific game.

Installation and usage

The easiest way to use fansunited-widget-top-x-management is to install it from npm as follows:

npm install fansunited-widget-top-x

or:

yarn add fansunited-widget-top-x

Here is an example how you can integrate Fans United Top X Management Widget:

import  'fansunited-widget-top-x/style.css';
import { TopXManager } from  'fansunited-widget-top-x';

const  App = () => {
return (
<TopXManager
	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 Tailwind CSS and all classes are prefixed to avoid collisions with your existing CSS. This means that the widget's CSS will NOT affect yours. One important thing is that you need to import style.css file from package folder:

import 'fansunited-widget-top-x/style.css';

N.B: If you are using an entry point for importing all your stylings, you need to import fansunited-widget-top-x/style.css there as well

Props

type TopXManagerProps = {
	fansUnitedApiKey: string;
	fansUnitedClientId: string;
	fansUnitedLanguage?: string;
	fansUnitedEnvironment?: string;
	labels?: LabelsModel;
	sportal365Project?: string;
	sportal365Infrastructure?: 'shared' | 'betway';
};

Fans United Top X 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) and Romanian (ro). 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 Match Quiz 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 .

Translation

You can easily translate Fans United Top X 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-top-x/style.css';
import { TopXManager } from  'fansunited-widget-top-x';

const labels = {
	userNotFound:  'User not found. Please try again.',
	clientConfigErrorMessage:  "There was a problem fetching client's configuration. Please check again your API key and client ID. For more information contact Fans United staff.",
	noGamesFound:  "No games were found. You can create a game by clicking the button 'Create game'",
	createEdition:  'Create game',
	signOut:  'Sign out',
	name:  'Name',
	status:  'Status',
	participants:  'Participants',
	creationDate:  'Created at',
	acceptUntil:  'Accept Until',
	actions:  'Actions',
	upcoming:  'Upcoming',
	inProgress:  'In progress',
	finished:  'Finished',
	pending:  'Pending',
	settled:  'Settled',
	live:  'Live',
	open:  'Open',
	canceled:  'Canceled',
	closed:  'Closed',
	edit:  'Edit',
	report:  'Report',
	timeFormat:  'DD-MM-YYYY, HH:mm',
	previous:  'Previous',
	next:  'Next',
	id: "ID",
	namePlaceholder:  'Please provide a name for your Top X edition.',
	description:  'Description',
	descriptionPlaceholder:  'Please describe your game.',
	matchSelection:  'Match selection',
	matchSelectionDescription:  'Select a number of matches to include in your game.',
	matchNumber:  'Match Number',
	selectTeamPlaceholder:  'Type your team...',
	selectTeamNoTeamFound:  'No Team Found',
	selectTeamNoMatchesFound:  'No matches were found',
	gameStatus:  'Game status',
	createGameStatusDescription:  'The provided choices are PENDING and OPEN. Keep in mind that if you choose OPEN you can NOT edit your game.',
	editGameStatusDescription:  'The provided choices are PENDING, OPEN and CANCELED. Keep in mind that if you choose OPEN you can NOT edit your game anymore and if you choose CANCELED the game will be canceled.',
	timeTiebreaker: 'Time tiebreaker',
	timeTiebreakerDescription: "When enabled the game's leaderboard will have a classic user ranking (1,2,3). In case of same points and golden goal, the user who placed their predictions eariler will be infront. When disabled the current game's leaderboard behavour is used - the golden goal tiebreaker is used and when 2 or more people have the same golden goal, the ranking will be 1,1,3,4,5,5,7,8.",
	enabled: 'Enabled',
	disabled: 'Disabled',
	rules:  'Rules',
	rulesDescription:  'Describe your rules for participating in the game.',
	adContent: 'Ad content',
	adContentDescription: 'Place your ad content in the game.',
	flags:  'Flags',
	flagsPlaceholder:  'Type your flag and hit enter',
	repeatedValueMessage:  'You have entered a repeated value. Please enter a different one.',
	images: "Images",
	mainImage: "Main",
	coverImage: "Cover",
	mobileImage: "Mobile",
	imagePlaceholder: "Paste your image as valid URL or as relative path",
	related: "Related",
	relatedDescription: "Choose which games or templates you wish to be related to this game.",
	games: "Games",
	gamesPlaceholder: "Select which games (TOP_X and MATCH_QUIZ) are related to this game",
	templates: "Templates",
	templatesPlaceholder: "Select which templates are related to this game",
	cutoffTime:  'Cutoff time',
	cutoffTimeDescriptionOnCreate:  'Predictions will be accepted until this time. If not provided it will be automatically generated 15 minutes from the first match played.',
	cutoffTimeDescriptionOnEdit:  "Predictions will be accepted until this time. Keep in mind that this field SHOUT NOT be empty.",
	addFixture:  'Add fixture',
	removeFixture:  'Remove fixture',
	back:  'Back',
	loadMore: "Load more",
	exportButton: "Export",
	reportFor:  'Report for',
	position:  'Position',
	points:  'Points',
	gameNotSettledMessage:  'Not all matches have been played and therefore no points awarded yet. Please come back after the matches finish to see the leaderboard.',
	csvModalTitle: 'Enter how many users should be exported',
	csvModalDescription: 'Download a .csv file with the first 100 number of users.',
	csvModalPlaceholder: 'Export the first X users...',
	cancel: 'Cancel',
	csvModalDownloadButton: 'Download as CSV file',
	csvModalValidationMessage: 'Input value has to be an integer number between 1 and 100',
	csvModalErrorMessage: "There was a problem with fetching game's report data",
	clear:  'Clear',
	loadingMessage:  'Loading...',
	createGameMessage:  'You have successfully created a game.',
	editGameMessage:  'You have successfully edited a game.',
	clearCutoffMessage:  'You have cleared your cutoff time.',
	minFixturesMessage:  'There is a requirement how many minimum fixtures you need to provide to create/update game and it is:',
	sameChosenMatchMessage:  'Some of selected matches are repeating',
	invalidCutoffTimeMessage:  'Some of the provided matches start before cutoff time. Please choose cutoff time that is before the earliest match kickoff time.',
	createGameErrorMessage:  'There was a problem with creating the game. Please try again.',
	editGameErrorMessage:  'There was a problem with editing the game. Please try again.',
	leaderboardErrorMessage:  'There was a problem with displaying leaderboard. Please try again.',
	gamePredictionsErrorMessage:  'There was a problem with getting predictions for users. Please try again.',
	manageWinners: 'Manage winners',
	winners: 'Winners',
	title: 'Title',
	addWinner: 'Add winner',
	removeWinner: 'Remove winner',
	winnersDescription: 'Describe the winners...',
	winner: 'Winner',
	winnerDescription: 'Select the winner of the game',
	insertWinners: 'Insert winners',
	insertWinnersDescription: 'Type information about each winner of the game.',
	note: 'Note',
	notePlaceholder: 'Provide some note for the winner...',
	tags: 'Tags',
	tagsPlaceholder: 'Provide tags for the winner...',
	save: 'Save',
	preview: 'Preview',
	gameWinnersErrorMessage: 'There was a problem with fetching information about game winners. Please try again.',
	createGameWinnersMessage: 'You have successfully created winners for the game.',
	createGameWinnersErrorMessage: 'There was a problem with creating winners for the game. Please try again.',
	editGameWinnersMessage: 'You have successfully edited winners for the game.',
	editGameWinnersErrorMessage: 'There was a problem with editing winners for the game. Please try again.',
	gameNoSetWinnersMessage: 'No winners are set for this game.',
	leaderboardNotAvailable: 'No leaderboard is available for this game.',
	positionAndWinnerRequiredMessage: 'Position and winner are required!',
	sameChosenWinnerMessage: 'You have selected same winners. Each winner has to be unique!',
	gameMarket: 'Game market',
	gameMarketDescription: `The available choices are CORRECT_SCORE and CORRECT_SCORE_ADVANCED. Keep in mind that you can edit the market option only when the game is in PENDING status.`,
	marketCorrectScore: 'Correct score',
	marketCorrectScoreAdvanced: 'Advanced correct score',
	relatedEntitiesErrorMessage: "There was a problem with fetching entities. Please try again.",
	labelsHeading: 'Labels',
	customFields: 'Custom fields',
	dynamicFieldsDescription: 'You can create your custom records for easier way to connect your game.',
	keyDynamicFields: 'Key',
	valueDynamicFields: 'Value',
	addRecord: 'Add record',
	dynamicFieldsKeysErrorMessage: 'Only lowercase letters, numbers and underscore are accepted as keys!',
	gameByIdErrorMessage: 'There was a problem retrieving full information about the game.',
	generateSignedInUrlErrorMessage: 'There was a problem generating signed in URL to store the image in bucket. Please try again',
	uploadingImageMessage: 'You have successfully uploaded image',
	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',
	searchImage: 'Search image',
	clearFromToFilterSportal365ImagesMessage: 'You have cleared from/to filter for Sportal365 search images',
	hideFilters: 'Hide filters',
	showFilters: 'Show filters',
	dateFromTo: 'Date from/to',
	dateFromToPlaceholder: 'Select Date...',
	noImagesFound: 'No images found'
};

const  App = () => {
return (
<TopXManager
	fansUnitedApiKey={'your-api-key'}
	fansUnitedClientId={'your-client-id'}
	labels={labels}/>
);
}

Here is all information about LabelsModel:

KeyDescriptionDefault Value
userNotFoundOn login screen when client gives invalid information about email or password.User not found. Please try again.
clientConfigErrorMessagereact-toastify error message when client is providing invalid value to fansUnitedApiKey or fansUnitedClientId prop.There was a problem fetching client's configuration. Please check again your API key and client ID. For more information contact Fans United staff.
noGamesFoundWhen 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 game'.
createEditionUsed as label on create button and as a title on screen when creating a game.Create game
signOutUsed as label on sign out button.Sign out
manageWinnersUsed as label in Winners screen heading.Manage winners
nameLabel for name of a gameName
statusDisplayed in header of list of games. Status of a gameStatus
participantsDisplayed in header of list of games. Count of users who have participated in the gameParticipants
creationDateDisplayed in header of list of games. Date of created game in same format as given for timeFormat propCreated at
acceptUntilDisplayed in header of list of games. Date of predictions cutoff in same format as given for timeFormat propAccept until
actionsDisplayed in header of list of games. Two icon buttons with different actions.Actions
upcomingStatus of match for fixtureUpcoming
inProgressStatus of match for fixtureIn progress
finishedStatus of match for fixtureFinished
pendingStatus for specific game.Pending
settledStatus for specific game.Settled
liveStatus for specific game.Live
openStatus for specific game.Open
canceledStatus for specific game.Canceled
closedStatus for specific game.Closed
editUsed as label on edit button, as a title on screen when editing a game and as a placeholder for icon button edit.Edit
reportPlaceholder for icon button report.Report
winnersPlaceholder for icon button winners.Winners
timeFormatTimeformat for displaying dates. Widgets uses dayjs as a date dependency.DD.MM.YYYY, HH:mm
previousLabel for pagination button.Previous
nextLabel for pagination button.Next
idLabel for ID read only input field.ID
namePlaceholderPlaceholder/desciption about input field for game name when creating/editing a game.Please provide a name for your Top X edition.
titleLabel in Winners screen headingTitle
descriptionTitle for desciption input field when creating/editing a game.Description
descriptionPlaceholderPlaceholder/desciption about input field for game description when creating/editing a game.Please describe your game.
matchSelectionTitle for match selection sectionMatch selection
matchSelectionDescriptionDescription about match selection sectionSelect a number of matches to include in your game.
matchNumberTitle when you are adding a fixtureMatch Number
selectTeamPlaceholderPlaceholder for option search input fieldType your team...
selectTeamNoTeamFoundWhen you insert a name of a team that does not support your competition scope given by your features in Client APINo Team Found
selectTeamNoMatchesFoundWhen you choose a team from your search result, but it next 5 matches does not support your competition scope given by your features in Client APINo matches were found
gameMarketTitle for choosing a game market.Game market
gameMarketDescriptionDescription about game market.The available choices are CORRECT_SCORE and CORRECT_SCORE_ADVANCED. Keep in mind that you can edit the market option only when the game is in PENDING status.
marketCorrectScoreLabel for market correct score.Correct score
marketCorrectScoreAdvancedLabel for market correct score advanced.Advanced correct score
gameStatusTitle for choosing a game status.Game status
createGameStatusDescriptionDescription about choosing a game status.This will be displayed when you CREATE a game!The provided choices are PENDING and OPEN. Keep in mind that if you choose OPEN you can NOT edit your game.
editGameStatusDescriptionDescription about choosing a game status.This will be displayed when you EDIT a game!The provided choices are PENDING, OPEN and CANCELED. Keep in mind that if you choose OPEN you can NOT edit your game anymore and if you choose CANCELED the game will be canceled.
timeTiebreakerTitle for choosing a time tiebreaker option.Time tiebreaker
timeTiebreakerDescriptionDescription for choosing a time tiebreaker option.When enabled the game's leaderboard will have a classic user ranking (1,2,3). In case of same points and golden goal, the user who placed their predictions eariler will be infront. When disabled the current game's leaderboard behavour is used - the golden goal tiebreaker is used and when 2 or more people have the same golden goal, the ranking will be 1,1,3,4,5,5,7,8.
enabledValue for enabled option for time tiebreaker.Enabled
disabledValue for disabled option for time tiebreaker.Disabled
rulesTitle for choosing game rules.Rules
rulesDescriptionDescription for choosing game rules.Describe your rules for participating in the game.
adContentTitle for game's ad content.Ad content
adContentDescriptionDescription for game's ad content.Place your ad content in the game.
flagsTitle for choosing game flags.Flags
flagsPlaceholderPlaceholder on input field for game flagsType your flag and hit enter
repeatedValueMessagereact-toastify warning message when client submits same flag.You have entered a repeated value. Please enter a different one.
imagesTitle for images container.Images
mainImageTitle for main image.Main
coverImageTitle for cover image.Cover
mobileImageTitle for mobile image.Mobile
imagePlaceholderPlaceholder for image inputs.Paste your image as valid URL or as relative path
relatedTitle for related container.Related
relatedDescriptionDescription for related container.Choose which games or templates you wish to be related to this game.
labelsHeadingTitle for labels container.Labels
customFieldsTitle for custom fields container.Custom fields
dynamicFieldsDescriptionDescription about labels and custom fields.You can create your custom records for easier way to connect your game.
keyDynamicFieldsLabel for key input.Key
valueDynamicFieldsLabel for value input.Value
addRecordTooltip for add button in labels and custom fields containers.Add record
gamesTitle for games select.Games
gamesPlaceholderPlaceholder for games select input.Select which games (TOP_X and MATCH_QUIZ) are related to this game
templatesTitle for templates select.Templates
templatesPlaceholderPlaceholder for templates select input.Select which templates are related to this game
cutoffTimeTitle for choosing a cutoff time for game.Cutoff time
cutoffTimeDescriptionOnCreateDescription about choosing a cutoff time for creating game.Predictions will be accepted until this time. If not provided it will be automatically generated 15 minutes from the first match played.
cutoffTimeDescriptionOnEditDescription about choosing a cutoff time for editing game.Predictions will be accepted until this time. Keep in mind that this field SHOUT NOT be empty.
scheduleOpenAtTitle for choosing a scheduler to open a game.Schedule open at
scheduleOpenAtDescriptionDescription about choosing a scheduler to open a game.When provided game's status will automatically set from PENDING to OPEN. Keep in mind that the latest time option is 75 minutes before first match kickoff.
editGameUsed as label on create button and as a title on screen when editing a game.Edit game
addFixtureLabel for add button. Add button is displayed when you have fixtures less than your maxFixtures provided by your features from Client APIAdd fixture
addWinnerLabel for add button. This add button is displayed on Winners screen.Add winner
removeFixtureLabel for remove button. Remove button is displayed always on your fixture.Remove fixture
removeFixtureLabel for remove button. Remove button is displayed on your winner.Remove winner
backTooltip content for back button (left arrow positioned on top-right corner). You can go back when you create/edit a game or when you visit report screen.Back
loadMoreLabel for Load More button. It is displayed when you choose the team for who you will be displayed next matches.Load More
reportForLabel positioned on top left side of the screen. Part of Report screen title.Report for
positionLabel in header's report tablePosition
pointsLabel in header's report tablePoints
winnersDescriptionDescription for winners descriptionDescribe the winners...
winnerTitle of card and label for the single winner inputWinner
winnerDescriptionDescription for the single winnerSelect the winner of the game
insertWinnersHeading for the single winner containerInsert winners
insertWinnersDescriptionDescription for the single winner containerType information about each winner of the game.
noteLabel for note inputNote
notePlaceholderPlaceholder for note inputProvide some note for the winner...
tagsLabel for tags inputTags
tagsPlaceholderPlaceholder for tags inputProvide tags for the winner...
saveLabel for save buttonSave
previewHeading for the preview containerPreview
gameNotSettledMessageModel message when client clicks on report button for game that is NOT settled.Not all matches have been played and therefore no points awarded yet. Please come back after the matches finish to see the leaderboard.
exportButtonLabel for button to open export modal screen on Report screen.Export
csvModalTitleTitle of the export modal.Enter how many users should be exported
csvModalDescriptionDescription of the export modal.Download a .csv file with the first 100 number of users.
csvModalPlaceholderPlaceholder for input on export modal.Export the first X users...
cancelLabel for cancel button to exit export modal.Cancel
csvModalDownloadButtonLabel for button to download report as CSV file. Keep in mind that this label is uppercase.Download as CSV file
csvModalValidationMessageError message when invalid value is provided in input.Input value has to be an integer number between 1 and 100
csvModalErrorMessageError message when exporting leaderboard as CSV file.There was a problem with fetching game's report data
clearTooltip for clearing button (circled X). Button clears current choosen game cuttof time.Clear
searchImageLabel for search image inputSearch image
hideFiltersLabel for hyperlink to hide filters for image searchHide filters
showFiltersLabel for hyperlink to show filters for image searchShow filters
dateFromToLabel for date from/to filter for image searchDate from/to
dateFromToPlaceholderPlaceholder for input date from/to filter for image searchSelect Date...
noImagesFoundParagraph whe no images were foundNo images found
loadingMessageWhen creating/editing a game label on button will be displayed as loading message.Loading...
createGameMessageWhen creating a game displaying a react-toastify successful message for created game.You have successfully created a game.
editGameMessageWhen editing a game displaying a react-toastify successful message for edited game.You have successfully edited a game.
clearCutoffMessageWhen clearing a cutoff time for a game displaying a react-toastify informational message for cleared input field about cutoff time for gameYou have cleared your cutoff time.
clearSchedulerMessageWhen clearing schedule open at for a game displaying a react-toastify informational message for cleared input field about schedule open at for gameYou have cleared your schedule open at.
minFixturesMessageWhen creating/editing a game displaying a react-toastify warning message about minimum fixtures.There is a requirement how many minimum fixtures you need to provide to create/update game and it is:
sameChosenMatchMessageWhen creating/editing a game displaying a react-toastify warning message about same chosen match for different fixtures.Some of selected matches are repeating
invalidCutoffTimeMessageWhen creating/editing a game displaying a react-toastify warning message about invalid cutoff time for game.Some of the provided matches start before cutoff time. Please choose cutoff time that is before the earliest match kickoff time.
fillCutoffTimeEditGameMessageWhen editing a game displaying a react-toastify warning message about unprovided cutoff time.You need to provide a cutoff time to update the game!
createGameErrorMessageWhen creating a game displaying a react-toastify error message.There was a problem with creating the game. Please try again.
editGameErrorMessageWhen editing a game displaying a react-toastify error message.There was a problem with editing the game. Please try again.
leaderboardErrorMessageWhen editing a game displaying a react-toastify error message.There was a problem with displaying leaderboard. Please try again.
gamePredictionsErrorMessageWhen editing a game displaying a react-toastify error message.There was a problem with getting predictions for users. Please try again.
leaderboardNotAvailableWhen setting winners for game and there is no leaderboard available. This is heading message that appears in winner container.No leaderboard is available for this game.
gameNoSetWinnersMessageWhen winners are set for the first time this message will appear in the preview block.No winners are set for this game.
positionAndWinnerRequiredMessageWhen managing winners for a game displaying a react-toastify validation error message.Position and winner are required!
sameChosenWinnerMessageWhen managing winners for a game displaying a react-toastify validation error message.You have selected same winners. Each winner has to be unique!
gameWinnersErrorMessageWhen fetching winners for a game displaying a react-toastify error message.There was a problem with fetching information about game winners. Please try again.
createGameWinnersMessageWhen creating winners for a game displaying a react-toastify success message.You have successfully created winners for the game.
createGameWinnersErrorMessageWhen creating winners for a game displaying a react-toastify error message.There was a problem with creating winners for the game. Please try again.
editGameWinnersMessageWhen editing winners for a game displaying a react-toastify success message.You have successfully edited winners for the game.
editGameWinnersErrorMessageWhen editing winners for a game displaying a react-toastify error message.There was a problem with editing winners for the game. Please try again.
relatedEntitiesErrorMessageWhen creating or editing a game displaying a react-toastify error message when the request fails for fetching related entities.There was a problem with fetching entities. Please try again.
dynamicFieldsKeysValidationMessageWarning react-toastify message when provided keys are invalid.Only lowercase letters, numbers and underscore are accepted as keys!
gameByIdErrorMessageWhen editing a game displaying a react-toastify error message when request fails for retrieving full information about the game.There was a problem retrieving full information about the game.
generateSignedInUrlErrorMessagereact-toastify 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
uploadingImageMessagereact-toastify success message when uploading image to bucketYou have successfully uploaded image
uploadingImageErrorMessagereact-toastify error message when uploading image to bucketThere was a problem with uploading image to bucket. Please try again
encryptingImageErrorMessagereact-toastify error message when encrypting image before uploading it to bucketThere was a problem with encrypting image before uploading it to bucket. Please try again
clearFromToFilterSportal365ImagesMessagereact-toastify info message when clearing date from/to filterYou have cleared from/to filter for Sportal365 search images
searchSportal365ImagesErrorMessagereact-toastify error message when searching images from Sportal 365 APIThere was a problem with searching images from Sportal 365 API. Please try again