This is an extension library that only has a peer dependency to piral-core
. What piral-notifications
brings to the table is a set of API extensions that can be used with piral
or piral-core
to show notifications triggered by pilets in your Piral instance.
Documentation
The following functions are brought to the Pilet API.
(tbd)
Setup and Bootstrapping
The provided library only brings API extensions for pilets to a Piral instance.
For the setup of the library itself you'll need to import createNotificationsApi
from the piral-notifications
package.
import { createNotificationsApi } from 'piral-notifications';
The integration looks like:
const instance = createInstance({
extendApi: [createNotificationsApi()],
});
Via the options the initially displayed messages
can be defined. Additionally, the defaultOptions
can be set up.
For example:
const instance = createInstance({
extendApi: [createNotificationsApi({
defaultOptions: {
type: 'warning',
},
messages: [
{
content: 'Welcome to the future of digital services!',
options: {
title: 'Hello!',
type: 'success',
},
},
],
})],
});
License
Piral is released using the MIT license. For more information see the license file.