fansunited-widget-poll
v1.2.0
Published
Welcome to Fans United Poll Management Widget. The widget allows staff members with sufficient permissions to create, update and delete Polls. You can use this widget as it is and embed it in your platform, or you can use the Management Panel. With creati
Downloads
196
Readme
Poll Management Widget
Welcome to Fans United Poll Management Widget. The widget allows staff members with sufficient permissions to create, update and delete Polls. You can use this widget as it is and embed it in your platform, or you can use the Management Panel. With creating a poll, users can answer a single question and win prizes. With successful installation, you can create, edit and delete a poll.
Installation and usage
The easiest way to use fansunited-widget-poll-management is to install it from npm as follows:
npm install fansunited-widget-poll
or:
yarn add fansunited-widget-poll
Here is an example how you can integrate Fans United Poll Management Widget:
import 'fansunited-widget-poll/style.css';
import { PollManager } from 'fansunited-widget-poll';
const App = () => {
return (
<PollManager
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-poll/style.css';
N.B: If you are using an entry point for importing all your stylings, you need to import fansunited-widget-poll/style.css
there as well
- Easy translation in every language. For more information check our Translation heading.
Props
type PollManagerProps = {
fansUnitedApiKey: string;
fansUnitedClientId: string;
fansUnitedLanguage?: string;
fansUnitedEnvironment?: string;
sportal365Project?: string;
sportal365Infrastructure?: 'shared' | 'betway';
labels?: LabelsModel;
hideSignOutButton?: boolean;
};
Fans United Poll 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 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 .hideSignOutButton
- By default on the top left corner of the widget will be displayed a sign out button. To hide that button set this prop to true.
Translation
You can easily translate Fans United Poll 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-poll/style.css';
import { PollManager } from 'fansunited-widget-poll';
const labels = {
userNotFound: 'User not found. Please try again',
noPollsFound: "No polls games were found. You can create one by clicking the button 'Create'",
signOut: 'Sign out',
timeFormat: 'DD.MM.YYYY, HH:mm',
getPollsErrorMessage: 'There was a problem with fetching list of polls',
title: 'Title',
status: 'Status',
votes: 'Votes',
creationDate: 'Created at',
actions: 'Actions',
create: 'Create',
edit: 'Edit',
save: 'Save',
preview: 'Preview',
close: 'Close',
filterBy: 'Filter by:',
sortBy: 'Sort by:',
clearStatus: 'Clear status',
contextEntityTag: 'Context entity tag',
typeContextTagNamePlaceholder: 'Type context tag name...',
showMoreImages: 'Show more images',
hideMoreImages: 'Hide more images',
uploadImage: 'Upload image',
groupByStatus: 'Group by status',
copyUrl: 'Copy URL',
copied: 'Copied',
add: 'Add',
configuration: 'Configuration',
minimumVotes: 'Minimum votes',
minimumVotesPlaceholder: 'Enter the minimum votes for polls',
description: 'Description',
descriptionPlaceholder: 'Describe your poll',
images: 'Images',
rules: 'Rules',
rulesPlaceholder: 'Describe your rules for voting in the poll',
adContent: 'Ad content',
adContentPlaceholder: 'Place your ad content',
optionImages: 'Option images',
main: 'Main',
cover: 'Cover',
mobile: 'Mobile',
active: 'Active',
inactive: 'Inactive',
statusDescription: "When poll is Inactive, then users are not allowed to vote",
optionsDescription: 'Describe the options that users will select from the poll. Ensure to provide a minimum of 2 options. Title for each is required',
titlePlaceholder: 'Provide a title for your poll',
optionTitlePlaceholder: 'Type the title of the option',
optionDescriptionPlaceholder: 'Type the description of the option',
repeatedValueMessage: 'You have entered a repeated value. Please enter a different one',
flags: 'Flags',
flagsPlaceholder: 'Type your flag and hit enter',
labels: 'Labels',
customFields: 'Custom fields',
dynamicFieldsDescription: 'You can create your custom attributes for easier way to connect or describe your poll',
keyDynamicFields: 'Key',
valueDynamicFields: 'Value',
options: 'Options',
optionNumber: 'Option number',
context: 'Context',
content: 'Content',
tags: 'Tags',
entity: 'Entity',
campaign: 'Campaign',
id: 'ID',
idContentPlaceholder: 'Type the ID of your content',
idCampaignPlaceholder: 'Type the ID of your campaign',
label: 'Label',
labelContentPlaceholder: "Type the content's label",
labelCampaignPlaceholder: "Type the campaign's label",
type: 'Type',
typeDescription: 'Select the poll type. You can set the types in our Management Portal by going to Features, then clicking on the Poll page',
noType: "No type",
deleteLabel: 'Delete',
cancelLabel: 'Cancel',
confirmationQuestionLabel: 'Are you sure you want to delete',
typeContentPlaceholder: "Type the content's type",
previewPoll: 'Preview poll',
getFootballEntitiesErrorMessage: "There was a problem with fetching football's data",
createPollMessage: 'You have successfully created poll',
createPollErrorMessage: 'There was a problem creating poll. Please try again',
titleRequiredFieldValidationMessage: 'Title field is required!',
optionsFieldValidationMessage: "Options must have titles",
tagsInvalidFieldValidationMessage: 'Tag entity is required!',
getPollErrorMessage: 'There was a problem with fetching poll data. Please try again',
deletePollMessage: 'You have successfully deleted poll',
deletePollErrorMessage: 'There was a problem with deleting poll. Please try again',
updatePollMessage: 'You have successfully updated the poll',
updatePollErrorMessage: 'There was a problem updating the poll. Please try again',
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',
clear: 'Clear'
searchSportal365ImagesErrorMessage: 'There was a problem with searching images from Sportal 365 API. Please try again'
searchImages: 'Search images',
clearFromToFilterSportal365ImagesMessage: 'You have cleared from/to filter for Sportal365 search images',
hideFilters: 'Hide filters',
showFilters: 'Show filters',
dateFromTo: 'Date from/to',
dateFromToPlaceholder: 'Select Date...',
branding: 'Branding',
urls: 'URLs',
primaryUrl: 'Primary URL',
secondaryUrl: 'Secondary URL',
privacyPolicyUrl: 'Privacy Policy URL',
termsAndConditionsUrl: 'Terms and Conditions URL',
additionalUrl: 'Additional URL',
colors: 'Colors',
primaryColor: 'Primary Color',
secondaryColor: 'Secondary Color',
contentColor: 'Content Color',
backgroundColor: 'Background Color',
borderColor: 'Border Color',
additionalColor: 'Additional Color',
mainLogo: 'Main Logo',
mobileLogo: 'Mobile Logo',
backgroundImage: 'Background Image',
mobileBackgroundImage: 'Mobile Background Image',
additionalImage: 'Additional Image',
embedCode: 'Embed Code',
embedCodePlaceholder: 'Place your embed code here',
exportAllUsers: "Export all users",
usersExportMessage: "All users have been exported successfully",
usersExportErrorMessage: "There was a problem with exporting users. Please try again"
};
const App = () => {
return (
<PollManager
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 |
| noPollsFound
| When there are no created polls for specific client, this message will appear on screen. | No polls games were found. You can create one by clicking the button 'Create' |
| signOut
| Used as label on sign out button. | Sign out |
| getPollsErrorMessage
| react-toastify error message when request fails for fetching list of polls. | There was a problem with fetching list of polls |
| title
| Label for title | Title
| status
| Status of a poll | Status |
| votes
| Votes of a poll | Votes |
| creationDate
| Date of created poll in same format as given for timeFormat
prop | Created at |
| actions
| Two icon buttons with different actions | Actions |
| create
| Label for management header | Create |
| edit
| Label for management header | Edit |
| save
| Label for save button | Save |
| preview
| Label for preview button | Preview |
| close
| Label for close button | Close |
| filterBy
| Label for filters container on main screen | Filter by: |
| sortBy
| Label for sort container on main screen | Sort by: |
| clearStatus
| Label for clear status hyperlink for status filter | Clear status |
| contextEntityTag
| Label for input search for context entity tag in filters container | Context entity tag |
| typeContextTagNamePlaceholder
| Placeholder for input search for context entity tag in filters container and in context side bar | Type context tag name... |
| showMoreImages
| Label for hyperlink in images container | Show more images |
| hideMoreImages
| Label for hyperlink in images container | Hide more images |
| uploadImage
| Label next to upload button | Upload image |
| groupByStatus
| Label for checkbox in sort container | Group by status |
| copyUrl
| Label for copy url button | Copy URL |
| copied
| Label for copy url button | Copied |
| add
| Label for add button | Add |
| configuration
| Label for configuration accordion | Configuration |
| minimumVotes
| Label for minimum votes filter input | Minimum votes |
| minimumVotesPlaceholder
| Placeholder for minimum votes filter input | Enter the minimum votes for polls |
| titlePlaceholder
| Placeholder/description about title input field name on management screen. | Provide a title for your poll |
| timeFormat
| Timeformat for displaying dates. Widgets uses dayjs as a date dependency. | DD.MM.YYYY, HH:mm |
| previous
| Label for pagination button. | Previous |
| next
| Label for pagination button. | Next |
| id
| Label for ID read only input field. | ID |
| description
| Label for description input field on management screen. | Description |
| descriptionPlaceholder
| Placeholder/description about input field for poll description when creating/editing a poll. | Describe your poll |
| images
| Label for images container. | Images |
| rules
| Label for rules rich text. | Rules |
| rulesPlaceholder
| Placeholder for rules rich text. | Describe your rules for voting in the poll |
| adContent
| Label for AD content rich text. | Ad content |
| adContentPlaceholder
| Placeholder for AD content rich text. | Place your ad content |
| optionImages
| Label for option images container. | Option images |
| main
| Label for main image. | Main |
| cover
| Label for cover image. | Cover |
| mobile
| Label for mobile image. | Mobile |
| imagePlaceholder
| Placeholder for image inputs. | Paste your image as valid URL or as relative path |
| active
| Label for status. | Active |
| inactive
| Label for status. | Inactive |
| statusDescription
| Description for status select. | When poll is Inactive, then users are not allowed to vote |
| optionsDescription
| Description for options. | Describe the options that users will select from the poll. Ensure to provide a minimum of 2 options. Title for each is required |
| optionTitlePlaceholder
| Placeholder for option title input. | Type the title of the option |
| optionDescriptionPlaceholder
| Placeholder for option description input. | Type the description of the option |
| flags
| Label for choosing flags. | Flags |
| flagsPlaceholder
| Placeholder on input field for flags | Type your flag and hit enter |
| labels
| Label for labels container | Labels |
| customFields
| Label for custom fields container | Custom fields |
| dynamicFieldsDescription
| Description paragraph for labels and custom fields containers | You can create your custom attributes for easier way to connect or describe your poll |
| keyDynamicFields
| Label for key input | Key |
| valueDynamicFields
| Label for value input | Value |
| repeatedValueMessage
| react-toastify warning message when client submits same flag. | You have entered a repeated value. Please enter a different one |
| options
| Label for options. | Options |
| optionNumber
| Label for option container's header. | Option number |
| correct
| Label for correct radio button. | Correct |
| context
| Label for context container. | Context |
| content
| Label for context content container. | Content |
| tags
| Label for context tags container. | Tags |
| entity
| Label for entity search in tag. | Entity |
| campaign
| Label for context campaign container. | Campaign |
| id
| Label for ID. | ID |
| idContentPlaceholder
| Placeholder for ID content in context. | Type the ID of your content |
| idCampaignPlaceholder
| Placeholder for ID content in campaign. | Type the ID of your campaign |
| label
| Label for context content/campaign label input. | Label |
| labelContentPlaceholder
| Placeholder for label content in context. | Type the content's label |
| labelCampaignPlaceholder
| Placeholder for label content in campaign. | Type the campaign's label |
| type
| Label for context content type input. | Type |
| typeDescription
| Description paragraph for type select. | Select the poll type. You can set the types in our Management Portal by going to Features, then clicking on the Poll page |
| noType
| The default select option for poll type. | No type |
| deleteLabel
| Label for delete button in confirmation modal. | Delete |
| cancelLabel
| Label for cancel button in confirmation modal. | Cancel |
| confirmationQuestionLabel
| Paragraph in confirmation modal. | Are you sure you want to delete |
| typeContentPlaceholder
| Placeholder for type content in context. | Type the content's type |
| previewPoll
| Title in preview modal. | Preview poll |
| clear
| Label tippy clear button | Clear |
| searchImages
| Label for search image input | Search images |
| hideFilters
| Label for hyperlink to hide filters for image search | Hide filters |
| showFilters
| Label for hyperlink to show filters for image search | Show filters |
| dateFromTo
| Label for date from/to filter for image search | Date from/to |
| dateFromToPlaceholder
| Placeholder for input date from/to filter for image search | Select Date... |
| branding
| Label for branding container | Branding |
| urls
| Label for branding urls container | URLs |
| primaryUrl
| Label for branding primary url input | Primary URL |
| secondaryUrl
| Label for branding secondary url input | Secondary URL |
| privacyPolicyUrl
| Label for branding privacy policy url input | Privacy Policy URL |
| termsAndConditionsUrl
| Label for branding terms and conditions url input | Terms and Conditions URL |
| additionalUrl
| Label for branding additional url input | Additional URL |
| colors
| Label for branding colors container | Colors |
| primaryColor
| Label for branding primary color input | Primary Color |
| secondaryColor
| Label for branding secondary color input | Secondary Color |
| contentColor
| Label for branding content color input | Content Color |
| backgroundColor
| Label for branding background color input | Background Color |
| borderColor
| Label for branding border color input | Border Color |
| additionalColor
| Label for branding additional color input | Additional Color |
| mainLogo
| Label for branding main logo | Main Logo |
| mobileLogo
| Label for branding mobile logo | Mobile Logo |
| backgroundImage
| Label for branding background image | Background Image |
| mobileBackgroundImage
| Label for branding mobile background image | Mobile Background Image |
| additionalImage
| Label for branding additional image | Additional Image |
| embedCode
| Label for question embed code input | Embed Code |
| embedCodePlaceholder
| Placeholder for question embed code input | Place your embed code here |
| exportAllUsers
| Tooltip for exported users button | Export all users |
| usersExportMessage
| react-toastify successful message when exporting all users | All users have been exported successfully |
| usersExportErrorMessage
| react-toastify error message when exporting all users fails | There was a problem with exporting users. Please try again |
| getFootballEntitiesErrorMessage
| react-toastify error message when typing the name of the entity in tags and request fails. | There was a problem with fetching football's data |
| createPollMessage
| react-toastify successful message when creating poll | You have successfully created poll |
| createPollErrorMessage
| react-toastify error message when creating poll | There was a problem creating poll. Please try again |
| titleRequiredFieldValidationMessage
| react-toastify error message when validating title for poll | Title field is required! |
| optionsFieldValidationMessage
| react-toastify error message when validating options for poll | Options must have titles |
| tagsInvalidFieldValidationMessage
| react-toastify error message when validating tags for poll | Tag entity is required! |
| updatePollMessage
| react-toastify successful message when updating poll | You have successfully updated the poll |
| updatePollErrorMessage
| react-toastify error message when updating poll | There was a problem updating the poll. Please try again |
| deletePollMessage
| react-toastify successful message when deleting poll | You have successfully deleted poll |
| deletePollOrErrorMessage
| react-toastify error message when deleting poll | There was a problem with deleting poll. Please try again |
| uploadingImageMessage
| react-toastify success message when uploading image to bucket | You have successfully uploaded image |
| generateSignedInUrlErrorMessage
| react-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 |
| uploadingImageErrorMessage
| react-toastify error message when uploading image to bucket | There was a problem with uploading image to bucket. Please try again |
| encryptingImageErrorMessage
| react-toastify 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 |
| clearFromToFilterSportal365ImagesMessage
| react-toastify info message when clearing date from/to filter | You have cleared from/to filter for Sportal365 search images |
| searchSportal365ImagesErrorMessage
| react-toastify error message when searching images from Sportal 365 API | There was a problem with searching images from Sportal 365 API. Please try again |