Installation
Initialization
Enclose your app in SuprSendProvider like below and pass theworkspace key
, distinct_id
, and subscriber_id
.
SuprSend hooks can only be used inside of SuprSendProvider.
Adding SuprSend inbox component
1) useBell hook
This hook provides unSeenCount, markAllSeen which is related to the Bell icon in the inbox unSeenCount: Use this variable to show the unseen notification count anywhere in your application. markAllSeen: Used to mark seen for all notifications. Call this method on clicking the bell icon so that it will reset the bell count to 0.2) useNotifications hook
This hook provides a notifications list, unSeenCount, markClicked, markAllSeen. notifications: List of all notifications. This array can be looped and notifications can be displayed. unSeenCount: Use this variable to show the unseen notification count anywhere in your application. markClicked: Method used to mark a notification as clicked. Pass notification id which is clicked as the first param. markAllRead: This method is used to mark all individual notifications as seen. Add a button anywhere in your notification tray as Mark all as read and on clicking of that call this method.
mark all read sample
Notification object structure:
3) useEvent hook
This hook is an event emitter when and takes arguments event type and callback function when the event happens. Must be called anywhere inside SuprSendProvider Handled Events:- new_notification: Called when the new notification occurs can be used to show toast in your application.