@playkit-js/moderation 3.2.13 → 3.2.14
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playkit-js/moderation",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.14",
|
|
4
4
|
"main": "dist/playkit-moderation.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bugs": {
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@playkit-js/kaltura-player-js": "canary",
|
|
19
|
+
"@playkit-js/playkit-js-ui": "^0.77.3",
|
|
20
|
+
"@playkit-js/ui-managers": "1.4.3-canary.0-b33eab0",
|
|
19
21
|
"conventional-github-releaser": "3.1.3",
|
|
20
22
|
"cross-env": "^7.0.3",
|
|
21
23
|
"css-loader": "^6.7.1",
|
|
@@ -32,9 +34,7 @@
|
|
|
32
34
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
33
35
|
"webpack": "^5.72.1",
|
|
34
36
|
"webpack-cli": "^4.9.2",
|
|
35
|
-
"webpack-dev-server": "^4.9.0"
|
|
36
|
-
"@playkit-js/playkit-js-ui": "^0.77.3",
|
|
37
|
-
"@playkit-js/ui-managers": "1.4.3-canary.0-b33eab0"
|
|
37
|
+
"webpack-dev-server": "^4.9.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@playkit-js/kaltura-player-js": "canary"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"html5 player"
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@playkit-js/common": "^1.
|
|
80
|
+
"@playkit-js/common": "^1.5.3"
|
|
81
81
|
},
|
|
82
82
|
"kaltura": {
|
|
83
83
|
"name": "playkit-js-moderation",
|
|
@@ -133,30 +133,7 @@
|
|
|
133
133
|
color: white;
|
|
134
134
|
}
|
|
135
135
|
.submit-button {
|
|
136
|
-
|
|
137
|
-
border-radius: $roundness-1;
|
|
138
|
-
color: $primary-text-contrast-color;
|
|
139
|
-
text-align: center;
|
|
140
|
-
font-size: 14px;
|
|
141
|
-
font-weight: 700;
|
|
142
|
-
line-height: 17px;
|
|
143
|
-
background-color: $primary-color;
|
|
144
|
-
padding-left: 12px;
|
|
145
|
-
padding-right: 12px;
|
|
146
|
-
border: none;
|
|
147
|
-
outline: none !important; // overwrites player styles
|
|
148
|
-
cursor: pointer;
|
|
149
|
-
&.disabled {
|
|
150
|
-
background-color: rgba(0, 0, 0, 0);
|
|
151
|
-
padding-left: 11px;
|
|
152
|
-
padding-right: 11px;
|
|
153
|
-
color: $tone-4-color;
|
|
154
|
-
border: 1px solid $tone-4-color;
|
|
155
|
-
}
|
|
156
|
-
&:focus {
|
|
157
|
-
background-color: $primary-brighter-color;
|
|
158
|
-
box-shadow: 0px 0px 0px 1px $primary-color;
|
|
159
|
-
}
|
|
136
|
+
min-width: 64px;
|
|
160
137
|
}
|
|
161
138
|
:global(.playkit-tooltip) {
|
|
162
139
|
width: auto;
|
|
@@ -19,7 +19,7 @@ export interface ModerateOption {
|
|
|
19
19
|
|
|
20
20
|
interface ModerationProps {
|
|
21
21
|
onClick: OnClick;
|
|
22
|
-
onSubmit: (contentType: number, content: string, event: KeyboardEvent, byKeyboard:boolean
|
|
22
|
+
onSubmit: (contentType: number, content: string, event: KeyboardEvent, byKeyboard: boolean) => void;
|
|
23
23
|
reportLength: number;
|
|
24
24
|
moderateOptions: ModerateOption[];
|
|
25
25
|
subtitle: string;
|
|
@@ -42,14 +42,15 @@ interface ModerationState {
|
|
|
42
42
|
reportContent: string;
|
|
43
43
|
isTextareaActive: boolean;
|
|
44
44
|
open: boolean;
|
|
45
|
-
|
|
45
|
+
loading: boolean;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const initialState: ModerationState = {
|
|
49
49
|
reportContent: '',
|
|
50
50
|
reportContentType: -1,
|
|
51
51
|
isTextareaActive: false,
|
|
52
|
-
open: false
|
|
52
|
+
open: false,
|
|
53
|
+
loading: false
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
const translates = ({moderateOptions}: ModerationProps) => {
|
|
@@ -108,13 +109,12 @@ export class Moderation extends Component<MergedProps, ModerationState> {
|
|
|
108
109
|
|
|
109
110
|
private _handleSubmit = (event: any, bykeyboard: boolean) => {
|
|
110
111
|
event.preventDefault();
|
|
111
|
-
const {reportContent, reportContentType} = this.state;
|
|
112
|
-
if (reportContentType === -1) {
|
|
112
|
+
const {reportContent, reportContentType, loading} = this.state;
|
|
113
|
+
if (reportContentType === -1 || loading) {
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
|
-
this.
|
|
116
|
-
|
|
117
|
-
});
|
|
116
|
+
this.setState({loading: true});
|
|
117
|
+
this.props.onSubmit(reportContentType, reportContent, event, bykeyboard);
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
private _getPopoverMenuOptions = () => {
|
|
@@ -140,7 +140,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
|
|
|
140
140
|
|
|
141
141
|
render(props: MergedProps) {
|
|
142
142
|
const {playerSize = '', reportLength, subtitle, onClick} = props;
|
|
143
|
-
const {reportContent, reportContentType, isTextareaActive} = this.state;
|
|
143
|
+
const {reportContent, reportContentType, isTextareaActive, loading} = this.state;
|
|
144
144
|
if (playerSize === PLAYER_SIZE.TINY) {
|
|
145
145
|
return null;
|
|
146
146
|
}
|
|
@@ -189,8 +189,10 @@ export class Moderation extends Component<MergedProps, ModerationState> {
|
|
|
189
189
|
<Button
|
|
190
190
|
onClick={this._handleSubmit}
|
|
191
191
|
tooltip={{label: this.props.sendReportLabel!, className: styles.tooltip}}
|
|
192
|
+
className={styles.submitButton}
|
|
192
193
|
disabled={submitButtonDisabled}
|
|
193
194
|
ariaLabel={this.props.sendReportLabel}
|
|
195
|
+
loading={loading}
|
|
194
196
|
testId={'submitButton'}>
|
|
195
197
|
{this.props.sendReportLabel}
|
|
196
198
|
</Button>
|
|
@@ -63,8 +63,8 @@ export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
63
63
|
this._addPluginIcon();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
private _sentReport = (contentType: number, content: string, event: KeyboardEvent, byKeyboard:boolean
|
|
67
|
-
this.player.dispatchEvent(new FakeEvent(ModerationEvent.REPORT_SUBMITTED, {reportType: contentType}))
|
|
66
|
+
private _sentReport = (contentType: number, content: string, event: KeyboardEvent, byKeyboard: boolean) => {
|
|
67
|
+
this.player.dispatchEvent(new FakeEvent(ModerationEvent.REPORT_SUBMITTED, {reportType: contentType}));
|
|
68
68
|
const {sources} = this._player;
|
|
69
69
|
return this._player.provider
|
|
70
70
|
.doRequest([{loader: ReportLoader, params: {comments: content, flagType: contentType, flaggedEntryId: sources.id}}])
|
|
@@ -86,9 +86,6 @@ export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
86
86
|
if (this._wasPlayed) {
|
|
87
87
|
this._player.play();
|
|
88
88
|
}
|
|
89
|
-
if (callback) {
|
|
90
|
-
callback();
|
|
91
|
-
}
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
91
|
})
|
|
@@ -106,7 +103,7 @@ export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
106
103
|
})
|
|
107
104
|
.finally(() => {
|
|
108
105
|
this._toggleOverlay(event, byKeyboard);
|
|
109
|
-
})
|
|
106
|
+
});
|
|
110
107
|
};
|
|
111
108
|
|
|
112
109
|
private _displayToast = (options: {text: string; icon: ComponentChild; severity: ToastSeverity}): void => {
|
|
@@ -137,10 +134,10 @@ export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
137
134
|
this._player.play();
|
|
138
135
|
this._wasPlayed = false;
|
|
139
136
|
}
|
|
140
|
-
if(byKeyboard){
|
|
137
|
+
if (byKeyboard) {
|
|
141
138
|
// TODO: add focusElement to ts-typed
|
|
142
139
|
// @ts-ignore
|
|
143
|
-
KalturaPlayer.ui.utils.focusElement(this._pluginButtonRef, 100)
|
|
140
|
+
KalturaPlayer.ui.utils.focusElement(this._pluginButtonRef, 100);
|
|
144
141
|
}
|
|
145
142
|
return;
|
|
146
143
|
}
|
|
@@ -198,7 +195,7 @@ export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
198
195
|
this.player.ready().then(() => {
|
|
199
196
|
this._pluginIcon = this.upperBarManager!.add({
|
|
200
197
|
label: 'Moderation',
|
|
201
|
-
component: () => <PluginButton setRef={this._setPluginButtonRef}/>,
|
|
198
|
+
component: () => <PluginButton setRef={this._setPluginButtonRef} />,
|
|
202
199
|
svgIcon: {path: icons.PLUGIN_ICON, viewBox: `0 0 ${icons.BigSize} ${icons.BigSize}`},
|
|
203
200
|
onClick: this._toggleOverlay
|
|
204
201
|
}) as number;
|