Preference Manager
A Notification Preference Manager gives users power to control their notification preferences. They can choose which channels they want to receive notifications from each categories.
For creating a notification preference center we need to be able to,
- show the current preferences
- update the current preferences
For all these, we can use the usePreferences hook.
const { preferences, setPreferences } = usePreferences();
Another useful feature would be a hook for handling all webPush operations related to our preferences. No worries, we can utilize the useWebPush hook for this.
const { subscribe, webPushState } = useWebPush();
// webPushState type
type PermissionState = 'denied' | 'granted' | 'default';