@edusight/notification-widget 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/components/EmptyState.d.ts +7 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/NotificationBell.d.ts +8 -0
- package/dist/components/NotificationBell.d.ts.map +1 -0
- package/dist/components/NotificationCenter.d.ts +18 -0
- package/dist/components/NotificationCenter.d.ts.map +1 -0
- package/dist/components/NotificationGroup.d.ts +13 -0
- package/dist/components/NotificationGroup.d.ts.map +1 -0
- package/dist/components/NotificationItem.d.ts +10 -0
- package/dist/components/NotificationItem.d.ts.map +1 -0
- package/dist/components/NotificationList.d.ts +16 -0
- package/dist/components/NotificationList.d.ts.map +1 -0
- package/dist/components/Preferences.d.ts +10 -0
- package/dist/components/Preferences.d.ts.map +1 -0
- package/dist/hooks/useNotificationCenter.d.ts +22 -0
- package/dist/hooks/useNotificationCenter.d.ts.map +1 -0
- package/dist/hooks/useNotifications.d.ts +21 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/useWebSocket.d.ts +20 -0
- package/dist/hooks/useWebSocket.d.ts.map +1 -0
- package/dist/index.cjs.js +48 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +5038 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/interfaces/notification-client.interface.d.ts +3 -0
- package/dist/interfaces/notification-client.interface.d.ts.map +1 -0
- package/dist/notification-widget.css +1 -0
- package/dist/services/websocket-service.d.ts +35 -0
- package/dist/services/websocket-service.d.ts.map +1 -0
- package/dist/theme/notification-theme.d.ts +3 -0
- package/dist/theme/notification-theme.d.ts.map +1 -0
- package/package.json +100 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# EduSight Notification Widget
|
|
2
|
+
|
|
3
|
+
React notification center widget with Material UI styling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @edusight/notification-widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { NotificationCenter } from '@edusight/notification-widget';
|
|
15
|
+
import { NotificationClient } from '@edusight/notification-sdk';
|
|
16
|
+
|
|
17
|
+
const client = new NotificationClient({
|
|
18
|
+
apiKey: 'your-api-key',
|
|
19
|
+
baseUrl: 'https://api.example.com',
|
|
20
|
+
tenantId: 'your-tenant-id',
|
|
21
|
+
environmentId: 'dev',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<NotificationCenter
|
|
27
|
+
client={client}
|
|
28
|
+
tenantId="your-tenant-id"
|
|
29
|
+
environmentId="dev"
|
|
30
|
+
subscriberId="user-123"
|
|
31
|
+
position="top-right"
|
|
32
|
+
showUnreadBadge={true}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Real-time Updates**: WebSocket integration with automatic reconnection and acknowledgement persistence
|
|
41
|
+
- **Multi-environment**: Scoped connections using `environmentId` for each tenant
|
|
42
|
+
- **Notification Grouping**: Group by date (Today, Yesterday, This Week, etc.)
|
|
43
|
+
- **Preferences**: Channel and category preference management
|
|
44
|
+
- **Actions**: Mark as read, delete notifications
|
|
45
|
+
- **Filtering**: Filter by all/unread
|
|
46
|
+
- **Customizable**: Position, theme, max notifications
|
|
47
|
+
|
|
48
|
+
## Components
|
|
49
|
+
|
|
50
|
+
- `NotificationCenter` - Main notification center component
|
|
51
|
+
- `NotificationBell` - Bell icon with unread badge
|
|
52
|
+
- `NotificationList` - List of notifications with grouping
|
|
53
|
+
- `NotificationItem` - Individual notification item
|
|
54
|
+
- `Preferences` - Preference management component
|
|
55
|
+
|
|
56
|
+
## Props
|
|
57
|
+
|
|
58
|
+
### NotificationCenter
|
|
59
|
+
|
|
60
|
+
- `client`: NotificationClient instance
|
|
61
|
+
- `tenantId`: Tenant ID
|
|
62
|
+
- `environmentId`: Environment ID (e.g., `dev`, `staging`, `prod`)
|
|
63
|
+
- `subscriberId`: Subscriber ID
|
|
64
|
+
- `position?`: Position ('top-left' | 'top-right' | 'bottom-left' | 'bottom-right')
|
|
65
|
+
- `theme?`: Theme ('default' | 'dark')
|
|
66
|
+
- `maxNotifications?`: Maximum notifications to display
|
|
67
|
+
- `showUnreadBadge?`: Show unread count badge
|
|
68
|
+
- `onNotificationClick?`: Click handler
|
|
69
|
+
- `onMarkAsRead?`: Mark as read handler
|
|
70
|
+
- `onDelete?`: Delete handler
|
|
71
|
+
- `pollInterval?`: Polling interval in ms
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../src/components/EmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAehD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface NotificationBellProps {
|
|
3
|
+
unreadCount?: number;
|
|
4
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
|
+
showBadge?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const NotificationBell: React.FC<NotificationBellProps>;
|
|
8
|
+
//# sourceMappingURL=NotificationBell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationBell.d.ts","sourceRoot":"","sources":["../../src/components/NotificationBell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAgB5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Notification, NotificationClient } from '@edusight/notification-sdk';
|
|
3
|
+
export interface NotificationCenterProps {
|
|
4
|
+
client: NotificationClient;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
subscriberId: string;
|
|
7
|
+
environmentId: string;
|
|
8
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
9
|
+
theme?: 'default' | 'dark';
|
|
10
|
+
maxNotifications?: number;
|
|
11
|
+
showUnreadBadge?: boolean;
|
|
12
|
+
onNotificationClick?: (notification: Notification) => void;
|
|
13
|
+
onMarkAsRead?: (notificationId: string) => Promise<void>;
|
|
14
|
+
onDelete?: (notificationId: string) => Promise<void>;
|
|
15
|
+
pollInterval?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const NotificationCenter: React.FC<NotificationCenterProps>;
|
|
18
|
+
//# sourceMappingURL=NotificationCenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCenter.d.ts","sourceRoot":"","sources":["../../src/components/NotificationCenter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAK9E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3D,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA+HhE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Notification } from '@edusight/notification-sdk';
|
|
3
|
+
export interface NotificationGroupProps {
|
|
4
|
+
groupLabel: string;
|
|
5
|
+
notifications: Notification[];
|
|
6
|
+
onMarkAsRead?: (notificationId: string) => void;
|
|
7
|
+
onDelete?: (notificationId: string) => void;
|
|
8
|
+
onClick?: (notification: Notification) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotificationGroup: React.FC<NotificationGroupProps>;
|
|
11
|
+
export declare function groupNotificationsByDate(notifications: Notification[]): Record<string, Notification[]>;
|
|
12
|
+
export declare function getGroupLabel(key: string): string;
|
|
13
|
+
//# sourceMappingURL=NotificationGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationGroup.d.ts","sourceRoot":"","sources":["../../src/components/NotificationGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4B9D,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CA0BtG;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAejD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Notification } from '@edusight/notification-sdk';
|
|
3
|
+
export interface NotificationItemProps {
|
|
4
|
+
notification: Notification;
|
|
5
|
+
onMarkAsRead?: (notificationId: string) => void;
|
|
6
|
+
onDelete?: (notificationId: string) => void;
|
|
7
|
+
onClick?: (notification: Notification) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const NotificationItem: React.FC<NotificationItemProps>;
|
|
10
|
+
//# sourceMappingURL=NotificationItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../src/components/NotificationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAoF5D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Notification } from '@edusight/notification-sdk';
|
|
3
|
+
export interface NotificationListProps {
|
|
4
|
+
notifications: Notification[];
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
error?: Error | null;
|
|
7
|
+
onNotificationClick?: (notification: Notification) => void;
|
|
8
|
+
onMarkAsRead?: (notificationId: string) => Promise<void>;
|
|
9
|
+
onDelete?: (notificationId: string) => Promise<void>;
|
|
10
|
+
subscriberId?: string;
|
|
11
|
+
tenantId?: string;
|
|
12
|
+
client?: any;
|
|
13
|
+
groupByDate?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const NotificationList: React.FC<NotificationListProps>;
|
|
16
|
+
//# sourceMappingURL=NotificationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationList.d.ts","sourceRoot":"","sources":["../../src/components/NotificationList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3D,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiH5D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NotificationClient } from '@edusight/notification-sdk';
|
|
3
|
+
export interface PreferencesProps {
|
|
4
|
+
client: NotificationClient;
|
|
5
|
+
subscriberId: string;
|
|
6
|
+
tenantId: string;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Preferences: React.FC<PreferencesProps>;
|
|
10
|
+
//# sourceMappingURL=Preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Preferences.d.ts","sourceRoot":"","sources":["../../src/components/Preferences.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAoBD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+IlD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Notification, NotificationClient } from '@edusight/notification-sdk';
|
|
2
|
+
export interface UseNotificationCenterOptions {
|
|
3
|
+
client: NotificationClient;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
subscriberId: string;
|
|
6
|
+
environmentId: string;
|
|
7
|
+
pollInterval?: number;
|
|
8
|
+
autoFetch?: boolean;
|
|
9
|
+
autoAck?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseNotificationCenterReturn {
|
|
12
|
+
notifications: Notification[];
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
unreadCount: number;
|
|
16
|
+
connected: boolean;
|
|
17
|
+
refresh: () => Promise<void>;
|
|
18
|
+
markAsRead: (notificationId: string) => Promise<void>;
|
|
19
|
+
deleteNotification: (notificationId: string) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare function useNotificationCenter(options: UseNotificationCenterOptions): UseNotificationCenterReturn;
|
|
22
|
+
//# sourceMappingURL=useNotificationCenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationCenter.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotificationCenter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAsB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIlG,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAyE7B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NotificationClient, Notification, NotificationFilters } from '@edusight/notification-sdk';
|
|
2
|
+
export interface UseNotificationsOptions {
|
|
3
|
+
client: NotificationClient;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
subscriberId?: string;
|
|
6
|
+
filters?: NotificationFilters;
|
|
7
|
+
pollInterval?: number;
|
|
8
|
+
autoFetch?: boolean;
|
|
9
|
+
maxNotifications?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface UseNotificationsReturn {
|
|
12
|
+
notifications: Notification[];
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
unreadCount: number;
|
|
16
|
+
refresh: () => Promise<void>;
|
|
17
|
+
markAsRead: (notificationId: string) => Promise<void>;
|
|
18
|
+
deleteNotification: (notificationId: string) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function useNotifications(options: UseNotificationsOptions): UseNotificationsReturn;
|
|
21
|
+
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEnG,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAoFzF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Notification, NotificationSocketAckEvent, NotificationClient } from '@edusight/notification-sdk';
|
|
2
|
+
export interface UseWebSocketOptions {
|
|
3
|
+
client: NotificationClient;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
subscriberId: string;
|
|
6
|
+
environmentId: string;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
autoAck?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UseWebSocketReturn {
|
|
11
|
+
connected: boolean;
|
|
12
|
+
connect: () => void;
|
|
13
|
+
disconnect: () => void;
|
|
14
|
+
onNotification: (handler: (notification: Notification) => void) => () => void;
|
|
15
|
+
onAck: (handler: (ack: NotificationSocketAckEvent) => void) => () => void;
|
|
16
|
+
ackNotification: (notificationId: string) => void;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn;
|
|
20
|
+
//# sourceMappingURL=useWebSocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWebSocket.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebSocket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG1G,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,EAAE,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IAC9E,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IAC1E,eAAe,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAiG7E"}
|