1.2.1 • Published 7 months ago
@opuscapita/notification-client v1.2.1
Notification-Client Library
Overview
The Notification-Client library is a React-based solution designed to deliver real-time notifications to users in a web application. It integrates with a WebSocket backend(live-notification) to provide instant updates and filters notifications dynamically based on user roles, associated business partners, and the currently active service within the application.
Key Features
- Real-Time Updates: Utilizes WebSocket technology for immediate delivery of notifications.
- Context-Aware Filtering:
- Filters notifications based on user roles, ensuring relevance to specific permissions.
- Matches notifications to the user's associated business partner.
- Adapts notifications to the currently displayed service.
- Integration: Serves as a wrapper around the main application.
Requirements
To function correctly, the library requires the following props to be passed:
userData.roles: An array of roles associated with the current user, which determines role-based filtering of notifications.userData.businesspartner: The business partner associated with the user, used for context-specific filtering.
<LiveNotificationContainer
userDataRoles={userData.roles}
userDataBusinessPartner={userData.businesspartner}
>These props allow the library to connect to the backend and filter notifications accurately based on the user context.
How It Works
- Backend Communication(live-notification): Connects to the WebSocket backend to receive live notifications.
- Dynamic Filtering: Filters notifications using user-specific data (
roles,businessPartner, and the activeservice) to ensure only relevant notifications are displayed. - Seamless Embedding: Acts as a container for a main application, wrapping its content and managing notifications without disrupting the user experience showing the notification at the top of the screen.