This injectable service is also available as a singleton MJNotificationService.Instance globally within an Angular application/library process space. It is responsible for displaying notifications to the user and also is able to manage the User Notifications entity in the database.

Constructors

Properties

notificationService: NotificationService
tabChange: Subject<unknown> = ...
tabChange$: Observable<unknown> = ...
_loaded: boolean = false
_notifications$: BehaviorSubject<UserNotificationEntity[]> = ...
_unreadCount$: BehaviorSubject<number> = ...
_userNotifications: UserNotificationEntity[] = []
isLoading$: BehaviorSubject<boolean> = ...

Accessors

  • get UnreadCount$(): Observable<number>
  • Observable that emits the unread notification count whenever it changes

    Returns Observable<number>

Methods

  • Creates a user notification in the database and refreshes the UI. Returns the notification object.

    Parameters

    • title: string
    • message: string
    • resourceTypeId: null | string
    • resourceRecordId: null | string
    • resourceConfiguration: any

      Any object, it is converted to a string by JSON.stringify and stored in the database

    • displayToUser: boolean = true

    Returns Promise<UserNotificationEntity>

  • Creates a message that is not saved to the User Notifications table, but is displayed to the user.

    Parameters

    • message: string

      text to display

    • style: "none" | "error" | "success" | "info" | "warning" = "success"

      display styling

    • Optional hideAfter: number

      option to auto hide after the specified delay in milliseconds

    Returns void

  • Refresh the User Notifications from the database. This is called automatically when the service is first loaded after login occurs. Uses UserInfoEngine for centralized data access with local caching.

    Returns Promise<void>

  • Update notification observables from existing in-memory data without doing a database query. This is efficient for cases where notifications have been modified locally (e.g., marking as read) and we just need to notify subscribers of the change.

    Returns void