@playkit-js/moderation 2.1.1 → 2.2.0-canary.2-223f8a4
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/CHANGELOG.md +7 -0
- package/LICENSE +5 -5
- package/README.md +105 -8
- package/dist/3758875b5327755db91c.svg +3 -0
- package/dist/4e88e84bb6cd6f386467.svg +9 -0
- package/{src/components/moderation/assets/down.svg → dist/699b282225ecacccffd9.svg} +2 -2
- package/dist/f4a8c73d84c247e719f8.svg +3 -0
- package/dist/playkit-moderation.js +1 -23
- package/dist/playkit-moderation.js.map +1 -1
- package/package.json +49 -54
- package/src/components/a11y-wrapper/a11y-wrapper.tsx +26 -0
- package/src/components/a11y-wrapper/index.ts +1 -0
- package/src/components/icons/index.ts +9 -0
- package/src/components/moderation/moderation.scss +25 -7
- package/src/components/moderation/moderation.tsx +64 -104
- package/src/components/plugin-button/plugin-button.scss +14 -14
- package/src/components/plugin-button/plugin-button.tsx +26 -3
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover-menu.scss +4 -0
- package/src/components/popover/popover-menu.tsx +57 -0
- package/src/components/popover/popover.scss +30 -0
- package/src/components/popover/popover.tsx +224 -0
- package/src/contrib-services/common-types.ts +2 -0
- package/src/contrib-services/contrib-services.ts +80 -0
- package/src/contrib-services/contrib-utils.ts +16 -0
- package/src/contrib-services/events-manager.ts +59 -0
- package/src/contrib-services/floating-item-data.tsx +31 -0
- package/src/contrib-services/floating-item.tsx +116 -0
- package/src/contrib-services/floating-manager.tsx +224 -0
- package/src/contrib-services/index.ts +2 -0
- package/src/contrib-services/injected-component/index.ts +1 -0
- package/src/contrib-services/injected-component/injected-component.scss +5 -0
- package/src/contrib-services/injected-component/injected-component.tsx +58 -0
- package/src/contrib-services/kaltura-player-utils.ts +18 -0
- package/src/contrib-services/managed-component/_managed-component.scss +8 -0
- package/src/contrib-services/managed-component/index.ts +1 -0
- package/src/contrib-services/managed-component/managed-component.tsx +71 -0
- package/src/contrib-services/object-utils.ts +157 -0
- package/src/contrib-services/player-contrib-registry.ts +34 -0
- package/src/contrib-services/player-utils.ts +37 -0
- package/src/contrib-services/preset-item-data.tsx +43 -0
- package/src/contrib-services/preset-item.tsx +113 -0
- package/src/contrib-services/preset-manager.tsx +153 -0
- package/src/contrib-services/presets-utils.ts +27 -0
- package/src/contrib-services/toast/_toast.scss +93 -0
- package/src/contrib-services/toast/assets/close.svg +9 -0
- package/src/contrib-services/toast/index.ts +1 -0
- package/src/contrib-services/toast/toast.tsx +67 -0
- package/src/contrib-services/toast-manager.tsx +121 -0
- package/src/contrib-services/toasts-container/_toasts-container.scss +21 -0
- package/src/contrib-services/toasts-container/index.ts +1 -0
- package/src/contrib-services/toasts-container/toasts-container.tsx +23 -0
- package/src/contrib-services/ui-player-adapter/index.tsx +1 -0
- package/src/contrib-services/ui-player-adapter/ui-player-adapter.tsx +27 -0
- package/src/contrib-services/uuid.ts +6 -0
- package/src/global.d.ts +6 -6
- package/src/index.ts +13 -1
- package/src/moderation-plugin.scss +12 -12
- package/src/moderation-plugin.tsx +123 -160
- package/src/providers/index.ts +2 -0
- package/src/providers/report-loader.ts +69 -0
- package/src/providers/response-types/index.ts +2 -0
- package/src/providers/response-types/kaltura-moderation-flag-response.ts +13 -0
- package/src/providers/response-types/kaltura-moderation-flag.ts +51 -0
- package/src/variables.scss +4 -1
- package/src/assets/.gitkeep +0 -0
- package/src/assets/close.svg +0 -10
- package/src/assets/flag.svg +0 -6
- package/src/components/.gitkeep +0 -0
package/src/index.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {ModerationPlugin} from './moderation-plugin';
|
|
2
|
+
|
|
3
|
+
declare var __VERSION__: string;
|
|
4
|
+
declare var __NAME__: string;
|
|
5
|
+
|
|
6
|
+
const VERSION = __VERSION__;
|
|
7
|
+
const NAME = __NAME__;
|
|
8
|
+
|
|
9
|
+
export {ModerationPlugin as Plugin};
|
|
10
|
+
export {VERSION, NAME};
|
|
11
|
+
|
|
12
|
+
const pluginName: string = 'moderation';
|
|
13
|
+
KalturaPlayer.core.registerPlugin(pluginName, ModerationPlugin);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
.toast-icon {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
2
|
+
width: 16px;
|
|
3
|
+
height: 16px;
|
|
4
|
+
margin-right: 7px;
|
|
5
|
+
background-position: center;
|
|
6
|
+
background-repeat: no-repeat;
|
|
7
|
+
&.success {
|
|
8
|
+
background-image: url('./assets/report.svg');
|
|
9
|
+
}
|
|
10
|
+
&.error {
|
|
11
|
+
background-image: url('./assets/error.svg');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
import {h, ComponentChild} from 'preact';
|
|
2
|
-
import {
|
|
3
|
-
ContribPluginManager,
|
|
4
|
-
CorePlugin,
|
|
5
|
-
OnMediaLoad,
|
|
6
|
-
OnMediaUnload,
|
|
7
|
-
OnPluginSetup,
|
|
8
|
-
ContribServices,
|
|
9
|
-
ContribPluginData,
|
|
10
|
-
ContribPluginConfigs,
|
|
11
|
-
} from '@playkit-js-contrib/plugin';
|
|
12
|
-
import {
|
|
13
|
-
UpperBarItem,
|
|
14
|
-
OverlayItem,
|
|
15
|
-
OverlayPositions,
|
|
16
|
-
ToastSeverity,
|
|
17
|
-
} from '@playkit-js-contrib/ui';
|
|
18
|
-
import {getContribLogger} from '@playkit-js-contrib/common';
|
|
19
|
-
import {KalturaModerationFlagType} from 'kaltura-typescript-client/api/types/KalturaModerationFlagType';
|
|
20
|
-
import {BaseEntryFlagAction} from 'kaltura-typescript-client/api/types/BaseEntryFlagAction';
|
|
21
|
-
import {KalturaClient} from 'kaltura-typescript-client';
|
|
22
|
-
import {KalturaModerationFlag} from 'kaltura-typescript-client/api/types/KalturaModerationFlag';
|
|
2
|
+
import {ToastSeverity} from './contrib-services/toast-manager';
|
|
23
3
|
import {Moderation, ModerateOption} from './components/moderation';
|
|
24
4
|
import {PluginButton} from './components/plugin-button';
|
|
25
5
|
import * as styles from './moderation-plugin.scss';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
module: 'moderation-plugin',
|
|
32
|
-
});
|
|
6
|
+
import {ui} from 'kaltura-player-js';
|
|
7
|
+
import {ContribServices} from './contrib-services';
|
|
8
|
+
import {OnClickEvent} from './components/a11y-wrapper';
|
|
9
|
+
import {ReportLoader, KalturaModerationFlag} from './providers';
|
|
10
|
+
const {ReservedPresetAreas, ReservedPresetNames} = ui;
|
|
33
11
|
|
|
34
12
|
interface ModerationPluginConfig {
|
|
35
13
|
reportLength: number;
|
|
@@ -41,139 +19,125 @@ interface ModerationPluginConfig {
|
|
|
41
19
|
tooltipMessage: string;
|
|
42
20
|
}
|
|
43
21
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
export class ModerationPlugin extends KalturaPlayer.core.BasePlugin {
|
|
24
|
+
static defaultConfig: ModerationPluginConfig = {
|
|
25
|
+
reportLength: 500,
|
|
26
|
+
onReportSentMessage: 'The report sent',
|
|
27
|
+
onReportErrorMessage: 'The report failed to send',
|
|
28
|
+
subtitle: '',
|
|
29
|
+
notificatonDuration: 5000,
|
|
30
|
+
tooltipMessage: 'Send report',
|
|
31
|
+
moderateOptions: [
|
|
32
|
+
{id: 1, label: 'Sexual Content'},
|
|
33
|
+
{id: 2, label: 'Violent Or Repulsive'},
|
|
34
|
+
{id: 3, label: 'Harmful Or Dangerous Act'},
|
|
35
|
+
{id: 4, label: 'Spam / Commercials'}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
60
38
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
private _moderationOverlay = null;
|
|
40
|
+
private _wasPlayed = false; // keep state of the player so we can resume if needed
|
|
41
|
+
private _removeActiveOverlay: null | Function = null;
|
|
42
|
+
private _removePluginIcon: null | Function = null;
|
|
43
|
+
private _contribServices: ContribServices;
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
45
|
+
constructor(name: string, private _player: KalturaPlayerTypes.Player, config: ModerationPluginConfig) {
|
|
46
|
+
super(name, _player, config);
|
|
47
|
+
this._contribServices = ContribServices.get({kalturaPlayer: _player});
|
|
69
48
|
}
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
logger.
|
|
73
|
-
method: '
|
|
50
|
+
loadMedia(): void {
|
|
51
|
+
this.logger.debug('Moderation plugin loaded', {
|
|
52
|
+
method: 'loadMedia'
|
|
74
53
|
});
|
|
75
54
|
this._addPluginIcon();
|
|
76
55
|
}
|
|
77
56
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
logger.trace('Moderation plugin unloaded', {
|
|
81
|
-
method: 'onMediaUnload',
|
|
82
|
-
});
|
|
83
|
-
this._moderationOverlay = null;
|
|
84
|
-
}
|
|
57
|
+
getUIComponents(): any[] {
|
|
58
|
+
return this._contribServices.presetManager.registerComponents();
|
|
85
59
|
}
|
|
86
60
|
|
|
87
|
-
private _sentReport = (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
text: onReportSentMessage,
|
|
112
|
-
icon: (
|
|
113
|
-
<div className={[styles.toastIcon, styles.success].join(' ')} />
|
|
114
|
-
),
|
|
115
|
-
severity: ToastSeverity.Success,
|
|
116
|
-
});
|
|
117
|
-
if (this._wasPlayed) {
|
|
118
|
-
this._player.play();
|
|
61
|
+
private _sentReport = (contentType: number, content: string, callback?: () => void) => {
|
|
62
|
+
const {onReportSentMessage, onReportErrorMessage} = this.config;
|
|
63
|
+
const {sources} = this._player;
|
|
64
|
+
return this._player.provider
|
|
65
|
+
.doRequest([{loader: ReportLoader, params: {comments: content, flagType: contentType, flaggedEntryId: sources.id}}])
|
|
66
|
+
.then((data: Map<string, any>) => {
|
|
67
|
+
if (data && data.has(ReportLoader.id)) {
|
|
68
|
+
const reportLoader = data.get(ReportLoader.id);
|
|
69
|
+
const moderationFlag: KalturaModerationFlag = reportLoader?.response?.moderationFlag;
|
|
70
|
+
if (moderationFlag) {
|
|
71
|
+
this.logger.debug('Moderation plugin submit OK');
|
|
72
|
+
this._toggleOverlay();
|
|
73
|
+
this._displayToast({
|
|
74
|
+
text: onReportSentMessage,
|
|
75
|
+
icon: <div className={[styles.toastIcon, styles.success].join(' ')} />,
|
|
76
|
+
severity: ToastSeverity.Success
|
|
77
|
+
});
|
|
78
|
+
if (this._wasPlayed) {
|
|
79
|
+
this._player.play();
|
|
80
|
+
}
|
|
81
|
+
if (callback) {
|
|
82
|
+
callback();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
119
85
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
error => {
|
|
125
|
-
logger.trace('Moderation plugin submit failed', {
|
|
126
|
-
method: 'handleSubmit',
|
|
127
|
-
data: error,
|
|
128
|
-
});
|
|
86
|
+
})
|
|
87
|
+
.catch((e: any) => {
|
|
88
|
+
this.logger.warn(e);
|
|
129
89
|
this._toggleOverlay();
|
|
130
90
|
this._displayToast({
|
|
131
91
|
text: onReportErrorMessage,
|
|
132
92
|
icon: <div className={[styles.toastIcon, styles.error].join(' ')} />,
|
|
133
|
-
severity: ToastSeverity.Error
|
|
93
|
+
severity: ToastSeverity.Error
|
|
134
94
|
});
|
|
135
|
-
}
|
|
136
|
-
);
|
|
95
|
+
});
|
|
137
96
|
};
|
|
138
97
|
|
|
139
|
-
private _displayToast = (options: {
|
|
140
|
-
|
|
141
|
-
icon: ComponentChild;
|
|
142
|
-
severity: ToastSeverity;
|
|
143
|
-
}): void => {
|
|
144
|
-
const {notificatonDuration} = this._configs.pluginConfig;
|
|
145
|
-
//display toast
|
|
98
|
+
private _displayToast = (options: {text: string; icon: ComponentChild; severity: ToastSeverity}): void => {
|
|
99
|
+
const {notificatonDuration} = this.config;
|
|
146
100
|
this._contribServices.toastManager.add({
|
|
147
101
|
title: 'Report Content',
|
|
148
102
|
text: options.text,
|
|
149
103
|
icon: options.icon,
|
|
150
104
|
duration: notificatonDuration,
|
|
151
|
-
severity:
|
|
105
|
+
severity: options.severity,
|
|
152
106
|
onClick: () => {
|
|
153
|
-
logger.
|
|
154
|
-
method: '_displayToast'
|
|
107
|
+
this.logger.debug(`Moderation clicked on toast`, {
|
|
108
|
+
method: '_displayToast'
|
|
155
109
|
});
|
|
156
|
-
}
|
|
110
|
+
}
|
|
157
111
|
});
|
|
158
112
|
};
|
|
159
113
|
|
|
160
|
-
private _toggleOverlay = (event?:
|
|
114
|
+
private _toggleOverlay = (event?: OnClickEvent, byKeyboard?: boolean) => {
|
|
115
|
+
if (this._removeActiveOverlay !== null) {
|
|
116
|
+
this._removeOverlay();
|
|
117
|
+
|
|
118
|
+
if (this._wasPlayed) {
|
|
119
|
+
this._player.play();
|
|
120
|
+
this._wasPlayed = false;
|
|
121
|
+
}
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
161
125
|
let closeButtonSelected = false;
|
|
162
|
-
if (
|
|
163
|
-
// triggered by keyboard
|
|
126
|
+
if (byKeyboard) {
|
|
164
127
|
closeButtonSelected = true;
|
|
165
128
|
}
|
|
166
|
-
const {reportLength, moderateOptions, subtitle, tooltipMessage} = this.
|
|
129
|
+
const {reportLength, moderateOptions, subtitle, tooltipMessage} = this.config;
|
|
167
130
|
const isPlaying = !(this._player as any).paused;
|
|
168
|
-
|
|
169
|
-
|
|
131
|
+
|
|
132
|
+
this.logger.debug(`Moderation toggle overlay player`, {
|
|
133
|
+
method: '_toggleOverlay'
|
|
170
134
|
});
|
|
135
|
+
|
|
171
136
|
if (this._moderationOverlay) {
|
|
172
|
-
this._contribServices.overlayManager.remove(this._moderationOverlay);
|
|
173
137
|
this._moderationOverlay = null;
|
|
174
138
|
if (this._wasPlayed) {
|
|
175
|
-
logger.
|
|
176
|
-
method: '_toggleOverlay'
|
|
139
|
+
this.logger.debug(`Moderation plugin paused player`, {
|
|
140
|
+
method: '_toggleOverlay'
|
|
177
141
|
});
|
|
178
142
|
this._wasPlayed = false;
|
|
179
143
|
this._player.play();
|
|
@@ -185,10 +149,11 @@ export class ModerationPlugin
|
|
|
185
149
|
this._player.pause();
|
|
186
150
|
}
|
|
187
151
|
|
|
188
|
-
this.
|
|
152
|
+
this._removeActiveOverlay = this._player.ui.addComponent({
|
|
189
153
|
label: 'moderation-overlay',
|
|
190
|
-
|
|
191
|
-
|
|
154
|
+
area: ReservedPresetAreas.PlayerArea,
|
|
155
|
+
presets: [ReservedPresetNames.Playback, ReservedPresetNames.Live],
|
|
156
|
+
get: () => (
|
|
192
157
|
<Moderation
|
|
193
158
|
onClick={this._toggleOverlay}
|
|
194
159
|
onSubmit={this._sentReport}
|
|
@@ -198,44 +163,42 @@ export class ModerationPlugin
|
|
|
198
163
|
moderateOptions={moderateOptions}
|
|
199
164
|
closeButtonSelected={closeButtonSelected}
|
|
200
165
|
/>
|
|
201
|
-
)
|
|
166
|
+
)
|
|
202
167
|
});
|
|
203
168
|
};
|
|
204
169
|
|
|
205
170
|
private _addPluginIcon(): void {
|
|
206
|
-
const {} = this.
|
|
207
|
-
this.
|
|
171
|
+
const {tooltipMessage} = this.config;
|
|
172
|
+
if (this._removePluginIcon) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this._removePluginIcon = this._player.ui.addComponent({
|
|
208
176
|
label: 'Moderation',
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
area: ReservedPresetAreas.TopBarRightControls,
|
|
178
|
+
presets: [ReservedPresetNames.Playback, ReservedPresetNames.Live],
|
|
179
|
+
get: () => <PluginButton onClick={this._toggleOverlay} label={tooltipMessage} />
|
|
211
180
|
});
|
|
212
181
|
}
|
|
213
|
-
}
|
|
214
182
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
defaultConfig: {
|
|
227
|
-
reportLength: 500,
|
|
228
|
-
onReportSentMessage: 'Send report',
|
|
229
|
-
onReportErrorMessage: 'The report failed to send',
|
|
230
|
-
subtitle: '',
|
|
231
|
-
notificatonDuration: 5000,
|
|
232
|
-
tooltipMessage: 'Send report',
|
|
233
|
-
moderateOptions: [
|
|
234
|
-
{id: 1, label: 'Sexual Content'},
|
|
235
|
-
{id: 2, label: 'Violent Or Repulsive'},
|
|
236
|
-
{id: 3, label: 'Harmful Or Dangerous Act'},
|
|
237
|
-
{id: 4, label: 'Spam / Commercials'},
|
|
238
|
-
],
|
|
239
|
-
},
|
|
183
|
+
private _removeOverlay = () => {
|
|
184
|
+
if (this._removeActiveOverlay) {
|
|
185
|
+
this._removeActiveOverlay();
|
|
186
|
+
this._removeActiveOverlay = null;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
static isValid(): boolean {
|
|
191
|
+
return true;
|
|
240
192
|
}
|
|
241
|
-
|
|
193
|
+
|
|
194
|
+
reset(): void {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
destroy(): void {
|
|
199
|
+
this._removeOverlay();
|
|
200
|
+
if (this._removePluginIcon) {
|
|
201
|
+
this._removePluginIcon();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import ILoader = KalturaPlayerTypes.ILoader;
|
|
2
|
+
import {KalturaModerationFlag, KalturaModerationFlagType, ObjectType, KalturaModerationFlagResponse} from './response-types';
|
|
3
|
+
const {RequestBuilder} = KalturaPlayer.providers;
|
|
4
|
+
|
|
5
|
+
interface ReportLoaderParams {
|
|
6
|
+
comments: string;
|
|
7
|
+
flagType: KalturaModerationFlagType;
|
|
8
|
+
flaggedEntryId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ReportResponse {
|
|
12
|
+
moderationFlag?: KalturaModerationFlag;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class ReportLoader implements ILoader {
|
|
16
|
+
_comments: string;
|
|
17
|
+
_flagType: KalturaModerationFlagType;
|
|
18
|
+
_flaggedEntryId: string;
|
|
19
|
+
_requests: typeof RequestBuilder[] = [];
|
|
20
|
+
_response: ReportResponse = {};
|
|
21
|
+
|
|
22
|
+
static get id(): string {
|
|
23
|
+
return 'report';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
constructor({comments, flagType, flaggedEntryId}: ReportLoaderParams) {
|
|
27
|
+
this._comments = comments;
|
|
28
|
+
this._flagType = flagType;
|
|
29
|
+
this._flaggedEntryId = flaggedEntryId;
|
|
30
|
+
|
|
31
|
+
const headers: Map<string, string> = new Map();
|
|
32
|
+
|
|
33
|
+
const moderationFlagRequest = new RequestBuilder(headers);
|
|
34
|
+
moderationFlagRequest.service = 'baseentry';
|
|
35
|
+
moderationFlagRequest.action = 'flag';
|
|
36
|
+
moderationFlagRequest.params = {
|
|
37
|
+
moderationFlag: {
|
|
38
|
+
comments: this._comments,
|
|
39
|
+
flagType: this._flagType,
|
|
40
|
+
flaggedEntryId: this._flaggedEntryId,
|
|
41
|
+
objectType: ObjectType.KalturaModerationFlag
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
this.requests.push(moderationFlagRequest);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set requests(requests: any[]) {
|
|
48
|
+
this._requests = requests;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get requests(): any[] {
|
|
52
|
+
return this._requests;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set response(response: any) {
|
|
56
|
+
const moderationFlagRequestResponse = new KalturaModerationFlagResponse(response[0]?.data);
|
|
57
|
+
if (moderationFlagRequestResponse) {
|
|
58
|
+
this._response.moderationFlag = moderationFlagRequestResponse?.data;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get response(): any {
|
|
63
|
+
return this._response;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
isValid(): boolean {
|
|
67
|
+
return Boolean(this._flagType && this._flaggedEntryId);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {KalturaModerationFlag} from './kaltura-moderation-flag';
|
|
2
|
+
const {BaseServiceResult} = KalturaPlayer.providers.ResponseTypes;
|
|
3
|
+
|
|
4
|
+
export class KalturaModerationFlagResponse extends BaseServiceResult {
|
|
5
|
+
data?: KalturaModerationFlag;
|
|
6
|
+
|
|
7
|
+
constructor(responseObj: any) {
|
|
8
|
+
super(responseObj);
|
|
9
|
+
if (!this.hasError && responseObj.id) {
|
|
10
|
+
this.data = new KalturaModerationFlag(responseObj);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export enum ObjectType {
|
|
2
|
+
KalturaModerationFlag = 'KalturaModerationFlag'
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export enum KalturaModerationFlagType {
|
|
6
|
+
SEXUAL_CONTENT = 1,
|
|
7
|
+
VIOLENT_REPULSIVE = 2,
|
|
8
|
+
HARMFUL_DANGEROUS = 3,
|
|
9
|
+
SPAM_COMMERCIALS = 4,
|
|
10
|
+
COPYRIGHT = 5,
|
|
11
|
+
TERMS_OF_USE_VIOLATION = 6
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum KalturaModerationObjectType {
|
|
15
|
+
ENTRY = 2,
|
|
16
|
+
USER = 3
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
enum KalturaModerationFlagStatus {
|
|
20
|
+
PENDING = 1,
|
|
21
|
+
MODERATED = 2
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface KalturaModerationFlagArgs {
|
|
25
|
+
comments: string;
|
|
26
|
+
objectType: ObjectType;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
updatedAt: number;
|
|
29
|
+
flagType: KalturaModerationFlagType;
|
|
30
|
+
flaggedEntryId: string;
|
|
31
|
+
id: number;
|
|
32
|
+
moderationObjectType: KalturaModerationObjectType;
|
|
33
|
+
partnerId: number;
|
|
34
|
+
status: KalturaModerationFlagStatus;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class KalturaModerationFlag {
|
|
38
|
+
comments: string;
|
|
39
|
+
objectType: ObjectType;
|
|
40
|
+
id: number;
|
|
41
|
+
status: KalturaModerationFlagStatus;
|
|
42
|
+
flagType: KalturaModerationFlagType;
|
|
43
|
+
|
|
44
|
+
constructor(moderationFlag: KalturaModerationFlagArgs) {
|
|
45
|
+
this.comments = moderationFlag.comments;
|
|
46
|
+
this.objectType = moderationFlag.objectType;
|
|
47
|
+
this.id = moderationFlag.id;
|
|
48
|
+
this.status = moderationFlag.status;
|
|
49
|
+
this.flagType = moderationFlag.flagType;
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/variables.scss
CHANGED
package/src/assets/.gitkeep
DELETED
|
File without changes
|
package/src/assets/close.svg
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<!-- Generator: Sketch 57.1 (83088) - https://sketch.com -->
|
|
4
|
-
<title>Icons/32/Close</title>
|
|
5
|
-
<desc>Created with Sketch.</desc>
|
|
6
|
-
<g id="Icons/32/Close" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
-
<rect id="Bounds" x="0" y="0" width="32" height="32"></rect>
|
|
8
|
-
<path d="M17.9113162,16 L24.6072325,9.30408374 C25.1313645,8.77995172 25.1287183,7.92687249 24.6009229,7.3990771 C24.0694478,6.86760201 23.220227,6.86845682 22.6959163,7.39276754 L16,14.0886838 L9.30408374,7.39276754 C8.77995172,6.86863552 7.92687249,6.8712817 7.3990771,7.3990771 C6.86760201,7.93055219 6.86845682,8.77977302 7.39276754,9.30408374 L14.0886838,16 L7.39276754,22.6959163 C6.86863552,23.2200483 6.8712817,24.0731275 7.3990771,24.6009229 C7.93055219,25.132398 8.77977302,25.1315432 9.30408374,24.6072325 L16,17.9113162 L22.6959163,24.6072325 C23.2200483,25.1313645 24.0731275,25.1287183 24.6009229,24.6009229 C25.132398,24.0694478 25.1315432,23.220227 24.6072325,22.6959163 L17.9113162,16 Z" id="Close" fill="rgba(255,255,255,0.8)"></path>
|
|
9
|
-
</g>
|
|
10
|
-
</svg>
|
package/src/assets/flag.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
2
|
-
<g fill="none" fill-rule="evenodd">
|
|
3
|
-
<path d="M0 0H32V32H0z"/>
|
|
4
|
-
<path fill="#FFF" d="M8.378 7.084l5.175 19.314c.134.497-.126 1.005-.594 1.19l-.112.037c-.533.143-1.08-.165-1.225-.71L6.447 7.603c-.134-.497.126-1.005.594-1.19l.112-.037c.533-.143 1.08.165 1.225.71zM21.882 7c1.878 0 2.79 1.622 1.84 3.239l-1.386 2.36 2.94 3.246C26.6 17.31 25.842 19 23.868 19h-10.21c-.452 0-.848-.304-.966-.741l-2.68-10c-.17-.635.31-1.259.967-1.259h10.902zm.211 1.994l-.21.006h-9.6l2.144 8h9.196l-3.263-3.604c-.293-.324-.342-.8-.12-1.178l1.757-2.992c.114-.194.168-.23.096-.232z" opacity=".8"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/src/components/.gitkeep
DELETED
|
File without changes
|