Releases: u4aew/react-pwa-push-notifications
Releases · u4aew/react-pwa-push-notifications
1.0.0
New Features
-
Function
urlBase64ToUint8Array
: Added a function to convert a base64 string to aUint8Array
. This facilitates handling VAPID keys for web push notifications. -
Hook
useSubscribe
: Introduced a new hook for managing push notification subscriptions. It includes:- Checking support for
ServiceWorker
andPushManager
. - Managing existing subscriptions.
- Subscribing to notifications using a VAPID key.
- Checking support for
Improvements
- Error Handling: Added an
Errors
enumeration for centralized management of error codes related to push subscription issues.
Testing
- Tests for
urlBase64ToUint8Array
: Unit tests have been written to verify the correct conversion of base64 strings toUint8Array
. - Tests for
useSubscribe
: Added tests to cover various scenarios of using the hook, including error handling and successful subscriptions.
Fixes
- Improved state management and error handling in the
getSubscription
function.
Notes
- Jest is used for testing. Ensure all necessary dependencies are installed, including
@types/jest
.