-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from GuiLeme/plugin-notification
feat(plugins): Notification API support for plugins
- Loading branch information
Showing
9 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { NotificationTypeUiCommand } from './notification/enums'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NotificationEnum } from './enums'; | ||
import { SendNotificationCommandArguments } from './types'; | ||
|
||
export const notification = { | ||
/** | ||
* Sends notification to be rendered in the front-end. | ||
*/ | ||
send: (information: SendNotificationCommandArguments) => { | ||
window.dispatchEvent( | ||
new CustomEvent< | ||
SendNotificationCommandArguments | ||
>(NotificationEnum.SEND, { | ||
detail: information, | ||
}), | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum NotificationEnum { | ||
SEND = 'SEND_NOTIFICATION', | ||
} | ||
|
||
export enum NotificationTypeUiCommand { | ||
INFO = 'info', | ||
DEFAULT = 'default', | ||
WARNING = 'warning', | ||
SUCCESS = 'success', | ||
ERROR = 'error' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NotificationTypeUiCommand } from './enums'; | ||
|
||
export interface SendNotificationCommandArgumentsOptions { | ||
helpLabel?: string, | ||
helpLink?: string, | ||
autoClose?: number, // Time, in milliseconds, to auto-close the notification | ||
} | ||
|
||
export interface SendNotificationCommandArguments { | ||
message: string; | ||
icon: string; | ||
type: NotificationTypeUiCommand; | ||
options?: SendNotificationCommandArgumentsOptions; | ||
content?: string; | ||
small?: boolean; | ||
} | ||
|
||
export interface UiCommandsNotificationObject { | ||
send: (information: SendNotificationCommandArguments) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters