fansunited-widget-client-configuration 1.0.0-RC1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/components/Cards/ConfigWidgetCard.d.ts +3 -0
- package/components/Configuration.d.ts +3 -0
- package/components/Main.d.ts +12 -0
- package/components/MainLayout.d.ts +7 -0
- package/components/Tabs/Language.d.ts +8 -0
- package/configuration-manager.es.d.ts +2 -0
- package/configuration-manager.es.js +70972 -0
- package/configuration-manager.umd.js +2643 -0
- package/constants/constants.d.ts +20 -0
- package/context/LabelsContext.d.ts +8 -0
- package/hooks/useConstantContext.d.ts +2 -0
- package/index.d.ts +1 -0
- package/models/Labels/LabelsModel.d.ts +25 -0
- package/models/Labels/LanguageModel.d.ts +9 -0
- package/package.json +8 -0
- package/widget-starter-kit.css +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Configuration Management Widget
|
|
2
|
+
|
|
3
|
+
Welcome to Fans United Configuration Management Widget. The widget allows staff members with sufficient permissions to update their different configurations. You can use this widget as it is and embed it in your platform, or you can use the Management Panel to manage your configuration. With successful installation, you can manage your language, cache TTL and football assets configurations.
|
|
4
|
+
|
|
5
|
+
## Installation and usage
|
|
6
|
+
|
|
7
|
+
The easiest way to use fansunited-widget-client-configuration is to install it from npm as follows:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
npm install fansunited-widget-client-configuration
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
yarn add fansunited-widget-client-configuration
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Here is an example how you can **integrate** Fans United Classic Quiz Management Widget:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { ConfigurationManager } from 'fansunited-widget-client-configuration';
|
|
23
|
+
|
|
24
|
+
const App = () => {
|
|
25
|
+
return (
|
|
26
|
+
<ConfigurationManager
|
|
27
|
+
fansUnitedApiKey={'your-api-key'}
|
|
28
|
+
fansUnitedClientId={'your-client-id'} />
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
- The widget is bundled as a React component and its usage is as simple as the **above example**
|
|
36
|
+
|
|
37
|
+
- Don't worry about your project's CSS. The widget's styling is done with [Joy UI](https://mui.com/joy-ui/getting-started/) which is based on headless unstyle react components. This means that the widget's CSS will **NOT** affect yours.
|
|
38
|
+
|
|
39
|
+
- **Easy translation in every language.** For more information [check our Translation heading](#translation).
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
type ConfigurationManagerProps = {
|
|
45
|
+
fansUnitedApiKey: string;
|
|
46
|
+
fansUnitedClientId: string;
|
|
47
|
+
fansUnitedLanguage?: string;
|
|
48
|
+
fansUnitedEnvironment?: string;
|
|
49
|
+
labels?: LabelsModel;
|
|
50
|
+
hideSignOutButton?: boolean;
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Fans United Classic Quiz Management Widget depends on [Fans United JS SDK](https://docs.fansunitedmedia.com/sdks/js) and [Fans United Client API](https://docs.fansunitedmedia.com/apis/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:
|
|
55
|
+
|
|
56
|
+
- `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).
|
|
57
|
+
|
|
58
|
+
- `fansUnitedEnvironment` - You can run the widget in the following environments: **staging**, **production**, **watg** and **yolo**. If no value given it will be set to **production** (prod).
|
|
59
|
+
|
|
60
|
+
- `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.
|
|
61
|
+
|
|
62
|
+
- `hideSignOutButton` - By default on the top right corner of the widget will be displayed a sign out button. To hide that button set this prop to true.
|
|
63
|
+
|
|
64
|
+
## Translation
|
|
65
|
+
|
|
66
|
+
You can easily translate Fans United Configuration 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:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { ConfigurationManager } from 'fansunited-widget-client-configuration';
|
|
70
|
+
|
|
71
|
+
const labels = {
|
|
72
|
+
clientConfigErrorMessage: "There was a problem fetching client's configuration. Please try again",
|
|
73
|
+
userNotFound: 'User not found. Please try again',
|
|
74
|
+
language: 'Language',
|
|
75
|
+
cacheTTL: 'Cache TTL',
|
|
76
|
+
footballAssets: 'Football Assets',
|
|
77
|
+
soon: 'Soon',
|
|
78
|
+
update: 'Update Configuration',
|
|
79
|
+
configTitle: 'Configure Fans United',
|
|
80
|
+
configDescription: 'Customize different features of Fans United',
|
|
81
|
+
defaultLanguage: 'Default language',
|
|
82
|
+
defaultLanguageHelperText: 'What is the default language of your content? This field, if different from English, would be used in our translation tools.',
|
|
83
|
+
availableLanguages: 'Available languages',
|
|
84
|
+
availableLanguagesHelperText: 'In case your project is multi-lingual, select the available languages for your app.',
|
|
85
|
+
translationRules: 'Translation rules',
|
|
86
|
+
translationRulesHelperText: 'Select the default status when a game is automatically translated.',
|
|
87
|
+
gameStatus: 'Game status',
|
|
88
|
+
active: 'Active',
|
|
89
|
+
inactive: 'Inactive',
|
|
90
|
+
updateConfigMessage: 'You have successfully updated Language configuration',
|
|
91
|
+
updateConfigErrorMessage: 'There was a problem updating configuration. Please try again'
|
|
92
|
+
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const App = () => {
|
|
96
|
+
return (
|
|
97
|
+
<ClassicQuizManager
|
|
98
|
+
fansUnitedApiKey={'your-api-key'}
|
|
99
|
+
fansUnitedClientId={'your-client-id'}
|
|
100
|
+
labels={labels}/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Here is all information about **`LabelsModel`**:
|
|
106
|
+
|
|
107
|
+
| Key | Description | Default Value |
|
|
108
|
+
| :-------------: |:-------------:| :-----:|
|
|
109
|
+
| `clientConfigErrorMessage` | Toast error message when fetching client configuration fails. | There was a problem fetching client's configuration. Please try again |
|
|
110
|
+
| `userNotFound` | On login screen when client gives invalid information about email or password. | User not found. Please try again |
|
|
111
|
+
| `language` | Label for language tab. | Language |
|
|
112
|
+
| `cacheTTL` | Label for cache TTL tab. | Cache TTL |
|
|
113
|
+
| `footballAssets` | Label for football assets tab. | Football Assets |
|
|
114
|
+
| `soon` | Label for soon chip on tabs. | Soon |
|
|
115
|
+
| `update` | Label for management button. | Update Configuration |
|
|
116
|
+
| `configTitle` | Title of the management screen. | Configure Fans United |
|
|
117
|
+
| `configDescription` | Description of the management screen. | Customize different features of Fans United |
|
|
118
|
+
| `defaultLanguage` | Label for default language select. | Default language |
|
|
119
|
+
| `defaultLanguageHelperText` | Description for default language select. | What is the default language of your content? This field, if different from English, would be used in our translation tools. |
|
|
120
|
+
| `availableLanguages` | Label for available languages group container. | Available languages |
|
|
121
|
+
| `availableLanguagesHelperText` | Description for available languages container. | In case your project is multi-lingual, select the available languages for your app. |
|
|
122
|
+
| `translationRules` | Label for translation rules table. | Translation rules |
|
|
123
|
+
| `translationRulesHelperText` | Description for translation rules table. | Select the default status when a game is automatically translated. |
|
|
124
|
+
| `gameStatus` | Label for column in translation rules table. | Game status |
|
|
125
|
+
| `active` | Label for status option. | Active |
|
|
126
|
+
| `inactive` | Label for status option. | Inactive |
|
|
127
|
+
| `updateConfigMessage` | Toast success message when updating client configuration. | You have successfully updated Language configuration |
|
|
128
|
+
| `updateConfigErrorMessage` | Toast error message when updating client configuration fails. | There was a problem updating configuration. Please try again |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { default as LabelsModel } from '../models/Labels/LabelsModel';
|
|
3
|
+
type MainProps = {
|
|
4
|
+
fansUnitedApiKey: string;
|
|
5
|
+
fansUnitedClientId: string;
|
|
6
|
+
fansUnitedLanguage?: string;
|
|
7
|
+
fansUnitedEnvironment?: string;
|
|
8
|
+
labels?: LabelsModel;
|
|
9
|
+
hideSignOutButton?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const Main: React.FC<MainProps>;
|
|
12
|
+
export default Main;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LanguageModel } from '../../models/Labels/LanguageModel';
|
|
3
|
+
type LanguageProps = {
|
|
4
|
+
config: LanguageModel;
|
|
5
|
+
onChangeConfig: (languageConfig: LanguageModel) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const Language: React.FC<LanguageProps>;
|
|
8
|
+
export default Language;
|