0.2.2 • Published 1 year ago
@cartdotcom/notifications v0.2.2
Notifications
The Notifications Micro Front-end alerts users to important events, updates, or messages and provides information about changes outside the application.
Usage
The entry point of the component is a bell icon. Make sure you have a
<div>
with an idcartdotcom-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
).
When the script is loaded, a
initiateNotifications
function that will be made available on thewindow
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', }