Skip to content

Releases: u4aew/react-pwa-push-notifications

1.0.0

08 Nov 21:04
Compare
Choose a tag to compare

New Features

  • Function urlBase64ToUint8Array: Added a function to convert a base64 string to a Uint8Array. 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 and PushManager.
    • Managing existing subscriptions.
    • Subscribing to notifications using a VAPID key.

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 to Uint8Array.
  • 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.