@umituz/react-native-notifications 1.1.7 → 1.3.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 (118) hide show
  1. package/package.json +18 -40
  2. package/src/index.ts +84 -13
  3. package/src/infrastructure/config/reminderPresets.ts +120 -0
  4. package/src/infrastructure/hooks/useQuietHoursActions.ts +52 -0
  5. package/src/infrastructure/hooks/useReminderActions.ts +147 -0
  6. package/src/infrastructure/services/types.ts +137 -44
  7. package/src/infrastructure/storage/RemindersStore.ts +150 -0
  8. package/src/presentation/components/FormButton.tsx +66 -0
  9. package/src/presentation/components/FrequencySelector.tsx +72 -0
  10. package/src/presentation/components/NotificationsSection.tsx +95 -160
  11. package/src/presentation/components/QuietHoursCard.tsx +105 -0
  12. package/src/presentation/components/ReminderForm.tsx +165 -0
  13. package/src/presentation/components/ReminderItem.tsx +124 -0
  14. package/src/presentation/components/TimePresetSelector.tsx +100 -0
  15. package/src/presentation/components/WeekdaySelector.tsx +61 -0
  16. package/src/presentation/screens/NotificationSettingsScreen.tsx +210 -0
  17. package/src/presentation/screens/ReminderListScreen.tsx +138 -0
  18. package/src/types/global.d.ts +11 -8
  19. package/lib/index.d.ts +0 -16
  20. package/lib/index.d.ts.map +0 -1
  21. package/lib/index.js +0 -23
  22. package/lib/index.js.map +0 -1
  23. package/lib/infrastructure/config/notificationsConfig.d.ts +0 -20
  24. package/lib/infrastructure/config/notificationsConfig.d.ts.map +0 -1
  25. package/lib/infrastructure/config/notificationsConfig.js +0 -81
  26. package/lib/infrastructure/config/notificationsConfig.js.map +0 -1
  27. package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts +0 -7
  28. package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts.map +0 -1
  29. package/lib/infrastructure/hooks/actions/useNotificationActions.js +0 -75
  30. package/lib/infrastructure/hooks/actions/useNotificationActions.js.map +0 -1
  31. package/lib/infrastructure/hooks/actions/useNotificationManagementActions.d.ts +0 -8
  32. package/lib/infrastructure/hooks/actions/useNotificationManagementActions.d.ts.map +0 -1
  33. package/lib/infrastructure/hooks/actions/useNotificationManagementActions.js +0 -78
  34. package/lib/infrastructure/hooks/actions/useNotificationManagementActions.js.map +0 -1
  35. package/lib/infrastructure/hooks/state/useNotificationsState.d.ts +0 -12
  36. package/lib/infrastructure/hooks/state/useNotificationsState.d.ts.map +0 -1
  37. package/lib/infrastructure/hooks/state/useNotificationsState.js +0 -30
  38. package/lib/infrastructure/hooks/state/useNotificationsState.js.map +0 -1
  39. package/lib/infrastructure/hooks/types.d.ts +0 -87
  40. package/lib/infrastructure/hooks/types.d.ts.map +0 -1
  41. package/lib/infrastructure/hooks/types.js +0 -8
  42. package/lib/infrastructure/hooks/types.js.map +0 -1
  43. package/lib/infrastructure/hooks/useNotificationSettings.d.ts +0 -10
  44. package/lib/infrastructure/hooks/useNotificationSettings.d.ts.map +0 -1
  45. package/lib/infrastructure/hooks/useNotificationSettings.js +0 -43
  46. package/lib/infrastructure/hooks/useNotificationSettings.js.map +0 -1
  47. package/lib/infrastructure/hooks/useNotifications.d.ts +0 -24
  48. package/lib/infrastructure/hooks/useNotifications.d.ts.map +0 -1
  49. package/lib/infrastructure/hooks/useNotifications.js +0 -72
  50. package/lib/infrastructure/hooks/useNotifications.js.map +0 -1
  51. package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts +0 -8
  52. package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts.map +0 -1
  53. package/lib/infrastructure/hooks/utils/useNotificationRefresh.js +0 -99
  54. package/lib/infrastructure/hooks/utils/useNotificationRefresh.js.map +0 -1
  55. package/lib/infrastructure/services/NotificationBadgeManager.d.ts +0 -5
  56. package/lib/infrastructure/services/NotificationBadgeManager.d.ts.map +0 -1
  57. package/lib/infrastructure/services/NotificationBadgeManager.js +0 -29
  58. package/lib/infrastructure/services/NotificationBadgeManager.js.map +0 -1
  59. package/lib/infrastructure/services/NotificationManager.d.ts +0 -59
  60. package/lib/infrastructure/services/NotificationManager.d.ts.map +0 -1
  61. package/lib/infrastructure/services/NotificationManager.js +0 -118
  62. package/lib/infrastructure/services/NotificationManager.js.map +0 -1
  63. package/lib/infrastructure/services/NotificationPermissions.d.ts +0 -6
  64. package/lib/infrastructure/services/NotificationPermissions.d.ts.map +0 -1
  65. package/lib/infrastructure/services/NotificationPermissions.js +0 -75
  66. package/lib/infrastructure/services/NotificationPermissions.js.map +0 -1
  67. package/lib/infrastructure/services/NotificationScheduler.d.ts +0 -8
  68. package/lib/infrastructure/services/NotificationScheduler.d.ts.map +0 -1
  69. package/lib/infrastructure/services/NotificationScheduler.js +0 -72
  70. package/lib/infrastructure/services/NotificationScheduler.js.map +0 -1
  71. package/lib/infrastructure/services/NotificationService.d.ts +0 -30
  72. package/lib/infrastructure/services/NotificationService.d.ts.map +0 -1
  73. package/lib/infrastructure/services/NotificationService.js +0 -41
  74. package/lib/infrastructure/services/NotificationService.js.map +0 -1
  75. package/lib/infrastructure/services/channels/ChannelManager.d.ts +0 -18
  76. package/lib/infrastructure/services/channels/ChannelManager.d.ts.map +0 -1
  77. package/lib/infrastructure/services/channels/ChannelManager.js +0 -87
  78. package/lib/infrastructure/services/channels/ChannelManager.js.map +0 -1
  79. package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts +0 -10
  80. package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts.map +0 -1
  81. package/lib/infrastructure/services/delivery/NotificationDelivery.js +0 -71
  82. package/lib/infrastructure/services/delivery/NotificationDelivery.js.map +0 -1
  83. package/lib/infrastructure/services/preferences/PreferencesManager.d.ts +0 -18
  84. package/lib/infrastructure/services/preferences/PreferencesManager.d.ts.map +0 -1
  85. package/lib/infrastructure/services/preferences/PreferencesManager.js +0 -65
  86. package/lib/infrastructure/services/preferences/PreferencesManager.js.map +0 -1
  87. package/lib/infrastructure/services/types.d.ts +0 -89
  88. package/lib/infrastructure/services/types.d.ts.map +0 -1
  89. package/lib/infrastructure/services/types.js +0 -7
  90. package/lib/infrastructure/services/types.js.map +0 -1
  91. package/lib/infrastructure/storage/NotificationsStore.d.ts +0 -23
  92. package/lib/infrastructure/storage/NotificationsStore.d.ts.map +0 -1
  93. package/lib/infrastructure/storage/NotificationsStore.js +0 -26
  94. package/lib/infrastructure/storage/NotificationsStore.js.map +0 -1
  95. package/lib/infrastructure/utils/dev.d.ts +0 -5
  96. package/lib/infrastructure/utils/dev.d.ts.map +0 -1
  97. package/lib/infrastructure/utils/dev.js +0 -24
  98. package/lib/infrastructure/utils/dev.js.map +0 -1
  99. package/lib/presentation/components/NotificationsSection.d.ts +0 -17
  100. package/lib/presentation/components/NotificationsSection.d.ts.map +0 -1
  101. package/lib/presentation/components/NotificationsSection.js +0 -133
  102. package/lib/presentation/components/NotificationsSection.js.map +0 -1
  103. package/lib/presentation/screens/NotificationsScreen.d.ts +0 -20
  104. package/lib/presentation/screens/NotificationsScreen.d.ts.map +0 -1
  105. package/lib/presentation/screens/NotificationsScreen.js +0 -74
  106. package/lib/presentation/screens/NotificationsScreen.js.map +0 -1
  107. package/src/__tests__/NotificationManager.test.ts +0 -215
  108. package/src/__tests__/useNotificationActions.test.ts +0 -189
  109. package/src/__tests__/useNotificationRefresh.test.ts +0 -213
  110. package/src/infrastructure/hooks/actions/useNotificationActions.ts +0 -131
  111. package/src/infrastructure/hooks/actions/useNotificationManagementActions.ts +0 -131
  112. package/src/infrastructure/hooks/state/useNotificationsState.ts +0 -46
  113. package/src/infrastructure/hooks/types.ts +0 -83
  114. package/src/infrastructure/hooks/useNotifications.ts +0 -96
  115. package/src/infrastructure/hooks/utils/useNotificationRefresh.ts +0 -131
  116. package/src/infrastructure/services/channels/ChannelManager.ts +0 -111
  117. package/src/infrastructure/services/delivery/NotificationDelivery.ts +0 -83
  118. package/src/infrastructure/services/preferences/PreferencesManager.ts +0 -77
@@ -1,81 +0,0 @@
1
- /**
2
- * Notifications Configuration
3
- * Defines notification settings structure
4
- */
5
- export const notificationsConfig = {
6
- sections: [
7
- {
8
- id: 'channels',
9
- titleKey: 'notifications.channels',
10
- settings: [
11
- {
12
- id: 'pushNotifications',
13
- titleKey: 'notifications.push',
14
- descKey: 'notifications.pushDesc',
15
- icon: 'notifications',
16
- },
17
- {
18
- id: 'emailNotifications',
19
- titleKey: 'notifications.email',
20
- descKey: 'notifications.emailDesc',
21
- icon: 'email',
22
- },
23
- {
24
- id: 'smsNotifications',
25
- titleKey: 'notifications.sms',
26
- descKey: 'notifications.smsDesc',
27
- icon: 'message',
28
- },
29
- ],
30
- },
31
- {
32
- id: 'content',
33
- titleKey: 'notifications.content',
34
- settings: [
35
- {
36
- id: 'appUpdates',
37
- titleKey: 'notifications.updates',
38
- descKey: 'notifications.updatesDesc',
39
- icon: 'update',
40
- },
41
- {
42
- id: 'features',
43
- titleKey: 'notifications.features',
44
- descKey: 'notifications.featuresDesc',
45
- icon: 'new-releases',
46
- },
47
- {
48
- id: 'tips',
49
- titleKey: 'notifications.tips',
50
- descKey: 'notifications.tipsDesc',
51
- icon: 'tips-and-updates',
52
- },
53
- ],
54
- },
55
- {
56
- id: 'activity',
57
- titleKey: 'notifications.activity',
58
- settings: [
59
- {
60
- id: 'reminders',
61
- titleKey: 'notifications.reminders',
62
- descKey: 'notifications.remindersDesc',
63
- icon: 'alarm',
64
- },
65
- {
66
- id: 'achievements',
67
- titleKey: 'notifications.achievements',
68
- descKey: 'notifications.achievementsDesc',
69
- icon: 'emoji-events',
70
- },
71
- {
72
- id: 'social',
73
- titleKey: 'notifications.social',
74
- descKey: 'notifications.socialDesc',
75
- icon: 'people',
76
- },
77
- ],
78
- },
79
- ],
80
- };
81
- //# sourceMappingURL=notificationsConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notificationsConfig.js","sourceRoot":"","sources":["../../../src/infrastructure/config/notificationsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,MAAM,CAAC,MAAM,mBAAmB,GAAwB;IACtD,QAAQ,EAAE;QACR;YACE,EAAE,EAAE,UAAU;YAC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BAChC,OAAO,EAAE,0BAA0B;oBACnC,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { SendNotificationOptions, Notification } from '../types';
2
- export declare const useNotificationActions: (state: any, setters: any) => {
3
- sendNotification: (options: SendNotificationOptions) => Promise<Notification[]>;
4
- markAsRead: (notificationId: string) => Promise<boolean>;
5
- markAllAsRead: () => Promise<boolean>;
6
- };
7
- //# sourceMappingURL=useNotificationActions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationActions.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationActions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EAGb,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,sBAAsB,GAAI,OAAO,GAAG,EAAE,SAAS,GAAG;gCAc3C,uBAAuB,KAAG,OAAO,CAAC,YAAY,EAAE,CAAC;iCAsC1C,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;yBAkCN,OAAO,CAAC,OAAO,CAAC;CA8B7D,CAAC"}
@@ -1,75 +0,0 @@
1
- import { useCallback } from 'react';
2
- import AsyncStorage from '@react-native-async-storage/async-storage';
3
- import { NotificationDelivery } from '../../services/delivery/NotificationDelivery';
4
- import { ChannelManager } from '../../services/channels/ChannelManager';
5
- import { PreferencesManager } from '../../services/preferences/PreferencesManager';
6
- import { devLog } from '../../utils/dev';
7
- export const useNotificationActions = (state, setters) => {
8
- const { setNotifications, setUnreadCount, setChannels, setPreferences, setError, } = setters;
9
- const notificationDelivery = new NotificationDelivery();
10
- const channelManager = new ChannelManager();
11
- const preferencesManager = new PreferencesManager();
12
- const sendNotification = useCallback(async (options) => {
13
- try {
14
- setError(null);
15
- const notification = {
16
- id: `notif_${Date.now()}`,
17
- title: options.title,
18
- body: options.body,
19
- data: options.data,
20
- scheduled_for: options.scheduled_for?.toISOString(),
21
- created_at: new Date().toISOString(),
22
- read: false,
23
- };
24
- const data = await AsyncStorage.getItem('@notifications:list');
25
- const notifications = data ? JSON.parse(data) : [];
26
- notifications.unshift(notification);
27
- await AsyncStorage.setItem('@notifications:list', JSON.stringify(notifications));
28
- await notificationDelivery.deliver(notification);
29
- devLog('[useNotificationActions] Notification sent:', notification.id);
30
- return [notification];
31
- }
32
- catch (err) {
33
- setError(err instanceof Error ? err.message : 'Failed to send notification');
34
- return [];
35
- }
36
- }, [setError]);
37
- const markAsRead = useCallback(async (notificationId) => {
38
- try {
39
- const data = await AsyncStorage.getItem('@notifications:list');
40
- const notifications = data ? JSON.parse(data) : [];
41
- const updated = notifications.map((n) => n.id === notificationId ? { ...n, read: true } : n);
42
- await AsyncStorage.setItem('@notifications:list', JSON.stringify(updated));
43
- setNotifications((prev) => prev.map((n) => n.id === notificationId ? { ...n, read: true } : n));
44
- setUnreadCount((prev) => Math.max(0, prev - 1));
45
- devLog('[useNotificationActions] Marked as read:', notificationId);
46
- return true;
47
- }
48
- catch (err) {
49
- setError(err instanceof Error ? err.message : 'Failed to mark as read');
50
- return false;
51
- }
52
- }, [setNotifications, setUnreadCount, setError]);
53
- const markAllAsRead = useCallback(async () => {
54
- try {
55
- const data = await AsyncStorage.getItem('@notifications:list');
56
- const notifications = data ? JSON.parse(data) : [];
57
- const updated = notifications.map((n) => ({ ...n, read: true }));
58
- await AsyncStorage.setItem('@notifications:list', JSON.stringify(updated));
59
- setNotifications((prev) => prev.map((n) => ({ ...n, read: true })));
60
- setUnreadCount(0);
61
- devLog('[useNotificationActions] All notifications marked as read');
62
- return true;
63
- }
64
- catch (err) {
65
- setError(err instanceof Error ? err.message : 'Failed to mark all as read');
66
- return false;
67
- }
68
- }, [setNotifications, setUnreadCount, setError]);
69
- return {
70
- sendNotification,
71
- markAsRead,
72
- markAllAsRead,
73
- };
74
- };
75
- //# sourceMappingURL=useNotificationActions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationActions.js","sourceRoot":"","sources":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C,IAAoB,EAAE,EAAE,CACxC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CACxC,CAAC;YACF,cAAc,CAAC,CAAC,CAAC,CAAC;YAElB,MAAM,CAAC,2DAA2D,CAAC,CAAC;YAEpE,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CACN,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAClE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,gBAAgB,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjD,OAAO;QACL,gBAAgB;QAChB,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { NotificationChannel, NotificationPreferences } from '../types';
2
- export declare const useNotificationManagementActions: (state: any, setters: any) => {
3
- deleteNotification: (notificationId: string) => Promise<boolean>;
4
- registerChannel: (channelType: "push" | "in_app", preferences?: Record<string, any>) => Promise<NotificationChannel | null>;
5
- verifyChannel: (channelId: string) => Promise<boolean>;
6
- updatePreferences: (newPreferences: Partial<NotificationPreferences>) => Promise<boolean>;
7
- };
8
- //# sourceMappingURL=useNotificationManagementActions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationManagementActions.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationManagementActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAKlB,eAAO,MAAM,gCAAgC,GAAI,OAAO,GAAG,EAAE,SAAS,GAAG;yCAO9C,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;mCAoCjC,MAAM,GAAG,QAAQ,gBACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC/B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;+BAqBpB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;wCAyBpB,OAAO,CAAC,uBAAuB,CAAC,KAAG,OAAO,CAAC,OAAO,CAAC;CA4B7E,CAAC"}
@@ -1,78 +0,0 @@
1
- import { useCallback } from 'react';
2
- import AsyncStorage from '@react-native-async-storage/async-storage';
3
- import { ChannelManager } from '../../services/channels/ChannelManager';
4
- import { PreferencesManager } from '../../services/preferences/PreferencesManager';
5
- import { devLog } from '../../utils/dev';
6
- export const useNotificationManagementActions = (state, setters) => {
7
- const { setNotifications, setUnreadCount, setChannels, setPreferences, setError } = setters;
8
- const channelManager = new ChannelManager();
9
- const preferencesManager = new PreferencesManager();
10
- const deleteNotification = useCallback(async (notificationId) => {
11
- try {
12
- const data = await AsyncStorage.getItem('@notifications:list');
13
- const notifications = data ? JSON.parse(data) : [];
14
- const deleted = notifications.find((n) => n.id === notificationId);
15
- const filtered = notifications.filter((n) => n.id !== notificationId);
16
- await AsyncStorage.setItem('@notifications:list', JSON.stringify(filtered));
17
- setNotifications((prev) => prev.filter((n) => n.id !== notificationId));
18
- if (deleted && !deleted.read) {
19
- setUnreadCount((prev) => Math.max(0, prev - 1));
20
- }
21
- devLog('[useNotificationManagementActions] Deleted notification:', notificationId);
22
- return true;
23
- }
24
- catch (err) {
25
- setError(err instanceof Error ? err.message : 'Failed to delete notification');
26
- return false;
27
- }
28
- }, [setNotifications, setUnreadCount, setError]);
29
- const registerChannel = useCallback(async (channelType, preferences = {}) => {
30
- try {
31
- const channel = await channelManager.register(channelType, preferences);
32
- if (channel) {
33
- setChannels((prev) => [...prev, channel]);
34
- }
35
- devLog('[useNotificationManagementActions] Channel registered:', channel?.id);
36
- return channel;
37
- }
38
- catch (err) {
39
- setError(err instanceof Error ? err.message : 'Failed to register channel');
40
- return null;
41
- }
42
- }, [setChannels, setError]);
43
- const verifyChannel = useCallback(async (channelId) => {
44
- try {
45
- const success = await channelManager.verify(channelId);
46
- if (success) {
47
- setChannels((prev) => prev.map((c) => c.id === channelId ? { ...c, is_verified: true } : c));
48
- }
49
- devLog('[useNotificationManagementActions] Channel verified:', channelId, success);
50
- return success;
51
- }
52
- catch (err) {
53
- setError(err instanceof Error ? err.message : 'Failed to verify channel');
54
- return false;
55
- }
56
- }, [setChannels, setError]);
57
- const updatePreferences = useCallback(async (newPreferences) => {
58
- try {
59
- const success = await preferencesManager.update(newPreferences);
60
- if (success) {
61
- setPreferences((prev) => prev ? { ...prev, ...newPreferences } : null);
62
- }
63
- devLog('[useNotificationManagementActions] Preferences updated:', newPreferences);
64
- return success;
65
- }
66
- catch (err) {
67
- setError(err instanceof Error ? err.message : 'Failed to update preferences');
68
- return false;
69
- }
70
- }, [setPreferences, setError]);
71
- return {
72
- deleteNotification,
73
- registerChannel,
74
- verifyChannel,
75
- updatePreferences,
76
- };
77
- };
78
- //# sourceMappingURL=useNotificationManagementActions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationManagementActions.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationManagementActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAMrE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,KAAU,EAAE,OAAY,EAAE,EAAE;IAC3E,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE5F,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,C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,CAAC;YAED,MAAM,CAAC,sDAAsD,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAEnF,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CACN,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAChE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAC;IAEF,MAAM,iBAAiB,GAAG,WAAW,CACnC,KAAK,EAAE,cAAgD,EAAoB,EAAE;QAC3E,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YAChE,IAAI,OAAO,EAAE,CAAC;gBACZ,cAAc,CAAC,CAAC,IAAoC,EAAE,EAAE,CACtD,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAC7C,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,yDAAyD,EAAE,cAAc,CAAC,CAAC;YAElF,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CACN,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B,CACpE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,QAAQ,CAAC,CAC3B,CAAC;IAEF,OAAO;QACL,kBAAkB;QAClB,eAAe;QACf,aAAa;QACb,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { NotificationsState } from '../types';
2
- export declare const useNotificationsState: () => {
3
- state: NotificationsState;
4
- setNotifications: (notifications: NotificationsState["notifications"]) => void;
5
- setChannels: (channels: NotificationsState["channels"]) => void;
6
- setUnreadCount: (unreadCount: number) => void;
7
- setPreferences: (preferences: NotificationsState["preferences"]) => void;
8
- setLoading: (loading: boolean) => void;
9
- setError: (error: string | null) => void;
10
- setHasMore: (hasMore: boolean) => void;
11
- };
12
- //# sourceMappingURL=useNotificationsState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationsState.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/state/useNotificationsState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,qBAAqB;;sCAWS,kBAAkB,CAAC,eAAe,CAAC;4BAG7C,kBAAkB,CAAC,UAAU,CAAC;kCAGxB,MAAM;kCAGN,kBAAkB,CAAC,aAAa,CAAC;0BAGzC,OAAO;sBAGX,MAAM,GAAG,IAAI;0BAGT,OAAO;CAarC,CAAC"}
@@ -1,30 +0,0 @@
1
- import { useState } from 'react';
2
- export const useNotificationsState = () => {
3
- const [state, setState] = useState({
4
- notifications: [],
5
- channels: [],
6
- unreadCount: 0,
7
- preferences: null,
8
- loading: false,
9
- error: null,
10
- hasMore: true,
11
- });
12
- const setNotifications = (notifications) => setState(prev => ({ ...prev, notifications }));
13
- const setChannels = (channels) => setState(prev => ({ ...prev, channels }));
14
- const setUnreadCount = (unreadCount) => setState(prev => ({ ...prev, unreadCount }));
15
- const setPreferences = (preferences) => setState(prev => ({ ...prev, preferences }));
16
- const setLoading = (loading) => setState(prev => ({ ...prev, loading }));
17
- const setError = (error) => setState(prev => ({ ...prev, error }));
18
- const setHasMore = (hasMore) => setState(prev => ({ ...prev, hasMore }));
19
- return {
20
- state,
21
- setNotifications,
22
- setChannels,
23
- setUnreadCount,
24
- setPreferences,
25
- setLoading,
26
- setError,
27
- setHasMore,
28
- };
29
- };
30
- //# sourceMappingURL=useNotificationsState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationsState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EAAE,EAAE,CACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,EAAE,CACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO;QACL,KAAK;QACL,gBAAgB;QAChB,WAAW;QACX,cAAc;QACd,cAAc;QACd,UAAU;QACV,QAAQ;QACR,UAAU;KACX,CAAC;AACJ,CAAC,CAAC"}
@@ -1,87 +0,0 @@
1
- /**
2
- * Notification Hook Types - Offline-First
3
- *
4
- * All types for offline local notifications.
5
- * NO backend dependencies.
6
- */
7
- /**
8
- * Local notification entity
9
- */
10
- export interface Notification {
11
- id: string;
12
- title: string;
13
- body: string;
14
- data?: Record<string, any>;
15
- scheduled_for?: string;
16
- created_at: string;
17
- read: boolean;
18
- }
19
- /**
20
- * Notification channel (push or in-app only)
21
- */
22
- export interface NotificationChannel {
23
- id: string;
24
- channel_type: 'push' | 'in_app';
25
- channel_address: string;
26
- preferences: Record<string, any>;
27
- is_verified: boolean;
28
- is_active: boolean;
29
- created_at: string;
30
- }
31
- /**
32
- * Notification preferences
33
- */
34
- export interface NotificationPreferences {
35
- push_enabled: boolean;
36
- quiet_hours: {
37
- enabled: boolean;
38
- start_time: string;
39
- end_time: string;
40
- timezone: string;
41
- };
42
- categories: {
43
- reminders: {
44
- push: boolean;
45
- in_app: boolean;
46
- };
47
- updates: {
48
- push: boolean;
49
- in_app: boolean;
50
- };
51
- alerts: {
52
- push: boolean;
53
- in_app: boolean;
54
- };
55
- };
56
- }
57
- /**
58
- * Options for sending notification
59
- */
60
- export interface SendNotificationOptions {
61
- title: string;
62
- body: string;
63
- data?: Record<string, any>;
64
- scheduled_for?: Date;
65
- category?: 'reminders' | 'updates' | 'alerts';
66
- }
67
- /**
68
- * State for useNotifications hook
69
- */
70
- export interface NotificationsState {
71
- notifications: Notification[];
72
- channels: NotificationChannel[];
73
- unreadCount: number;
74
- preferences: NotificationPreferences | null;
75
- loading: boolean;
76
- error: string | null;
77
- hasMore: boolean;
78
- }
79
- /**
80
- * Options for useNotifications hook
81
- */
82
- export interface UseNotificationsOptions {
83
- autoRefresh?: boolean;
84
- refreshInterval?: number;
85
- pageSize?: number;
86
- }
87
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hooks/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,EAAE;QACV,SAAS,EAAE;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC;QAC9C,OAAO,EAAE;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC;QAC5C,MAAM,EAAE;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC;KAC5C,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Notification Hook Types - Offline-First
3
- *
4
- * All types for offline local notifications.
5
- * NO backend dependencies.
6
- */
7
- export {};
8
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/infrastructure/hooks/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Simple notification settings hook
3
- * Manages a single toggle for enabling/disabling notifications
4
- */
5
- export declare const useNotificationSettings: () => {
6
- notificationsEnabled: boolean;
7
- setNotificationsEnabled: (value: boolean) => Promise<void>;
8
- isLoading: boolean;
9
- };
10
- //# sourceMappingURL=useNotificationSettings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationSettings.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotificationSettings.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;qCAqBQ,OAAO;;CAclD,CAAC"}
@@ -1,43 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import AsyncStorage from '@react-native-async-storage/async-storage';
3
- const STORAGE_KEY = 'notifications_enabled';
4
- /**
5
- * Simple notification settings hook
6
- * Manages a single toggle for enabling/disabling notifications
7
- */
8
- export const useNotificationSettings = () => {
9
- const [notificationsEnabled, setNotificationsEnabled] = useState(true);
10
- const [isLoading, setIsLoading] = useState(true);
11
- useEffect(() => {
12
- const loadSettings = async () => {
13
- try {
14
- const value = await AsyncStorage.getItem(STORAGE_KEY);
15
- if (value !== null) {
16
- setNotificationsEnabled(value === 'true');
17
- }
18
- }
19
- catch (error) {
20
- // Silent failure - use default value
21
- }
22
- finally {
23
- setIsLoading(false);
24
- }
25
- };
26
- loadSettings();
27
- }, []);
28
- const toggleNotifications = async (value) => {
29
- setNotificationsEnabled(value);
30
- try {
31
- await AsyncStorage.setItem(STORAGE_KEY, value.toString());
32
- }
33
- catch (error) {
34
- // Silent failure
35
- }
36
- };
37
- return {
38
- notificationsEnabled,
39
- setNotificationsEnabled: toggleNotifications,
40
- isLoading,
41
- };
42
- };
43
- //# sourceMappingURL=useNotificationSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationSettings.js","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotificationSettings.ts"],"names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,CAAC"}
@@ -1,24 +0,0 @@
1
- import type { UseNotificationsOptions } from './types';
2
- export * from './types';
3
- export declare function useNotifications(userId: string, options?: UseNotificationsOptions): {
4
- loadMoreNotifications: () => Promise<void>;
5
- cleanup: () => void;
6
- refreshNotifications: () => Promise<void>;
7
- refreshChannels: () => Promise<void>;
8
- refreshPreferences: () => Promise<void>;
9
- deleteNotification: (notificationId: string) => Promise<boolean>;
10
- registerChannel: (channelType: "push" | "in_app", preferences?: Record<string, any>) => Promise<import("./types").NotificationChannel | null>;
11
- verifyChannel: (channelId: string) => Promise<boolean>;
12
- updatePreferences: (newPreferences: Partial<import("./types").NotificationPreferences>) => Promise<boolean>;
13
- sendNotification: (options: import("./types").SendNotificationOptions) => Promise<import("./types").Notification[]>;
14
- markAsRead: (notificationId: string) => Promise<boolean>;
15
- markAllAsRead: () => Promise<boolean>;
16
- notifications: import("./types").Notification[];
17
- channels: import("./types").NotificationChannel[];
18
- unreadCount: number;
19
- preferences: import("./types").NotificationPreferences | null;
20
- loading: boolean;
21
- error: string | null;
22
- hasMore: boolean;
23
- };
24
- //# sourceMappingURL=useNotifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotifications.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGvD,cAAc,SAAS,CAAC;AAExB,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;;;;;EAqFrF"}
@@ -1,72 +0,0 @@
1
- import { useEffect, useCallback } from 'react';
2
- import { useNotificationsState } from './state/useNotificationsState';
3
- import { useNotificationActions } from './actions/useNotificationActions';
4
- import { useNotificationManagementActions } from './actions/useNotificationManagementActions';
5
- import { useNotificationRefresh } from './utils/useNotificationRefresh';
6
- import { devLog } from '../utils/dev';
7
- export * from './types';
8
- export function useNotifications(userId, options = {}) {
9
- const { autoRefresh = false, refreshInterval = 30000, pageSize = 20 } = options;
10
- const { state, setNotifications, setChannels, setUnreadCount, setPreferences, setLoading, setError, setHasMore, } = useNotificationsState();
11
- const setters = {
12
- setNotifications,
13
- setChannels,
14
- setUnreadCount,
15
- setPreferences,
16
- setLoading,
17
- setError,
18
- setHasMore,
19
- };
20
- const actions = useNotificationActions(state, setters);
21
- const managementActions = useNotificationManagementActions(state, setters);
22
- const refresh = useNotificationRefresh(pageSize, setters);
23
- const loadMoreNotifications = useCallback(() => refresh.loadMoreNotifications(state.notifications.length, state.hasMore, state.loading), [refresh, state.notifications.length, state.hasMore, state.loading]);
24
- const cleanup = useCallback(() => {
25
- setNotifications([]);
26
- setChannels([]);
27
- setUnreadCount(0);
28
- setPreferences(null);
29
- setError(null);
30
- setLoading(false);
31
- setHasMore(true);
32
- devLog('[useNotifications] Cleaned up notification state');
33
- }, [setNotifications, setChannels, setUnreadCount, setPreferences, setError, setLoading, setHasMore]);
34
- // Load initial data
35
- useEffect(() => {
36
- if (userId) {
37
- refresh.refreshNotifications();
38
- refresh.refreshChannels();
39
- refresh.refreshPreferences();
40
- }
41
- else {
42
- cleanup();
43
- }
44
- }, [userId, cleanup]);
45
- // Auto-refresh setup with proper cleanup
46
- useEffect(() => {
47
- if (!autoRefresh || !userId)
48
- return;
49
- const interval = setInterval(() => {
50
- refresh.refreshNotifications();
51
- }, refreshInterval);
52
- return () => {
53
- clearInterval(interval);
54
- devLog('[useNotifications] Auto-refresh interval cleared');
55
- };
56
- }, [autoRefresh, userId, refreshInterval]);
57
- // Cleanup on unmount
58
- useEffect(() => {
59
- return () => {
60
- devLog('[useNotifications] Component unmounted, cleaning up');
61
- };
62
- }, []);
63
- return {
64
- ...state,
65
- ...actions,
66
- ...managementActions,
67
- ...refresh,
68
- loadMoreNotifications,
69
- cleanup,
70
- };
71
- }
72
- //# sourceMappingURL=useNotifications.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotifications.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EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE3C,qBAAqB;IACrB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,qDAAqD,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,GAAG,KAAK;QACR,GAAG,OAAO;QACV,GAAG,iBAAiB;QACpB,GAAG,OAAO;QACV,qBAAqB;QACrB,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare const useNotificationRefresh: (pageSize: number, setters: any) => {
2
- refreshNotifications: () => Promise<void>;
3
- loadMoreNotifications: (currentLength: number, hasMore: boolean, loading: boolean) => Promise<void>;
4
- refreshChannels: () => Promise<void>;
5
- refreshPreferences: () => Promise<void>;
6
- cleanup: () => void;
7
- };
8
- //# sourceMappingURL=useNotificationRefresh.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationRefresh.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/utils/useNotificationRefresh.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,EAAE,SAAS,GAAG;;2CAuD3C,MAAM,WAAW,OAAO,WAAW,OAAO;;;;CAoEnE,CAAC"}