@hamak/notification 0.5.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/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +14 -0
- package/dist/api/interfaces/index.d.ts +5 -0
- package/dist/api/interfaces/index.d.ts.map +1 -0
- package/dist/api/interfaces/index.js +4 -0
- package/dist/api/interfaces/notification-service.d.ts +150 -0
- package/dist/api/interfaces/notification-service.d.ts.map +1 -0
- package/dist/api/interfaces/notification-service.js +1 -0
- package/dist/api/tokens/index.d.ts +5 -0
- package/dist/api/tokens/index.d.ts.map +1 -0
- package/dist/api/tokens/index.js +4 -0
- package/dist/api/tokens/service-tokens.d.ts +22 -0
- package/dist/api/tokens/service-tokens.d.ts.map +1 -0
- package/dist/api/tokens/service-tokens.js +17 -0
- package/dist/api/types/index.d.ts +5 -0
- package/dist/api/types/index.d.ts.map +1 -0
- package/dist/api/types/index.js +4 -0
- package/dist/api/types/notification.d.ts +64 -0
- package/dist/api/types/notification.d.ts.map +1 -0
- package/dist/api/types/notification.js +1 -0
- package/dist/impl/core/index.d.ts +5 -0
- package/dist/impl/core/index.d.ts.map +1 -0
- package/dist/impl/core/index.js +4 -0
- package/dist/impl/core/notification-service.d.ts +75 -0
- package/dist/impl/core/notification-service.d.ts.map +1 -0
- package/dist/impl/core/notification-service.js +269 -0
- package/dist/impl/index.d.ts +16 -0
- package/dist/impl/index.d.ts.map +1 -0
- package/dist/impl/index.js +17 -0
- package/dist/impl/plugin/index.d.ts +5 -0
- package/dist/impl/plugin/index.d.ts.map +1 -0
- package/dist/impl/plugin/index.js +4 -0
- package/dist/impl/plugin/notification-plugin-factory.d.ts +26 -0
- package/dist/impl/plugin/notification-plugin-factory.d.ts.map +1 -0
- package/dist/impl/plugin/notification-plugin-factory.js +120 -0
- package/dist/impl/store/index.d.ts +6 -0
- package/dist/impl/store/index.d.ts.map +1 -0
- package/dist/impl/store/index.js +5 -0
- package/dist/impl/store/notification-actions.d.ts +54 -0
- package/dist/impl/store/notification-actions.d.ts.map +1 -0
- package/dist/impl/store/notification-actions.js +53 -0
- package/dist/impl/store/notification-reducer.d.ts +23 -0
- package/dist/impl/store/notification-reducer.d.ts.map +1 -0
- package/dist/impl/store/notification-reducer.js +47 -0
- package/dist/impl/utils/id-generator.d.ts +14 -0
- package/dist/impl/utils/id-generator.d.ts.map +1 -0
- package/dist/impl/utils/id-generator.js +18 -0
- package/dist/impl/utils/index.d.ts +5 -0
- package/dist/impl/utils/index.d.ts.map +1 -0
- package/dist/impl/utils/index.js +4 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/spi/events/index.d.ts +5 -0
- package/dist/spi/events/index.d.ts.map +1 -0
- package/dist/spi/events/index.js +4 -0
- package/dist/spi/events/notification-events.d.ts +38 -0
- package/dist/spi/events/notification-events.d.ts.map +1 -0
- package/dist/spi/events/notification-events.js +1 -0
- package/dist/spi/index.d.ts +13 -0
- package/dist/spi/index.d.ts.map +1 -0
- package/dist/spi/index.js +13 -0
- package/dist/spi/plugin/index.d.ts +6 -0
- package/dist/spi/plugin/index.d.ts.map +1 -0
- package/dist/spi/plugin/index.js +4 -0
- package/dist/spi/plugin/plugin-config.d.ts +45 -0
- package/dist/spi/plugin/plugin-config.d.ts.map +1 -0
- package/dist/spi/plugin/plugin-config.js +4 -0
- package/dist/spi/plugin/plugin-module.d.ts +11 -0
- package/dist/spi/plugin/plugin-module.d.ts.map +1 -0
- package/dist/spi/plugin/plugin-module.js +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hamak/notification/api
|
|
3
|
+
*
|
|
4
|
+
* Public API for the pluggable notification system.
|
|
5
|
+
* Provides interfaces, types, and service tokens.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from './interfaces/index';
|
|
10
|
+
export * from './types/index';
|
|
11
|
+
export * from './tokens/index';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,oBAAoB,CAAC;AAGnC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hamak/notification/api
|
|
3
|
+
*
|
|
4
|
+
* Public API for the pluggable notification system.
|
|
5
|
+
* Provides interfaces, types, and service tokens.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
// Export all API interfaces
|
|
10
|
+
export * from './interfaces/index';
|
|
11
|
+
// Export all types
|
|
12
|
+
export * from './types/index';
|
|
13
|
+
// Export service tokens
|
|
14
|
+
export * from './tokens/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/interfaces/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { INotification, NotificationOptions } from '../types/notification';
|
|
2
|
+
/**
|
|
3
|
+
* Listener function for notification changes
|
|
4
|
+
*/
|
|
5
|
+
export type NotificationListener = (notifications: INotification[]) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Service interface for managing notifications
|
|
8
|
+
*
|
|
9
|
+
* This service provides methods to create, dismiss, and observe notifications.
|
|
10
|
+
* All notifications are pure data structures (fully serializable).
|
|
11
|
+
*/
|
|
12
|
+
export interface INotificationService {
|
|
13
|
+
/**
|
|
14
|
+
* Create a notification with full control over all properties
|
|
15
|
+
*
|
|
16
|
+
* @param notification - Notification data (id and timestamp will be auto-generated)
|
|
17
|
+
* @returns The generated notification ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const id = notificationService.notify({
|
|
22
|
+
* type: 'success',
|
|
23
|
+
* title: 'Upload Complete',
|
|
24
|
+
* message: 'File uploaded successfully',
|
|
25
|
+
* duration: 5000,
|
|
26
|
+
* source: 'file-upload',
|
|
27
|
+
* metadata: { filePath: '/uploads/document.pdf' }
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
notify(notification: Omit<INotification, 'id' | 'timestamp'>): string;
|
|
32
|
+
/**
|
|
33
|
+
* Create an informational notification
|
|
34
|
+
*
|
|
35
|
+
* @param message - The notification message
|
|
36
|
+
* @param title - Optional title (defaults to 'Info')
|
|
37
|
+
* @param options - Optional notification options
|
|
38
|
+
* @returns The generated notification ID
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* notificationService.info('Processing started', 'Background Task', {
|
|
43
|
+
* duration: 3000,
|
|
44
|
+
* source: 'task-processor'
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
info(message: string, title?: string, options?: NotificationOptions): string;
|
|
49
|
+
/**
|
|
50
|
+
* Create a success notification
|
|
51
|
+
*
|
|
52
|
+
* @param message - The notification message
|
|
53
|
+
* @param title - Optional title (defaults to 'Success')
|
|
54
|
+
* @param options - Optional notification options
|
|
55
|
+
* @returns The generated notification ID
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* notificationService.success('Data saved successfully');
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
success(message: string, title?: string, options?: NotificationOptions): string;
|
|
63
|
+
/**
|
|
64
|
+
* Create a warning notification
|
|
65
|
+
*
|
|
66
|
+
* @param message - The notification message
|
|
67
|
+
* @param title - Optional title (defaults to 'Warning')
|
|
68
|
+
* @param options - Optional notification options
|
|
69
|
+
* @returns The generated notification ID
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* notificationService.warning('Disk space is running low', 'System Warning', {
|
|
74
|
+
* source: 'system-monitor',
|
|
75
|
+
* metadata: { diskSpace: 512000 }
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
warning(message: string, title?: string, options?: NotificationOptions): string;
|
|
80
|
+
/**
|
|
81
|
+
* Create an error notification
|
|
82
|
+
*
|
|
83
|
+
* @param message - The notification message
|
|
84
|
+
* @param title - Optional title (defaults to 'Error')
|
|
85
|
+
* @param options - Optional notification options
|
|
86
|
+
* @returns The generated notification ID
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* notificationService.error('Failed to save data', 'Save Error', {
|
|
91
|
+
* duration: 0, // No auto-dismiss for errors
|
|
92
|
+
* source: 'data-service',
|
|
93
|
+
* metadata: { errorCode: 'ERR_NETWORK' }
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
error(message: string, title?: string, options?: NotificationOptions): string;
|
|
98
|
+
/**
|
|
99
|
+
* Dismiss a specific notification by ID
|
|
100
|
+
*
|
|
101
|
+
* @param id - The notification ID to dismiss
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const id = notificationService.info('Processing...');
|
|
106
|
+
* // Later...
|
|
107
|
+
* notificationService.dismiss(id);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
dismiss(id: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Dismiss all notifications
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* notificationService.dismissAll();
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
dismissAll(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Get all current notifications
|
|
122
|
+
*
|
|
123
|
+
* @returns Array of all active notifications
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const notifications = notificationService.getAll();
|
|
128
|
+
* console.log(`You have ${notifications.length} notifications`);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
getAll(): INotification[];
|
|
132
|
+
/**
|
|
133
|
+
* Subscribe to notification changes
|
|
134
|
+
*
|
|
135
|
+
* @param listener - Callback function that receives updated notification list
|
|
136
|
+
* @returns Unsubscribe function
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const unsubscribe = notificationService.subscribe((notifications) => {
|
|
141
|
+
* console.log('Notifications updated:', notifications);
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* // Later...
|
|
145
|
+
* unsubscribe();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
subscribe(listener: NotificationListener): () => void;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=notification-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-service.d.ts","sourceRoot":"","sources":["../../../src/api/interfaces/notification-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,WAAW,CAAC,GAAG,MAAM,CAAC;IAEtE;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAE7E;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAEhF;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAEhF;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAE9E;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;;;;;;;;OAUG;IACH,MAAM,IAAI,aAAa,EAAE,CAAC;IAE1B;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;CACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/tokens/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,0BAA0B,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection tokens for notification services
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Token for injecting the NotificationService
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* export const myPlugin: PluginModule = {
|
|
10
|
+
* initialize(ctx) {
|
|
11
|
+
* const notificationService = ctx.resolve(NOTIFICATION_SERVICE_TOKEN);
|
|
12
|
+
* notificationService.success('Plugin initialized');
|
|
13
|
+
* }
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const NOTIFICATION_SERVICE_TOKEN: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* Type helper for NOTIFICATION_SERVICE_TOKEN
|
|
20
|
+
*/
|
|
21
|
+
export type NotificationServiceToken = typeof NOTIFICATION_SERVICE_TOKEN;
|
|
22
|
+
//# sourceMappingURL=service-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-tokens.d.ts","sourceRoot":"","sources":["../../../src/api/tokens/service-tokens.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,eAAwD,CAAC;AAEhG;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection tokens for notification services
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Token for injecting the NotificationService
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* export const myPlugin: PluginModule = {
|
|
10
|
+
* initialize(ctx) {
|
|
11
|
+
* const notificationService = ctx.resolve(NOTIFICATION_SERVICE_TOKEN);
|
|
12
|
+
* notificationService.success('Plugin initialized');
|
|
13
|
+
* }
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const NOTIFICATION_SERVICE_TOKEN = Symbol.for('@hamak/notification:NotificationService');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure data structure representing a notification message.
|
|
3
|
+
* This interface is fully serializable and can be stored in Redux,
|
|
4
|
+
* persisted to storage, or transmitted over the network.
|
|
5
|
+
*/
|
|
6
|
+
export interface INotification {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for the notification
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Type/severity of the notification
|
|
13
|
+
*/
|
|
14
|
+
type: 'info' | 'success' | 'warning' | 'error';
|
|
15
|
+
/**
|
|
16
|
+
* Title/heading of the notification
|
|
17
|
+
*/
|
|
18
|
+
title: string;
|
|
19
|
+
/**
|
|
20
|
+
* Main notification message
|
|
21
|
+
*/
|
|
22
|
+
message: string;
|
|
23
|
+
/**
|
|
24
|
+
* Unix timestamp (milliseconds) when notification was created
|
|
25
|
+
*/
|
|
26
|
+
timestamp: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional auto-dismiss duration in milliseconds
|
|
29
|
+
* If not set, notification will persist until manually dismissed
|
|
30
|
+
*/
|
|
31
|
+
duration?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional source identifier (e.g., 'file-upload', 'auth-session')
|
|
34
|
+
* Used by UI layer to determine appropriate actions
|
|
35
|
+
*/
|
|
36
|
+
source?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional serializable metadata for additional context
|
|
39
|
+
* Must be JSON-serializable (no functions, Dates should be timestamps, etc.)
|
|
40
|
+
*/
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Type for notification severity levels
|
|
45
|
+
*/
|
|
46
|
+
export type NotificationType = INotification['type'];
|
|
47
|
+
/**
|
|
48
|
+
* Options for creating a notification (excludes id and timestamp)
|
|
49
|
+
*/
|
|
50
|
+
export interface NotificationOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Auto-dismiss duration in milliseconds
|
|
53
|
+
*/
|
|
54
|
+
duration?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Source identifier
|
|
57
|
+
*/
|
|
58
|
+
source?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Additional serializable metadata
|
|
61
|
+
*/
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/api/types/notification.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAE/C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/impl/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { INotification, INotificationService, NotificationListener, NotificationOptions } from '../../api/index';
|
|
2
|
+
import type { ILogger } from '@hamak/logging/api';
|
|
3
|
+
import type { NotificationPluginConfig } from '../../spi/index';
|
|
4
|
+
/**
|
|
5
|
+
* Core implementation of the notification service
|
|
6
|
+
*/
|
|
7
|
+
export declare class NotificationService implements INotificationService {
|
|
8
|
+
private notifications;
|
|
9
|
+
private listeners;
|
|
10
|
+
private config;
|
|
11
|
+
private logger;
|
|
12
|
+
private timers;
|
|
13
|
+
constructor(config: NotificationPluginConfig, logger: ILogger);
|
|
14
|
+
/**
|
|
15
|
+
* Create a notification with full control
|
|
16
|
+
*/
|
|
17
|
+
notify(notification: Omit<INotification, 'id' | 'timestamp'>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Create an info notification
|
|
20
|
+
*/
|
|
21
|
+
info(message: string, title?: string, options?: NotificationOptions): string;
|
|
22
|
+
/**
|
|
23
|
+
* Create a success notification
|
|
24
|
+
*/
|
|
25
|
+
success(message: string, title?: string, options?: NotificationOptions): string;
|
|
26
|
+
/**
|
|
27
|
+
* Create a warning notification
|
|
28
|
+
*/
|
|
29
|
+
warning(message: string, title?: string, options?: NotificationOptions): string;
|
|
30
|
+
/**
|
|
31
|
+
* Create an error notification
|
|
32
|
+
*/
|
|
33
|
+
error(message: string, title?: string, options?: NotificationOptions): string;
|
|
34
|
+
/**
|
|
35
|
+
* Dismiss a specific notification
|
|
36
|
+
*/
|
|
37
|
+
dismiss(id: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Dismiss all notifications
|
|
40
|
+
*/
|
|
41
|
+
dismissAll(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get all current notifications
|
|
44
|
+
*/
|
|
45
|
+
getAll(): INotification[];
|
|
46
|
+
/**
|
|
47
|
+
* Subscribe to notification changes
|
|
48
|
+
*/
|
|
49
|
+
subscribe(listener: NotificationListener): () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Cleanup resources
|
|
52
|
+
*/
|
|
53
|
+
destroy(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Setup auto-dismiss timer for a notification
|
|
56
|
+
*/
|
|
57
|
+
private setupAutoDismiss;
|
|
58
|
+
/**
|
|
59
|
+
* Clear timer for a notification
|
|
60
|
+
*/
|
|
61
|
+
private clearTimer;
|
|
62
|
+
/**
|
|
63
|
+
* Notify all listeners of changes
|
|
64
|
+
*/
|
|
65
|
+
private notifyListeners;
|
|
66
|
+
/**
|
|
67
|
+
* Save notifications to localStorage
|
|
68
|
+
*/
|
|
69
|
+
private saveToStorage;
|
|
70
|
+
/**
|
|
71
|
+
* Load notifications from localStorage
|
|
72
|
+
*/
|
|
73
|
+
private loadFromStorage;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=notification-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-service.d.ts","sourceRoot":"","sources":["../../../src/impl/core/notification-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAchE;;GAEG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAmD;gBAErD,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO;IAkB7D;;OAEG;IACH,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,WAAW,CAAC,GAAG,MAAM;IA2CrE;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAe,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM;IASpF;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAkB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM;IAS1F;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAkB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM;IAS1F;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAgB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM;IAUtF;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAgBzB;;OAEG;IACH,UAAU,IAAI,IAAI;IAiBlB;;OAEG;IACH,MAAM,IAAI,aAAa,EAAE;IAIzB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAWrD;;OAEG;IACH,OAAO,IAAI,IAAI;IAQf;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACH,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAUrB;;OAEG;IACH,OAAO,CAAC,eAAe;CAkBxB"}
|