This is the repository for storing Notification frontend plugin. Intended to be used with the frontend-plugin-framework.
These plugins are intended to be used with Header component. Make sure to follow the instructions on the MFE's repository README for getting set up in a devstack.
Clone this repository into your main workspace folder.
Insert the following into the env.config.js
file of MFE. If you haven't created one, create one
in the root that includes the following:
// Imports from frontend-plugin-framework
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
// Import plugin components from the npm package import { Notifications, useAppNotifications } from '@edx/frontend-plugin-notifications';
// Component to render notifications const NotificationsComponent = () => {
const { notificationAppData } = useAppNotifications(); return notificationAppData?.showNotificationsTray
? <Notifications notificationAppData={notificationAppData} /> : '';
};
- const config = {
pluginSlots: {
// Add configuration for each notifications_slot. This is the ID for the <PluginSlot> component notifications_slot: {
- plugins: [
- {
op: PLUGIN_OPERATIONS.Insert, widget: {
id: 'notifications_tray', type: DIRECT_PLUGIN, RenderWidget: NotificationsComponent,
},
},
],
},
},
};
export default config;
To develop while using this plugin library, modify the module.config.js
file in the root of the MFE you are
developing in to reference the local version of the plugin.:
- module.exports = {
- localModules: [
// Add the below object to the localModules array {
moduleName: '@edx/frontend-plugin-notifications', dir: '../src/frontend-plugin-notifications', dist: 'dist'
},
],
}
The code in this repository is licensed under the AGPLv3 unless otherwise noted.
Please see LICENSE for details.
Before considering whether or not something belongs in this repository, use the plugins decision tree to see ensure it is the correct place.
Contact @edx/edx-infinity if you are having any trouble developing in this repository.
Please do not report security issues in public. Email security@edx.org instead.