ccb2e74bc1
* [data-channel-analytics-options] - Added data-channel analytics and record options and added a parameter options for the useDataChannel function * Update bigbluebutton-html5/public/locales/en.json Co-authored-by: Gustavo Trott <gustavo@trott.com.br> * [data-channel-analytics-options] -created new sendDataAnalytics for plugin and change presentation toolbar button * [data-channel-analytics-options] - QUICK FIX * [update-data-channel-function] - fix action metadata * [data-channel-analytics-options] - changes in review * [data-channel-analytics-options] - changes in review * [captionLocale] - Changes in review * [data-channel-analytics-options] - update SDK * [data-channel-analytics-options] Changes in review * [data-channel-analytics-options] - changes in review * [data-channel-analytics-options] - changes in review * [data-channel-analytics-options] - changes in review * Refactor learning dashboard json structure with genericData * fix typo * [data-channel-analytics-options] - changes according to new json structure * changes in review --------- Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com> Co-authored-by: Gustavo Trott <gustavo@trott.com.br>
44 lines
1.9 KiB
TypeScript
44 lines
1.9 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { LearningAnalyticsDashboardEventDetails } from 'bigbluebutton-html-plugin-sdk/dist/cjs/learning-analytics-dashboard/types';
|
|
import { LearningAnalyticsDashboardEvents } from 'bigbluebutton-html-plugin-sdk/dist/cjs/learning-analytics-dashboard/enums';
|
|
import { useMutation } from '@apollo/client';
|
|
import PLUGIN_LEARNING_ANALYTICS_DASHBOARD_SEND_GENERIC_DATA_MUTATION from './mutations';
|
|
import { PluginLearningAnalyticsDashboardManagerProps } from './types';
|
|
|
|
const PluginLearningAnalyticsDashboardManager: React.ElementType<
|
|
PluginLearningAnalyticsDashboardManagerProps> = ((
|
|
props: PluginLearningAnalyticsDashboardManagerProps,
|
|
) => {
|
|
const { pluginName } = props;
|
|
|
|
const [sendGenericDataToLearningAnalyticsDashboard] = useMutation(
|
|
PLUGIN_LEARNING_ANALYTICS_DASHBOARD_SEND_GENERIC_DATA_MUTATION,
|
|
);
|
|
|
|
const handleSendGenericDataForLearningAnalyticsDashboard: EventListener = (
|
|
(event: CustomEvent<LearningAnalyticsDashboardEventDetails>) => {
|
|
if (event.detail.pluginName === pluginName) {
|
|
const eventDetails = event.detail as LearningAnalyticsDashboardEventDetails;
|
|
sendGenericDataToLearningAnalyticsDashboard({
|
|
variables: {
|
|
pluginName: eventDetails.pluginName,
|
|
genericDataForLearningAnalyticsDashboard: eventDetails.data,
|
|
},
|
|
});
|
|
}
|
|
}) as EventListener;
|
|
|
|
useEffect(() => {
|
|
window.addEventListener(
|
|
LearningAnalyticsDashboardEvents.GENERIC_DATA_SENT, handleSendGenericDataForLearningAnalyticsDashboard,
|
|
);
|
|
return () => {
|
|
window.removeEventListener(
|
|
LearningAnalyticsDashboardEvents.GENERIC_DATA_SENT, handleSendGenericDataForLearningAnalyticsDashboard,
|
|
);
|
|
};
|
|
}, []);
|
|
}) as React.ElementType<PluginLearningAnalyticsDashboardManagerProps>;
|
|
|
|
export default PluginLearningAnalyticsDashboardManager;
|