Skip to content

Releases: magicbell/magicbell-js

@magicbell/react-headless@4.5.4

18 Jun 14:55
154498c
Compare
Choose a tag to compare

Patch Changes

@magicbell/magicbell-react@10.11.4

18 Jun 14:55
154498c
Compare
Choose a tag to compare

Patch Changes

  • #292 95a4d26 Thanks @renovate! - Updated dependencies:

    • updated zustand to ^4.5.2.
  • Updated dependencies [95a4d26]:

    • @magicbell/react-headless@4.5.4

@magicbell/embeddable@3.3.23

18 Jun 14:55
154498c
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [95a4d26]:
    • @magicbell/magicbell-react@10.11.4

@magicbell/cli@3.5.0

18 Jun 14:55
154498c
Compare
Choose a tag to compare

Minor Changes

  • #296 fd91c86 Thanks @smeijer! - Move fields to query params for api get requests. This makes it just slightly easier to form urls for GET request when using the api escape hatch in our cli.

    mb api '/notifications' -f seen=false -X get -c user -r curl
    
    curl --url 'https://api.magicbell.com/notifications?seen=false' \
      --request 'GET' \
      --header 'accept: application/json' \
      --header 'accept-version: v2' \
      --header 'x-magicbell-api-key: 8cd...c70' \
      --header 'x-magicbell-user-email: stephan@example.com' \
      --header 'x-magicbell-user-hmac: uaZ...hU='

Patch Changes

  • #290 d6640b1 Thanks @smeijer! - only print error when no response body was printed

  • Updated dependencies [feb3dd6]:

    • magicbell@3.2.0

magicbell@3.1.4

24 May 11:27
d05dd1d
Compare
Choose a tag to compare

Patch Changes

@magicbell/webpush@2.0.1

24 May 13:06
408ddec
Compare
Choose a tag to compare

Patch Changes

@magicbell/webpush@2.0.0

24 May 11:27
d05dd1d
Compare
Choose a tag to compare

Major Changes

  • #283 7bea88f Thanks @smeijer! - BREAKING CHANGE!

    This is a complete revamp of how we're registering client push notification subscriptions, but given that the v1 API surface is small, migrating should be easy enough. You can find the migration guide on our site.

    The methods mentioned here are the breaking ones that you use when interacting with the browser directly. We've also added a bunch of functions to interact with the MagicBell API directly, leaving all browser interaction for you to implement. Think of use cases where you already have a service worker, and just want to push the channel tokens to our backend, or because you need to list all the currently active channel tokens so the user can unsubscribe from a device they no longer control.

    Please read more about those methods in the docs for @magicbell/webpush

    import { WebPushClient } from '@magicbell/webpush';
    
    const client = new WebPushClient({
      apiKey: '024…0bd',
      userEmail: 'person@example.com',
      userHmac: 'NCI…I6M',
    });
    
    await client.isSubscribed();
    await client.subscribe();
    await client.unsubscribe();

    Subscribe to push notifications:

    Subscribing to push notifications is now a single call on the client, instead of the two-step flow from v1.

    - import { getAuthToken, subscribe } from '@magicbell/webpush';
    + import { WebPushClient } from '@magicbell/webpush';
    
    - const token = await getAuthToken({
    + const client = new WebPushClient({
      apiKey: '024…0bd',
      userEmail: 'person@example.com',
      userHmac: 'NCI…I6M',
    });
    
    - await subscribe({
    -   token: token.token,
    -   project: token.project,
    - });
    
    + await client.subscribe();

    Unsubscribe from push notifications.

    This is a new method that didn't exist in previous versions. Unsubscribing and resubscribing is now trivial, giving your users the option to "pause" the push notifications.

    import { WebPushClient } from '@magicbell/webpush';
    
    const client = new WebPushClient({
      apiKey: '024…0bd',
      userEmail: 'person@example.com',
      userHmac: 'NCI…I6M',
    });
    
    await client.unsubscribe();

    Get subscription status

    Verifying subscription status is now a single call on the client, instead of the two-step flow from v1.

    - import { getAuthToken, isSubscribed } from '@magicbell/webpush';
    + import { WebPushClient } from '@magicbell/webpush';
    
    - const token = await getAuthToken({
    + const client = new WebPushClient({
      apiKey: '024…0bd',
      userEmail: 'person@example.com',
      userHmac: 'NCI…I6M',
    });
    
    - const subscribed = await isSubscribed({
    -   token: token.token,
    -   project: token.project,
    - });
    
    + const subscribed = await client.isSubscribed();

    Get authentication token

    The authentication token is no longer required for basic functionality, but can still be used to for example transfer the session to a popup.

    - import { getAuthToken } from '@magicbell/webpush';
    + import { WebPushClient } from '@magicbell/webpush';
    
    - const token = await getAuthToken({
    + const client = new WebPushClient({
      apiKey: '024…0bd',
      userEmail: 'person@example.com',
      userHmac: 'NCI…I6M',
    });
    
    + const token = await client.getAuthToken();

    API Methods

    We've added a bunch of useful methods to work with our api directly. Please read more about those methods in the docs for @magicbell/webpush.

@magicbell/react-headless@4.5.3

24 May 11:27
d05dd1d
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [c16e604]:
    • magicbell@3.1.4

@magicbell/magicbell-react@10.11.3

24 May 13:06
408ddec
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [2095743]:
    • @magicbell/webpush@2.0.1

@magicbell/magicbell-react@10.11.2

24 May 11:27
d05dd1d
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [7bea88f]:
    • @magicbell/webpush@2.0.0
    • @magicbell/react-headless@4.5.3