0.2.2 • Published 1 year ago

@cartdotcom/notifications v0.2.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Notifications

The Notifications Micro Front-end alerts users to important events, updates, or messages and provides information about changes outside the application.

Usage

  1. The entry point of the component is a bell icon. Make sure you have a <div> with an id cartdotcom-notifications. That's where the application will be mounted.

    <div id="cartdotcom-notifications"></div>
2. Add a script tag to the Notifications bundle:

```html
<script defer src="https://unpkg.com/@cartdotcom/notifications@latest/bundle.js"></script>
  • Please make sure you add the defer attribute, as the script needs to wait for the DOM to be fully available.
  • You can replace @latest with any specific version (eg. 1.0.4).
  1. When the script is loaded, a initiateNotifications function that will be made available on the window object.

    This function expects an object as a parameter, which is related to the Auth0 settings for your client's authentication and authorization, and it contains the following structure:

    {
      clientId: string
      domain: string
      audience: string
    }

    Invoke the function passing the parameters (example):

    initiateNotifications({
      clientId: 'your-client-id',
      domain: 'your-tenant-name.auth0.com',
      audience: 'https://api.example.com',
    }