@@ -4,8 +4,10 @@ import { v4 as uuid } from "uuid";
4
4
import { NotificationMetaDetailsWsEventNamesEnum } from "src/api" ;
5
5
import { Logger } from "src/core/logging" ;
6
6
7
+ import { dispatchEvent } from "../events" ;
7
8
import { NotificationEventsConstants } from "./constants/notification-events.constants" ;
8
- import { INotification } from "./types/notification.interface" ;
9
+ import { NotificationEvent } from "./notification.event" ;
10
+ import { INotification } from "./types" ;
9
11
10
12
const eventName = NotificationMetaDetailsWsEventNamesEnum . Notification ;
11
13
@@ -31,10 +33,10 @@ export class NotificationEventHandler {
31
33
NotificationEventsConstants ,
32
34
Record < string , Handler >
33
35
> = {
34
- [ NotificationEventsConstants . ADDED_TO_ORGANIZATION ] : { } ,
35
- [ NotificationEventsConstants . NEW_BLOG_POST ] : { } ,
36
- [ NotificationEventsConstants . NEW_BLOG_POST_COMMENT ] : { } ,
37
- [ NotificationEventsConstants . NEW_CHAT_MESSAGE ] : { } ,
36
+ [ NotificationEventsConstants . AddedToOrganization ] : { } ,
37
+ [ NotificationEventsConstants . NewBlogPost ] : { } ,
38
+ [ NotificationEventsConstants . NewBlogPostComment ] : { } ,
39
+ [ NotificationEventsConstants . NewChatMessage ] : { } ,
38
40
} ;
39
41
40
42
private readonly socket : Socket ;
@@ -79,10 +81,8 @@ export class NotificationEventHandler {
79
81
80
82
this . logger . trace ( "Received notification" , { notification } ) ;
81
83
82
- const event = new CustomEvent ( eventName , {
83
- detail : notification ,
84
- } ) ;
85
- document . dispatchEvent ( event ) ;
84
+ const event = new NotificationEvent ( notification ) ;
85
+ dispatchEvent ( event ) ;
86
86
87
87
let eventWasHandled = false ;
88
88
0 commit comments