@umituz/react-native-notifications 1.0.0

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.
Files changed (78) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +93 -0
  3. package/lib/index.d.ts +13 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +15 -0
  6. package/lib/index.js.map +1 -0
  7. package/lib/infrastructure/config/notificationsConfig.d.ts +20 -0
  8. package/lib/infrastructure/config/notificationsConfig.d.ts.map +1 -0
  9. package/lib/infrastructure/config/notificationsConfig.js +81 -0
  10. package/lib/infrastructure/config/notificationsConfig.js.map +1 -0
  11. package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts +17 -0
  12. package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts.map +1 -0
  13. package/lib/infrastructure/hooks/actions/useNotificationActions.js +141 -0
  14. package/lib/infrastructure/hooks/actions/useNotificationActions.js.map +1 -0
  15. package/lib/infrastructure/hooks/state/useNotificationsState.d.ts +12 -0
  16. package/lib/infrastructure/hooks/state/useNotificationsState.d.ts.map +1 -0
  17. package/lib/infrastructure/hooks/state/useNotificationsState.js +30 -0
  18. package/lib/infrastructure/hooks/state/useNotificationsState.js.map +1 -0
  19. package/lib/infrastructure/hooks/types.d.ts +87 -0
  20. package/lib/infrastructure/hooks/types.d.ts.map +1 -0
  21. package/lib/infrastructure/hooks/types.js +8 -0
  22. package/lib/infrastructure/hooks/types.js.map +1 -0
  23. package/lib/infrastructure/hooks/useNotificationSettings.d.ts +10 -0
  24. package/lib/infrastructure/hooks/useNotificationSettings.d.ts.map +1 -0
  25. package/lib/infrastructure/hooks/useNotificationSettings.js +43 -0
  26. package/lib/infrastructure/hooks/useNotificationSettings.js.map +1 -0
  27. package/lib/infrastructure/hooks/useNotifications.d.ts +23 -0
  28. package/lib/infrastructure/hooks/useNotifications.d.ts.map +1 -0
  29. package/lib/infrastructure/hooks/useNotifications.js +51 -0
  30. package/lib/infrastructure/hooks/useNotifications.js.map +1 -0
  31. package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts +13 -0
  32. package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts.map +1 -0
  33. package/lib/infrastructure/hooks/utils/useNotificationRefresh.js +82 -0
  34. package/lib/infrastructure/hooks/utils/useNotificationRefresh.js.map +1 -0
  35. package/lib/infrastructure/services/NotificationManager.d.ts +138 -0
  36. package/lib/infrastructure/services/NotificationManager.d.ts.map +1 -0
  37. package/lib/infrastructure/services/NotificationManager.js +284 -0
  38. package/lib/infrastructure/services/NotificationManager.js.map +1 -0
  39. package/lib/infrastructure/services/NotificationService.d.ts +30 -0
  40. package/lib/infrastructure/services/NotificationService.d.ts.map +1 -0
  41. package/lib/infrastructure/services/NotificationService.js +41 -0
  42. package/lib/infrastructure/services/NotificationService.js.map +1 -0
  43. package/lib/infrastructure/services/channels/ChannelManager.d.ts +18 -0
  44. package/lib/infrastructure/services/channels/ChannelManager.d.ts.map +1 -0
  45. package/lib/infrastructure/services/channels/ChannelManager.js +87 -0
  46. package/lib/infrastructure/services/channels/ChannelManager.js.map +1 -0
  47. package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts +16 -0
  48. package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts.map +1 -0
  49. package/lib/infrastructure/services/delivery/NotificationDelivery.js +57 -0
  50. package/lib/infrastructure/services/delivery/NotificationDelivery.js.map +1 -0
  51. package/lib/infrastructure/services/preferences/PreferencesManager.d.ts +18 -0
  52. package/lib/infrastructure/services/preferences/PreferencesManager.d.ts.map +1 -0
  53. package/lib/infrastructure/services/preferences/PreferencesManager.js +65 -0
  54. package/lib/infrastructure/services/preferences/PreferencesManager.js.map +1 -0
  55. package/lib/infrastructure/services/types.d.ts +89 -0
  56. package/lib/infrastructure/services/types.d.ts.map +1 -0
  57. package/lib/infrastructure/services/types.js +7 -0
  58. package/lib/infrastructure/services/types.js.map +1 -0
  59. package/lib/infrastructure/storage/NotificationsStore.d.ts +23 -0
  60. package/lib/infrastructure/storage/NotificationsStore.d.ts.map +1 -0
  61. package/lib/infrastructure/storage/NotificationsStore.js +25 -0
  62. package/lib/infrastructure/storage/NotificationsStore.js.map +1 -0
  63. package/package.json +62 -0
  64. package/src/index.ts +34 -0
  65. package/src/infrastructure/config/notificationsConfig.ts +98 -0
  66. package/src/infrastructure/hooks/actions/useNotificationActions.ts +233 -0
  67. package/src/infrastructure/hooks/state/useNotificationsState.ts +46 -0
  68. package/src/infrastructure/hooks/types.ts +83 -0
  69. package/src/infrastructure/hooks/useNotificationSettings.ts +45 -0
  70. package/src/infrastructure/hooks/useNotifications.ts +70 -0
  71. package/src/infrastructure/hooks/utils/useNotificationRefresh.ts +107 -0
  72. package/src/infrastructure/services/NotificationManager.ts +326 -0
  73. package/src/infrastructure/services/NotificationService.ts +50 -0
  74. package/src/infrastructure/services/channels/ChannelManager.ts +111 -0
  75. package/src/infrastructure/services/delivery/NotificationDelivery.ts +65 -0
  76. package/src/infrastructure/services/preferences/PreferencesManager.ts +77 -0
  77. package/src/infrastructure/services/types.ts +81 -0
  78. package/src/infrastructure/storage/NotificationsStore.ts +39 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../../src/infrastructure/services/NotificationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAqCxC;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,SAAS;QACd,aAAa,CAAC,sBAAsB,CAAC;YACnC,kBAAkB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;gBAC/B,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,IAAI;gBACrB,cAAc,EAAE,IAAI;aACrB,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,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * NotificationService
3
+ *
4
+ * Simple facade for offline notification system.
5
+ * Works in ALL apps - offline, online, hybrid - no backend required.
6
+ *
7
+ * @module NotificationService
8
+ */
9
+ import { NotificationManager } from './NotificationManager';
10
+ export * from './types';
11
+ /**
12
+ * Notification service singleton
13
+ * Provides simple access to notification manager
14
+ */
15
+ export declare class NotificationService {
16
+ private static instance;
17
+ readonly notifications: NotificationManager;
18
+ private constructor();
19
+ static getInstance(): NotificationService;
20
+ /**
21
+ * Request notification permissions
22
+ */
23
+ requestPermissions(): Promise<boolean>;
24
+ /**
25
+ * Check if permissions are granted
26
+ */
27
+ hasPermissions(): Promise<boolean>;
28
+ }
29
+ export declare const notificationService: NotificationService;
30
+ //# sourceMappingURL=NotificationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/services/NotificationService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,cAAc,SAAS,CAAC;AAExB;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAE7C,QAAQ,CAAC,aAAa,sBAA6B;IAEnD,OAAO;IAKP,MAAM,CAAC,WAAW,IAAI,mBAAmB;IAOzC;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI5C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;CAGzC;AAED,eAAO,MAAM,mBAAmB,qBAAoC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * NotificationService
3
+ *
4
+ * Simple facade for offline notification system.
5
+ * Works in ALL apps - offline, online, hybrid - no backend required.
6
+ *
7
+ * @module NotificationService
8
+ */
9
+ import { NotificationManager } from './NotificationManager';
10
+ export * from './types';
11
+ /**
12
+ * Notification service singleton
13
+ * Provides simple access to notification manager
14
+ */
15
+ export class NotificationService {
16
+ constructor() {
17
+ this.notifications = new NotificationManager();
18
+ // Configure notification handler on initialization
19
+ NotificationManager.configure();
20
+ }
21
+ static getInstance() {
22
+ if (!NotificationService.instance) {
23
+ NotificationService.instance = new NotificationService();
24
+ }
25
+ return NotificationService.instance;
26
+ }
27
+ /**
28
+ * Request notification permissions
29
+ */
30
+ async requestPermissions() {
31
+ return await this.notifications.requestPermissions();
32
+ }
33
+ /**
34
+ * Check if permissions are granted
35
+ */
36
+ async hasPermissions() {
37
+ return await this.notifications.hasPermissions();
38
+ }
39
+ }
40
+ export const notificationService = NotificationService.getInstance();
41
+ //# sourceMappingURL=NotificationService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationService.js","sourceRoot":"","sources":["../../../src/infrastructure/services/NotificationService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,cAAc,SAAS,CAAC;AAExB;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAK9B;QAFS,kBAAa,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAGjD,mDAAmD;QACnD,mBAAmB,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;YAClC,mBAAmB,CAAC,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC3D,CAAC;QACD,OAAO,mBAAmB,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB;QACtB,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IACnD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { NotificationChannel } from '../types';
2
+ /**
3
+ * ChannelManager - Offline Notification Channel Management
4
+ *
5
+ * Manages push notification tokens and preferences in AsyncStorage.
6
+ * Only supports local push and in-app notifications.
7
+ *
8
+ * NO backend, NO email/SMS - pure offline.
9
+ */
10
+ export declare class ChannelManager {
11
+ private static STORAGE_KEY;
12
+ register(channelType: 'push' | 'in_app', preferences?: Record<string, any>): Promise<NotificationChannel | null>;
13
+ verify(channelId: string): Promise<boolean>;
14
+ getActiveChannels(): Promise<NotificationChannel[]>;
15
+ private getAllChannels;
16
+ private update;
17
+ }
18
+ //# sourceMappingURL=ChannelManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelManager.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/services/channels/ChannelManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,WAAW,CAA6B;IAEjD,QAAQ,CACZ,WAAW,EAAE,MAAM,GAAG,QAAQ,EAC9B,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACpC,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAgChC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB3C,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAS3C,cAAc;YASd,MAAM;CAsBrB"}
@@ -0,0 +1,87 @@
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ import * as Notifications from 'expo-notifications';
3
+ /**
4
+ * ChannelManager - Offline Notification Channel Management
5
+ *
6
+ * Manages push notification tokens and preferences in AsyncStorage.
7
+ * Only supports local push and in-app notifications.
8
+ *
9
+ * NO backend, NO email/SMS - pure offline.
10
+ */
11
+ export class ChannelManager {
12
+ async register(channelType, preferences = {}) {
13
+ try {
14
+ // Get push token for local notifications
15
+ const token = channelType === 'push'
16
+ ? (await Notifications.getExpoPushTokenAsync()).data
17
+ : 'in_app';
18
+ const channel = {
19
+ id: `${channelType}_${Date.now()}`,
20
+ channel_type: channelType,
21
+ channel_address: token,
22
+ preferences,
23
+ is_verified: true, // Local channels always verified
24
+ is_active: true,
25
+ created_at: new Date().toISOString(),
26
+ };
27
+ // Store in AsyncStorage
28
+ const channels = await this.getAllChannels();
29
+ channels.push(channel);
30
+ await AsyncStorage.setItem(ChannelManager.STORAGE_KEY, JSON.stringify(channels));
31
+ return channel;
32
+ }
33
+ catch (error) {
34
+ return null;
35
+ }
36
+ }
37
+ async verify(channelId) {
38
+ try {
39
+ const channels = await this.getAllChannels();
40
+ const index = channels.findIndex((c) => c.id === channelId);
41
+ if (index !== -1) {
42
+ channels[index].is_verified = true;
43
+ await AsyncStorage.setItem(ChannelManager.STORAGE_KEY, JSON.stringify(channels));
44
+ return true;
45
+ }
46
+ return false;
47
+ }
48
+ catch (error) {
49
+ return false;
50
+ }
51
+ }
52
+ async getActiveChannels() {
53
+ try {
54
+ const channels = await this.getAllChannels();
55
+ return channels.filter((c) => c.is_active && c.is_verified);
56
+ }
57
+ catch (error) {
58
+ return [];
59
+ }
60
+ }
61
+ async getAllChannels() {
62
+ try {
63
+ const data = await AsyncStorage.getItem(ChannelManager.STORAGE_KEY);
64
+ return data ? JSON.parse(data) : [];
65
+ }
66
+ catch (error) {
67
+ return [];
68
+ }
69
+ }
70
+ async update(channelId, updates) {
71
+ try {
72
+ const channels = await this.getAllChannels();
73
+ const index = channels.findIndex((c) => c.id === channelId);
74
+ if (index !== -1) {
75
+ channels[index] = { ...channels[index], ...updates };
76
+ await AsyncStorage.setItem(ChannelManager.STORAGE_KEY, JSON.stringify(channels));
77
+ return channels[index];
78
+ }
79
+ return null;
80
+ }
81
+ catch (error) {
82
+ return null;
83
+ }
84
+ }
85
+ }
86
+ ChannelManager.STORAGE_KEY = '@notifications:channels';
87
+ //# sourceMappingURL=ChannelManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelManager.js","sourceRoot":"","sources":["../../../../src/infrastructure/services/channels/ChannelManager.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAGpD;;;;;;;GAOG;AACH,MAAM,OAAO,cAAc;IAGzB,KAAK,CAAC,QAAQ,CACZ,WAA8B,EAC9B,cAAmC,EAAE;QAErC,IAAI,CAAC;YACH,yCAAyC;YACzC,MAAM,KAAK,GACT,WAAW,KAAK,MAAM;gBACpB,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,qBAAqB,EAAE,CAAC,CAAC,IAAI;gBACpD,CAAC,CAAC,QAAQ,CAAC;YAEf,MAAM,OAAO,GAAwB;gBACnC,EAAE,EAAE,GAAG,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;gBAClC,YAAY,EAAE,WAAW;gBACzB,eAAe,EAAE,KAAK;gBACtB,WAAW;gBACX,WAAW,EAAE,IAAI,EAAE,iCAAiC;gBACpD,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACrC,CAAC;YAEF,wBAAwB;YACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC7C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,MAAM,YAAY,CAAC,OAAO,CACxB,cAAc,CAAC,WAAW,EAC1B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CACzB,CAAC;YAEF,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;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AC;YACf,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,MAAM,CAClB,SAAiB,EACjB,OAAqC;QAErC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;YAE5D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjB,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;gBACrD,MAAM,YAAY,CAAC,OAAO,CACxB,cAAc,CAAC,WAAW,EAC1B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CACzB,CAAC;gBACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;;AAhGc,0BAAW,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Notification } from '../types';
2
+ /**
3
+ * NotificationDelivery - Offline Local Notification Delivery
4
+ *
5
+ * Uses expo-notifications for local push notifications only.
6
+ * All data stored in AsyncStorage (offline-capable).
7
+ *
8
+ * NO backend, NO email/SMS - pure offline local notifications.
9
+ */
10
+ export declare class NotificationDelivery {
11
+ private static STORAGE_KEY;
12
+ deliver(notification: Notification): Promise<void>;
13
+ private updateStatus;
14
+ private getDelivered;
15
+ }
16
+ //# sourceMappingURL=NotificationDelivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationDelivery.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/services/delivery/NotificationDelivery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,WAAW,CAA8B;IAElD,OAAO,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;YAsB1C,YAAY;YAmBZ,YAAY;CAQ3B"}
@@ -0,0 +1,57 @@
1
+ import * as Notifications from 'expo-notifications';
2
+ import AsyncStorage from '@react-native-async-storage/async-storage';
3
+ /**
4
+ * NotificationDelivery - Offline Local Notification Delivery
5
+ *
6
+ * Uses expo-notifications for local push notifications only.
7
+ * All data stored in AsyncStorage (offline-capable).
8
+ *
9
+ * NO backend, NO email/SMS - pure offline local notifications.
10
+ */
11
+ export class NotificationDelivery {
12
+ async deliver(notification) {
13
+ try {
14
+ // Schedule local notification using expo-notifications
15
+ await Notifications.scheduleNotificationAsync({
16
+ content: {
17
+ title: notification.title,
18
+ body: notification.body,
19
+ data: { notificationId: notification.id },
20
+ },
21
+ trigger: notification.scheduled_for
22
+ ? { date: new Date(notification.scheduled_for) }
23
+ : null, // null = immediate delivery
24
+ });
25
+ // Update status in AsyncStorage (offline storage)
26
+ await this.updateStatus(notification.id, 'delivered');
27
+ }
28
+ catch (error) {
29
+ // Silent failure - update status to failed
30
+ await this.updateStatus(notification.id, 'failed');
31
+ }
32
+ }
33
+ async updateStatus(notificationId, status) {
34
+ try {
35
+ const delivered = await this.getDelivered();
36
+ delivered[notificationId] = {
37
+ status,
38
+ delivered_at: new Date().toISOString(),
39
+ };
40
+ await AsyncStorage.setItem(NotificationDelivery.STORAGE_KEY, JSON.stringify(delivered));
41
+ }
42
+ catch (error) {
43
+ // Silent failure
44
+ }
45
+ }
46
+ async getDelivered() {
47
+ try {
48
+ const data = await AsyncStorage.getItem(NotificationDelivery.STORAGE_KEY);
49
+ return data ? JSON.parse(data) : {};
50
+ }
51
+ catch (error) {
52
+ return {};
53
+ }
54
+ }
55
+ }
56
+ NotificationDelivery.STORAGE_KEY = '@notifications:delivered';
57
+ //# sourceMappingURL=NotificationDelivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationDelivery.js","sourceRoot":"","sources":["../../../../src/infrastructure/services/delivery/NotificationDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAGrE;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IAG/B,KAAK,CAAC,OAAO,CAAC,YAA0B;QACtC,IAAI,CAAC;YACH,uDAAuD;YACvD,MAAM,aAAa,CAAC,yBAAyB,CAAC;gBAC5C,OAAO,EAAE;oBACP,KAAK,EAAE,YAAY,CAAC,KAAK;oBACzB,IAAI,EAAE,YAAY,CAAC,IAAI;oBACvB,IAAI,EAAE,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,EAAE;iBAC1C;gBACD,OAAO,EAAE,YAAY,CAAC,aAAa;oBACjC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;oBAChD,CAAC,CAAC,IAAI,EAAE,4BAA4B;aACvC,CAAC,CAAC;YAEH,kDAAkD;YAClD,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2CAA2C;YAC3C,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CACxB,cAAsB,EACtB,MAA8B;QAE9B,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5C,SAAS,CAAC,cAAc,CAAC,GAAG;gBAC1B,MAAM;gBACN,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACvC,CAAC;YACF,MAAM,YAAY,CAAC,OAAO,CACxB,oBAAoB,CAAC,WAAW,EAChC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB;QACnB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;;AAlDc,gCAAW,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { NotificationPreferences } from '../types';
2
+ /**
3
+ * PreferencesManager - Offline Notification Preferences
4
+ *
5
+ * Stores preferences in AsyncStorage (offline-capable).
6
+ * Only supports local push and in-app notifications.
7
+ *
8
+ * NO backend, NO email/SMS - pure offline.
9
+ */
10
+ export declare class PreferencesManager {
11
+ private static STORAGE_KEY;
12
+ get(): Promise<NotificationPreferences>;
13
+ update(preferences: Partial<NotificationPreferences>): Promise<boolean>;
14
+ isChannelEnabled(channelType: 'push' | 'in_app', prefs: NotificationPreferences): boolean;
15
+ isInQuietHours(quietHours: NotificationPreferences['quiet_hours']): boolean;
16
+ private getDefaults;
17
+ }
18
+ //# sourceMappingURL=PreferencesManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesManager.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/services/preferences/PreferencesManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAgC;IAEpD,GAAG,IAAI,OAAO,CAAC,uBAAuB,CAAC;IASvC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB7E,gBAAgB,CACd,WAAW,EAAE,MAAM,GAAG,QAAQ,EAC9B,KAAK,EAAE,uBAAuB,GAC7B,OAAO;IAKV,cAAc,CAAC,UAAU,EAAE,uBAAuB,CAAC,aAAa,CAAC,GAAG,OAAO;IAS3E,OAAO,CAAC,WAAW;CAgBpB"}
@@ -0,0 +1,65 @@
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ /**
3
+ * PreferencesManager - Offline Notification Preferences
4
+ *
5
+ * Stores preferences in AsyncStorage (offline-capable).
6
+ * Only supports local push and in-app notifications.
7
+ *
8
+ * NO backend, NO email/SMS - pure offline.
9
+ */
10
+ export class PreferencesManager {
11
+ async get() {
12
+ try {
13
+ const data = await AsyncStorage.getItem(PreferencesManager.STORAGE_KEY);
14
+ return data ? JSON.parse(data) : this.getDefaults();
15
+ }
16
+ catch (error) {
17
+ return this.getDefaults();
18
+ }
19
+ }
20
+ async update(preferences) {
21
+ try {
22
+ const current = await this.get();
23
+ const updated = {
24
+ ...current,
25
+ ...preferences,
26
+ categories: { ...current.categories, ...preferences.categories },
27
+ };
28
+ await AsyncStorage.setItem(PreferencesManager.STORAGE_KEY, JSON.stringify(updated));
29
+ return true;
30
+ }
31
+ catch (error) {
32
+ return false;
33
+ }
34
+ }
35
+ isChannelEnabled(channelType, prefs) {
36
+ if (channelType === 'in_app')
37
+ return true;
38
+ return prefs.push_enabled ?? true;
39
+ }
40
+ isInQuietHours(quietHours) {
41
+ if (!quietHours.enabled)
42
+ return false;
43
+ const currentTime = new Date().toTimeString().slice(0, 5);
44
+ return (currentTime >= quietHours.start_time ||
45
+ currentTime <= quietHours.end_time);
46
+ }
47
+ getDefaults() {
48
+ return {
49
+ push_enabled: true,
50
+ quiet_hours: {
51
+ enabled: false,
52
+ start_time: '22:00',
53
+ end_time: '08:00',
54
+ timezone: 'UTC',
55
+ },
56
+ categories: {
57
+ reminders: { push: true, in_app: true },
58
+ updates: { push: true, in_app: true },
59
+ alerts: { push: true, in_app: true },
60
+ },
61
+ };
62
+ }
63
+ }
64
+ PreferencesManager.STORAGE_KEY = '@notifications:preferences';
65
+ //# sourceMappingURL=PreferencesManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesManager.js","sourceRoot":"","sources":["../../../../src/infrastructure/services/preferences/PreferencesManager.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAGrE;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IAG7B,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAA6C;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG;gBACd,GAAG,OAAO;gBACV,GAAG,WAAW;gBACd,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE;aACjE,CAAC;YAEF,MAAM,YAAY,CAAC,OAAO,CACxB,kBAAkB,CAAC,WAAW,EAC9B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,gBAAgB,CACd,WAA8B,EAC9B,KAA8B;QAE9B,IAAI,WAAW,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,OAAO,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC;IACpC,CAAC;IAED,cAAc,CAAC,UAAkD;QAC/D,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACtC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1D,OAAO,CACL,WAAW,IAAI,UAAU,CAAC,UAAU;YACpC,WAAW,IAAI,UAAU,CAAC,QAAQ,CACnC,CAAC;IACJ,CAAC;IAEO,WAAW;QACjB,OAAO;YACL,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACX,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,OAAO;gBACjB,QAAQ,EAAE,KAAK;aAChB;YACD,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;gBACvC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;gBACrC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aACrC;SACF,CAAC;IACJ,CAAC;;AA/Dc,8BAAW,GAAG,4BAA4B,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Offline-First Notification Types
3
+ * Uses expo-notifications for local device notifications
4
+ * NO backend, NO user IDs, NO push notifications
5
+ */
6
+ /**
7
+ * Notification channel for managing notification delivery
8
+ */
9
+ export interface NotificationChannel {
10
+ id: string;
11
+ channel_type: 'push' | 'in_app';
12
+ channel_address: string;
13
+ preferences: Record<string, any>;
14
+ is_verified: boolean;
15
+ is_active: boolean;
16
+ created_at: string;
17
+ }
18
+ /**
19
+ * Notification data structure
20
+ */
21
+ export interface Notification {
22
+ id: string;
23
+ title: string;
24
+ body: string;
25
+ scheduled_for?: string;
26
+ data?: Record<string, any>;
27
+ }
28
+ /**
29
+ * User notification preferences
30
+ */
31
+ export interface NotificationPreferences {
32
+ push_enabled: boolean;
33
+ quiet_hours: {
34
+ enabled: boolean;
35
+ start_time: string;
36
+ end_time: string;
37
+ timezone: string;
38
+ };
39
+ categories: Record<string, {
40
+ push: boolean;
41
+ in_app: boolean;
42
+ }>;
43
+ }
44
+ /**
45
+ * Trigger types for scheduling notifications
46
+ */
47
+ export type NotificationTrigger = {
48
+ type: 'date';
49
+ date: Date;
50
+ } | {
51
+ type: 'daily';
52
+ hour: number;
53
+ minute: number;
54
+ } | {
55
+ type: 'weekly';
56
+ weekday: number;
57
+ hour: number;
58
+ minute: number;
59
+ } | {
60
+ type: 'monthly';
61
+ day: number;
62
+ hour: number;
63
+ minute: number;
64
+ };
65
+ /**
66
+ * Options for scheduling a notification
67
+ */
68
+ export interface ScheduleNotificationOptions {
69
+ title: string;
70
+ body: string;
71
+ data?: Record<string, any>;
72
+ trigger: NotificationTrigger;
73
+ sound?: boolean | string;
74
+ badge?: number;
75
+ categoryIdentifier?: string;
76
+ }
77
+ /**
78
+ * Scheduled notification details
79
+ */
80
+ export interface ScheduledNotification {
81
+ identifier: string;
82
+ content: {
83
+ title: string;
84
+ body: string;
85
+ data: Record<string, any>;
86
+ };
87
+ trigger: any;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/services/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY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,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,CAAC;IACF,OAAO,EAAE,GAAG,CAAC;CACd"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Offline-First Notification Types
3
+ * Uses expo-notifications for local device notifications
4
+ * NO backend, NO user IDs, NO push notifications
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/infrastructure/services/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Notifications Store - Zustand State Management
3
+ * Simple offline-first notification state
4
+ * NO backend, NO user IDs, NO notification history
5
+ */
6
+ interface NotificationsStore {
7
+ hasPermissions: boolean;
8
+ isInitialized: boolean;
9
+ setPermissions: (granted: boolean) => void;
10
+ setInitialized: (initialized: boolean) => void;
11
+ }
12
+ export declare const useNotificationsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<NotificationsStore>>;
13
+ /**
14
+ * Hook for accessing notifications state
15
+ */
16
+ export declare const useNotifications: () => {
17
+ hasPermissions: boolean;
18
+ isInitialized: boolean;
19
+ setPermissions: (granted: boolean) => void;
20
+ setInitialized: (initialized: boolean) => void;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=NotificationsStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationsStore.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/NotificationsStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,kBAAkB;IAE1B,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IAGvB,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,cAAc,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,qBAAqB,iFAM/B,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;8BAfD,OAAO,KAAK,IAAI;kCACZ,OAAO,KAAK,IAAI;CAuB/C,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Notifications Store - Zustand State Management
3
+ * Simple offline-first notification state
4
+ * NO backend, NO user IDs, NO notification history
5
+ */
6
+ import { create } from 'zustand';
7
+ export const useNotificationsStore = create((set) => ({
8
+ hasPermissions: false,
9
+ isInitialized: false,
10
+ setPermissions: (granted) => set({ hasPermissions: granted }),
11
+ setInitialized: (initialized) => set({ isInitialized: initialized }),
12
+ }));
13
+ /**
14
+ * Hook for accessing notifications state
15
+ */
16
+ export const useNotifications = () => {
17
+ const { hasPermissions, isInitialized, setPermissions, setInitialized } = useNotificationsStore();
18
+ return {
19
+ hasPermissions,
20
+ isInitialized,
21
+ setPermissions,
22
+ setInitialized,
23
+ };
24
+ };
25
+ //# sourceMappingURL=NotificationsStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationsStore.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/NotificationsStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAYjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAqB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxE,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,KAAK;IAEpB,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;IAC7D,cAAc,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;CACrE,CAAC,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAElG,OAAO;QACL,cAAc;QACd,aAAa;QACb,cAAc;QACd,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@umituz/react-native-notifications",
3
+ "version": "1.0.0",
4
+ "description": "Offline-first local notifications system for React Native apps using expo-notifications",
5
+ "main": "./lib/index.js",
6
+ "types": "./lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "typecheck": "tsc --noEmit",
10
+ "lint": "tsc --noEmit",
11
+ "clean": "rm -rf lib",
12
+ "prebuild": "npm run clean",
13
+ "prepublishOnly": "npm run build",
14
+ "version:patch": "npm version patch -m 'chore: release v%s'",
15
+ "version:minor": "npm version minor -m 'chore: release v%s'",
16
+ "version:major": "npm version major -m 'chore: release v%s'"
17
+ },
18
+ "keywords": [
19
+ "react-native",
20
+ "notifications",
21
+ "expo-notifications",
22
+ "local-notifications",
23
+ "offline",
24
+ "reminders",
25
+ "push-notifications"
26
+ ],
27
+ "author": "Ümit UZ <umit@umituz.com>",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/umituz/react-native-notifications"
32
+ },
33
+ "peerDependencies": {
34
+ "@react-native-async-storage/async-storage": "^1.21.0",
35
+ "expo-notifications": "~0.28.0",
36
+ "expo-device": "~6.0.2",
37
+ "react": ">=18.2.0",
38
+ "react-native": ">=0.74.0",
39
+ "zustand": "^5.0.2"
40
+ },
41
+ "devDependencies": {
42
+ "@react-native-async-storage/async-storage": "^1.24.0",
43
+ "@types/react": "^18.2.45",
44
+ "@types/react-native": "^0.73.0",
45
+ "expo-notifications": "~0.28.0",
46
+ "expo-device": "~6.0.2",
47
+ "react": "^18.2.0",
48
+ "react-native": "^0.74.0",
49
+ "typescript": "^5.3.3",
50
+ "zustand": "^5.0.2"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "files": [
56
+ "lib",
57
+ "src",
58
+ "README.md",
59
+ "LICENSE"
60
+ ]
61
+ }
62
+
package/src/index.ts ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Notifications Domain - Public API
3
+ * Offline-first local notifications using expo-notifications
4
+ * NO backend, NO user IDs, NO push notifications
5
+ */
6
+
7
+ // ============================================================================
8
+ // INFRASTRUCTURE LAYER EXPORTS
9
+ // ============================================================================
10
+
11
+ // Types
12
+ export type {
13
+ NotificationTrigger,
14
+ ScheduleNotificationOptions,
15
+ ScheduledNotification,
16
+ } from './infrastructure/services/types';
17
+
18
+ // Configuration
19
+ export { notificationsConfig } from './infrastructure/config/notificationsConfig';
20
+ export type {
21
+ NotificationSetting,
22
+ NotificationSection,
23
+ NotificationsConfig,
24
+ } from './infrastructure/config/notificationsConfig';
25
+
26
+ // State Store (Zustand)
27
+ export { useNotificationsStore, useNotifications } from './infrastructure/storage/NotificationsStore';
28
+
29
+ // Services
30
+ export { NotificationService, notificationService } from './infrastructure/services/NotificationService';
31
+ export { NotificationManager } from './infrastructure/services/NotificationManager';
32
+
33
+ // Hooks
34
+ export { useNotificationSettings } from './infrastructure/hooks/useNotificationSettings';