captify 0.1.19 → 1.1.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/agents/components/agents-list-header.d.ts.map +1 -1
- package/dist/agents/components/agents-list-header.js +3 -2
- package/dist/agents/components/agents-list-header.js.map +1 -1
- package/dist/chat/components/chat-content-approval.d.ts.map +1 -1
- package/dist/chat/components/chat-content-approval.js.map +1 -1
- package/dist/chat/components/chat-context-toggle.d.ts.map +1 -1
- package/dist/chat/components/chat-context-toggle.js +2 -4
- package/dist/chat/components/chat-context-toggle.js.map +1 -1
- package/dist/comments/comments.constants.d.ts +8 -1
- package/dist/comments/comments.constants.d.ts.map +1 -1
- package/dist/comments/comments.constants.js +18 -0
- package/dist/comments/comments.constants.js.map +1 -1
- package/dist/comments/comments.interfaces.d.ts +5 -0
- package/dist/comments/comments.interfaces.d.ts.map +1 -1
- package/dist/comments/comments.utilities.d.ts +30 -1
- package/dist/comments/comments.utilities.d.ts.map +1 -1
- package/dist/comments/comments.utilities.js +41 -1
- package/dist/comments/comments.utilities.js.map +1 -1
- package/dist/comments/hooks/use-comments.d.ts.map +1 -1
- package/dist/comments/hooks/use-comments.js +1 -0
- package/dist/comments/hooks/use-comments.js.map +1 -1
- package/dist/comments/services/comments.factory.d.ts.map +1 -1
- package/dist/comments/services/comments.factory.js +5 -2
- package/dist/comments/services/comments.factory.js.map +1 -1
- package/dist/comments/services/comments.service.d.ts +9 -2
- package/dist/comments/services/comments.service.d.ts.map +1 -1
- package/dist/comments/services/comments.service.js +96 -4
- package/dist/comments/services/comments.service.js.map +1 -1
- package/dist/db/schemas/index.d.ts +6 -4
- package/dist/db/schemas/index.d.ts.map +1 -1
- package/dist/db/schemas/index.js +2 -1
- package/dist/db/schemas/index.js.map +1 -1
- package/dist/db/schemas/notifications.schema.d.ts +107 -0
- package/dist/db/schemas/notifications.schema.d.ts.map +1 -0
- package/dist/db/schemas/notifications.schema.js +124 -0
- package/dist/db/schemas/notifications.schema.js.map +1 -0
- package/dist/feedback/api/feedback.handlers.d.ts.map +1 -1
- package/dist/feedback/api/feedback.handlers.js +1 -0
- package/dist/feedback/api/feedback.handlers.js.map +1 -1
- package/dist/feedback/components/feedback-editor.d.ts.map +1 -1
- package/dist/feedback/components/feedback-editor.js +6 -4
- package/dist/feedback/components/feedback-editor.js.map +1 -1
- package/dist/feedback/feedback.interfaces.d.ts +24 -1
- package/dist/feedback/feedback.interfaces.d.ts.map +1 -1
- package/dist/feedback/services/feedback.service.d.ts +26 -3
- package/dist/feedback/services/feedback.service.d.ts.map +1 -1
- package/dist/feedback/services/feedback.service.js +270 -11
- package/dist/feedback/services/feedback.service.js.map +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.d.ts.map +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.js +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.js.map +1 -1
- package/dist/files/components/folder-browser/folder-list-item.js +1 -1
- package/dist/files/components/folder-browser/folder-list-item.js.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.d.ts.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.js +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.js.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-sidebar.js +1 -1
- package/dist/files/components/folder-browser/folder-tree-sidebar.js.map +1 -1
- package/dist/notifications/api/index.d.ts +7 -0
- package/dist/notifications/api/index.d.ts.map +1 -0
- package/dist/notifications/api/index.js +8 -0
- package/dist/notifications/api/index.js.map +1 -0
- package/dist/notifications/api/notifications.client.d.ts +86 -0
- package/dist/notifications/api/notifications.client.d.ts.map +1 -0
- package/dist/notifications/api/notifications.client.js +102 -0
- package/dist/notifications/api/notifications.client.js.map +1 -0
- package/dist/notifications/api/notifications.handlers.d.ts +166 -0
- package/dist/notifications/api/notifications.handlers.d.ts.map +1 -0
- package/dist/notifications/api/notifications.handlers.js +187 -0
- package/dist/notifications/api/notifications.handlers.js.map +1 -0
- package/dist/notifications/hooks/index.d.ts +5 -0
- package/dist/notifications/hooks/index.d.ts.map +1 -0
- package/dist/notifications/hooks/index.js +5 -0
- package/dist/notifications/hooks/index.js.map +1 -0
- package/dist/notifications/hooks/use-notifications-api.d.ts +111 -0
- package/dist/notifications/hooks/use-notifications-api.d.ts.map +1 -0
- package/dist/notifications/hooks/use-notifications-api.js +253 -0
- package/dist/notifications/hooks/use-notifications-api.js.map +1 -0
- package/dist/notifications/index.d.ts +16 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +18 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notification.utilities.d.ts +12 -0
- package/dist/notifications/notification.utilities.d.ts.map +1 -0
- package/dist/notifications/notification.utilities.js +35 -0
- package/dist/notifications/notification.utilities.js.map +1 -0
- package/dist/notifications/notifications.constants.d.ts +72 -0
- package/dist/notifications/notifications.constants.d.ts.map +1 -0
- package/dist/notifications/notifications.constants.js +104 -0
- package/dist/notifications/notifications.constants.js.map +1 -0
- package/dist/notifications/notifications.errors.d.ts +35 -0
- package/dist/notifications/notifications.errors.d.ts.map +1 -0
- package/dist/notifications/notifications.errors.js +51 -0
- package/dist/notifications/notifications.errors.js.map +1 -0
- package/dist/notifications/notifications.interfaces.d.ts +116 -0
- package/dist/notifications/notifications.interfaces.d.ts.map +1 -0
- package/dist/notifications/notifications.interfaces.js +10 -0
- package/dist/notifications/notifications.interfaces.js.map +1 -0
- package/dist/notifications/notifications.schemas.d.ts +139 -0
- package/dist/notifications/notifications.schemas.d.ts.map +1 -0
- package/dist/notifications/notifications.schemas.js +167 -0
- package/dist/notifications/notifications.schemas.js.map +1 -0
- package/dist/notifications/services/index.d.ts +6 -0
- package/dist/notifications/services/index.d.ts.map +1 -0
- package/dist/notifications/services/index.js +6 -0
- package/dist/notifications/services/index.js.map +1 -0
- package/dist/notifications/services/notifications.factory.d.ts +19 -0
- package/dist/notifications/services/notifications.factory.d.ts.map +1 -0
- package/dist/notifications/services/notifications.factory.js +58 -0
- package/dist/notifications/services/notifications.factory.js.map +1 -0
- package/dist/notifications/services/notifications.service.d.ts +88 -0
- package/dist/notifications/services/notifications.service.d.ts.map +1 -0
- package/dist/notifications/services/notifications.service.js +620 -0
- package/dist/notifications/services/notifications.service.js.map +1 -0
- package/dist/permissions/api/permissions.handlers.d.ts +20 -20
- package/dist/permissions/components/resource-panel.d.ts.map +1 -1
- package/dist/permissions/components/resource-panel.js +2 -1
- package/dist/permissions/components/resource-panel.js.map +1 -1
- package/dist/permissions/hooks/index.d.ts +1 -0
- package/dist/permissions/hooks/index.d.ts.map +1 -1
- package/dist/permissions/hooks/index.js +1 -0
- package/dist/permissions/hooks/index.js.map +1 -1
- package/dist/permissions/hooks/use-notification-permissions.d.ts +19 -0
- package/dist/permissions/hooks/use-notification-permissions.d.ts.map +1 -0
- package/dist/permissions/hooks/use-notification-permissions.js +32 -0
- package/dist/permissions/hooks/use-notification-permissions.js.map +1 -0
- package/dist/permissions/hooks/use-permissions-dashboard.d.ts +6 -6
- package/dist/permissions/hooks/use-policies.d.ts +2 -2
- package/dist/permissions/permissions.constants.d.ts +5 -0
- package/dist/permissions/permissions.constants.d.ts.map +1 -1
- package/dist/permissions/permissions.constants.js +35 -0
- package/dist/permissions/permissions.constants.js.map +1 -1
- package/dist/permissions/permissions.interfaces.d.ts +12 -0
- package/dist/permissions/permissions.interfaces.d.ts.map +1 -1
- package/dist/permissions/permissions.schemas.d.ts +56 -21
- package/dist/permissions/permissions.schemas.d.ts.map +1 -1
- package/dist/permissions/permissions.schemas.js +6 -1
- package/dist/permissions/permissions.schemas.js.map +1 -1
- package/dist/search/components/global-search-bar.d.ts.map +1 -1
- package/dist/search/components/global-search-bar.js +10 -11
- package/dist/search/components/global-search-bar.js.map +1 -1
- package/dist/shared/components/skeleton/console-layout-skeleton.d.ts +9 -21
- package/dist/shared/components/skeleton/console-layout-skeleton.d.ts.map +1 -1
- package/dist/shared/components/skeleton/console-layout-skeleton.js +13 -29
- package/dist/shared/components/skeleton/console-layout-skeleton.js.map +1 -1
- package/dist/shared/components/ui/sidebar.js +9 -9
- package/dist/shared/components/ui/sidebar.js.map +1 -1
- package/dist/shared/shared.constants.d.ts +1 -0
- package/dist/shared/shared.constants.d.ts.map +1 -1
- package/dist/shared/shared.constants.js +1 -0
- package/dist/shared/shared.constants.js.map +1 -1
- package/dist/shared/shared.interfaces.d.ts +0 -1
- package/dist/shared/shared.interfaces.d.ts.map +1 -1
- package/dist/shell/components/ConsoleLayout.d.ts +1 -1
- package/dist/shell/components/ConsoleLayout.d.ts.map +1 -1
- package/dist/shell/components/ConsoleLayout.js +6 -3
- package/dist/shell/components/ConsoleLayout.js.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher-search-bar.js +1 -1
- package/dist/shell/components/app-launcher/app-launcher-search-bar.js.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher.js +2 -1
- package/dist/shell/components/app-launcher/app-launcher.js.map +1 -1
- package/dist/shell/components/app-launcher/category-navigation.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/category-navigation.js +9 -2
- package/dist/shell/components/app-launcher/category-navigation.js.map +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.d.ts +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.js +3 -4
- package/dist/shell/components/app-launcher/left-sidebar.js.map +1 -1
- package/dist/shell/components/app-launcher/service-item.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/service-item.js +2 -2
- package/dist/shell/components/app-launcher/service-item.js.map +1 -1
- package/dist/shell/components/index.d.ts +1 -0
- package/dist/shell/components/index.d.ts.map +1 -1
- package/dist/shell/components/index.js +2 -0
- package/dist/shell/components/index.js.map +1 -1
- package/dist/shell/components/layouts/app-sidebar.d.ts +4 -1
- package/dist/shell/components/layouts/app-sidebar.d.ts.map +1 -1
- package/dist/shell/components/layouts/app-sidebar.js +39 -6
- package/dist/shell/components/layouts/app-sidebar.js.map +1 -1
- package/dist/shell/components/layouts/content-header.d.ts.map +1 -1
- package/dist/shell/components/layouts/content-header.js +5 -24
- package/dist/shell/components/layouts/content-header.js.map +1 -1
- package/dist/shell/components/layouts/index.d.ts +1 -3
- package/dist/shell/components/layouts/index.d.ts.map +1 -1
- package/dist/shell/components/layouts/index.js +1 -3
- package/dist/shell/components/layouts/index.js.map +1 -1
- package/dist/shell/components/layouts/sidebar-nested-item.d.ts.map +1 -1
- package/dist/shell/components/layouts/sidebar-nested-item.js +12 -5
- package/dist/shell/components/layouts/sidebar-nested-item.js.map +1 -1
- package/dist/shell/components/notifications/notification-container.d.ts +16 -2
- package/dist/shell/components/notifications/notification-container.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-container.js +75 -4
- package/dist/shell/components/notifications/notification-container.js.map +1 -1
- package/dist/shell/components/notifications/notification-item.d.ts +1 -1
- package/dist/shell/components/notifications/notification-item.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-item.js +26 -7
- package/dist/shell/components/notifications/notification-item.js.map +1 -1
- package/dist/shell/components/notifications/notification-panel-header.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-panel-header.js +4 -1
- package/dist/shell/components/notifications/notification-panel-header.js.map +1 -1
- package/dist/shell/components/notifications/notifications.d.ts +1 -1
- package/dist/shell/components/notifications/notifications.d.ts.map +1 -1
- package/dist/shell/components/notifications/notifications.js +2 -2
- package/dist/shell/components/notifications/notifications.js.map +1 -1
- package/dist/shell/components/toolbars/index.d.ts +1 -4
- package/dist/shell/components/toolbars/index.d.ts.map +1 -1
- package/dist/shell/components/toolbars/index.js +2 -5
- package/dist/shell/components/toolbars/index.js.map +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.d.ts +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.d.ts.map +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.js +2 -2
- package/dist/shell/components/toolbars/top-right-toolbar.js.map +1 -1
- package/dist/shell/components/toolbars/top-toolbar-feedback.js +1 -1
- package/dist/shell/components/toolbars/top-toolbar-feedback.js.map +1 -1
- package/dist/shell/shell.constants.d.ts +1 -1
- package/dist/shell/shell.constants.js +1 -1
- package/dist/shell/shell.interfaces.d.ts +8 -4
- package/dist/shell/shell.interfaces.d.ts.map +1 -1
- package/dist/shell/shell.utilities.d.ts +7 -0
- package/dist/shell/shell.utilities.d.ts.map +1 -1
- package/dist/shell/shell.utilities.js +17 -0
- package/dist/shell/shell.utilities.js.map +1 -1
- package/package.json +130 -12
- package/dist/chat/components/chat-assistant-legacy.d.ts +0 -9
- package/dist/chat/components/chat-assistant-legacy.d.ts.map +0 -1
- package/dist/chat/components/chat-assistant-legacy.js +0 -73
- package/dist/chat/components/chat-assistant-legacy.js.map +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { UseNotificationsApiOptions } from "../notifications.interfaces";
|
|
2
|
+
import type { Notification } from "../../shell/shell.interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Hook for managing notifications with React Query
|
|
5
|
+
*
|
|
6
|
+
* Provides queries for fetching notifications and unread count,
|
|
7
|
+
* and mutations for mark-as-read and dismiss actions.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Hook configuration options
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const {
|
|
14
|
+
* notifications,
|
|
15
|
+
* unreadCount,
|
|
16
|
+
* isLoading,
|
|
17
|
+
* markAsRead,
|
|
18
|
+
* markAllAsRead,
|
|
19
|
+
* dismiss,
|
|
20
|
+
* } = useNotificationsApi({ limit: 20, enablePolling: true });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useNotificationsApi(options?: UseNotificationsApiOptions): {
|
|
24
|
+
notifications: Notification[];
|
|
25
|
+
notificationsRaw: {
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
updatedAt: number;
|
|
29
|
+
createdById: string;
|
|
30
|
+
tenantId: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
type: "mention" | "reply" | "feedback_created" | "feedback_status_changed" | "feedback_assigned" | "feedback_updated";
|
|
33
|
+
title: string;
|
|
34
|
+
message: string;
|
|
35
|
+
read: boolean;
|
|
36
|
+
isDismissed: boolean;
|
|
37
|
+
url: string;
|
|
38
|
+
actorId: string;
|
|
39
|
+
actorName: string;
|
|
40
|
+
entityId: string;
|
|
41
|
+
entityType: string;
|
|
42
|
+
sourceId: string;
|
|
43
|
+
sourceType: "feedback" | "comment";
|
|
44
|
+
ttl: number;
|
|
45
|
+
modifiedById?: string | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
unreadCount: number;
|
|
48
|
+
nextCursor: string | undefined;
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
isLoading: boolean;
|
|
51
|
+
isLoadingUnreadCount: boolean;
|
|
52
|
+
isFetching: boolean;
|
|
53
|
+
error: Error | null;
|
|
54
|
+
unreadCountError: Error | null;
|
|
55
|
+
markAsRead: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
56
|
+
notificationId: string;
|
|
57
|
+
read: boolean;
|
|
58
|
+
}, Error, string, {
|
|
59
|
+
previousList: import("../notifications.interfaces").PaginatedNotifications | undefined;
|
|
60
|
+
previousCount: {
|
|
61
|
+
count: number;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
markAllAsRead: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
65
|
+
updatedCount: number;
|
|
66
|
+
}, Error, void, {
|
|
67
|
+
previousList: import("../notifications.interfaces").PaginatedNotifications | undefined;
|
|
68
|
+
previousCount: {
|
|
69
|
+
count: number;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
dismiss: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
73
|
+
notificationId: string;
|
|
74
|
+
isDismissed: boolean;
|
|
75
|
+
}, Error, string, {
|
|
76
|
+
previousList: import("../notifications.interfaces").PaginatedNotifications | undefined;
|
|
77
|
+
previousCount: {
|
|
78
|
+
count: number;
|
|
79
|
+
} | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
dismissAll: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
82
|
+
dismissedCount: number;
|
|
83
|
+
}, Error, void, {
|
|
84
|
+
previousList: import("../notifications.interfaces").PaginatedNotifications | undefined;
|
|
85
|
+
previousCount: {
|
|
86
|
+
count: number;
|
|
87
|
+
} | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
isMarkingAsRead: boolean;
|
|
90
|
+
isMarkingAllAsRead: boolean;
|
|
91
|
+
isDismissing: boolean;
|
|
92
|
+
isDismissingAll: boolean;
|
|
93
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../notifications.interfaces").PaginatedNotifications, Error>>;
|
|
94
|
+
refetchUnreadCount: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
95
|
+
count: number;
|
|
96
|
+
}, Error>>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Hook for fetching more notifications (pagination)
|
|
100
|
+
*
|
|
101
|
+
* @param cursor - The cursor from previous fetch
|
|
102
|
+
* @param options - Hook options
|
|
103
|
+
*/
|
|
104
|
+
export declare function useLoadMoreNotifications(cursor: string | undefined, options?: Omit<UseNotificationsApiOptions, "enablePolling">): {
|
|
105
|
+
notifications: Notification[];
|
|
106
|
+
nextCursor: string | undefined;
|
|
107
|
+
hasMore: boolean;
|
|
108
|
+
isLoading: boolean;
|
|
109
|
+
error: Error | null;
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=use-notifications-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-notifications-api.d.ts","sourceRoot":"","sources":["../../../lib/notifications/hooks/use-notifications-api.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmQ3E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,GAAE,IAAI,CAAC,0BAA0B,EAAE,eAAe,CAAM;;;;;;EAiBhE"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dismissAllRequest, dismissNotificationRequest, fetchNotifications, fetchUnreadCount, markAllAsReadRequest, markAsReadRequest, } from "../api/notifications.client";
|
|
3
|
+
import { toDisplayNotification } from "../notification.utilities";
|
|
4
|
+
import { DEFAULT_POLLING_INTERVAL_MS, NOTIFICATIONS_QUERY_KEYS, } from "../notifications.constants";
|
|
5
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
/**
|
|
7
|
+
* Hook for managing notifications with React Query
|
|
8
|
+
*
|
|
9
|
+
* Provides queries for fetching notifications and unread count,
|
|
10
|
+
* and mutations for mark-as-read and dismiss actions.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Hook configuration options
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const {
|
|
17
|
+
* notifications,
|
|
18
|
+
* unreadCount,
|
|
19
|
+
* isLoading,
|
|
20
|
+
* markAsRead,
|
|
21
|
+
* markAllAsRead,
|
|
22
|
+
* dismiss,
|
|
23
|
+
* } = useNotificationsApi({ limit: 20, enablePolling: true });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function useNotificationsApi(options = {}) {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
|
+
const { limit = 20, enablePolling = true, pollingInterval = DEFAULT_POLLING_INTERVAL_MS, unreadOnly = false, } = options;
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
// Query for notifications list
|
|
31
|
+
const notificationsQuery = useQuery({
|
|
32
|
+
queryKey: NOTIFICATIONS_QUERY_KEYS.list({ limit, unreadOnly }),
|
|
33
|
+
queryFn: () => fetchNotifications({ limit, unreadOnly }),
|
|
34
|
+
refetchInterval: enablePolling ? pollingInterval : false,
|
|
35
|
+
refetchOnWindowFocus: true,
|
|
36
|
+
});
|
|
37
|
+
// Query for unread count (for badge)
|
|
38
|
+
const unreadCountQuery = useQuery({
|
|
39
|
+
queryKey: NOTIFICATIONS_QUERY_KEYS.unreadCount(),
|
|
40
|
+
queryFn: () => fetchUnreadCount(),
|
|
41
|
+
refetchInterval: enablePolling ? pollingInterval : false,
|
|
42
|
+
refetchOnWindowFocus: true,
|
|
43
|
+
});
|
|
44
|
+
// Query key for the current list (used in optimistic updates)
|
|
45
|
+
const listQueryKey = NOTIFICATIONS_QUERY_KEYS.list({ limit, unreadOnly });
|
|
46
|
+
const unreadCountQueryKey = NOTIFICATIONS_QUERY_KEYS.unreadCount();
|
|
47
|
+
// Mutation for marking a notification as read (with optimistic update)
|
|
48
|
+
const markAsReadMutation = useMutation({
|
|
49
|
+
mutationFn: (notificationId) => markAsReadRequest(notificationId),
|
|
50
|
+
onMutate: async (notificationId) => {
|
|
51
|
+
// Cancel any outgoing refetches
|
|
52
|
+
await queryClient.cancelQueries({ queryKey: listQueryKey });
|
|
53
|
+
await queryClient.cancelQueries({ queryKey: unreadCountQueryKey });
|
|
54
|
+
// Snapshot previous values
|
|
55
|
+
const previousList = queryClient.getQueryData(listQueryKey);
|
|
56
|
+
const previousCount = queryClient.getQueryData(unreadCountQueryKey);
|
|
57
|
+
// Optimistically update the notification list
|
|
58
|
+
if (previousList) {
|
|
59
|
+
const notification = previousList.notifications.find((n) => n.id === notificationId);
|
|
60
|
+
const wasUnread = notification && !notification.read;
|
|
61
|
+
// When unreadOnly is true, remove the item from the list (it's no longer unread)
|
|
62
|
+
// Otherwise, just mark it as read
|
|
63
|
+
const updatedNotifications = unreadOnly
|
|
64
|
+
? previousList.notifications.filter((n) => n.id !== notificationId)
|
|
65
|
+
: previousList.notifications.map((n) => n.id === notificationId ? Object.assign(Object.assign({}, n), { read: true }) : n);
|
|
66
|
+
queryClient.setQueryData(listQueryKey, Object.assign(Object.assign({}, previousList), { notifications: updatedNotifications }));
|
|
67
|
+
// Decrease unread count if notification was unread
|
|
68
|
+
if (wasUnread && previousCount !== undefined && previousCount.count > 0) {
|
|
69
|
+
queryClient.setQueryData(unreadCountQueryKey, {
|
|
70
|
+
count: previousCount.count - 1,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { previousList, previousCount };
|
|
75
|
+
},
|
|
76
|
+
onError: (_err, _notificationId, context) => {
|
|
77
|
+
// Rollback on error
|
|
78
|
+
if (context === null || context === void 0 ? void 0 : context.previousList) {
|
|
79
|
+
queryClient.setQueryData(listQueryKey, context.previousList);
|
|
80
|
+
}
|
|
81
|
+
if ((context === null || context === void 0 ? void 0 : context.previousCount) !== undefined) {
|
|
82
|
+
queryClient.setQueryData(unreadCountQueryKey, context.previousCount);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
onSettled: () => {
|
|
86
|
+
// Refetch to ensure consistency
|
|
87
|
+
queryClient.invalidateQueries({ queryKey: NOTIFICATIONS_QUERY_KEYS.lists() });
|
|
88
|
+
queryClient.invalidateQueries({ queryKey: unreadCountQueryKey });
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
// Mutation for marking all notifications as read (with optimistic update)
|
|
92
|
+
const markAllAsReadMutation = useMutation({
|
|
93
|
+
mutationFn: () => markAllAsReadRequest(),
|
|
94
|
+
onMutate: async () => {
|
|
95
|
+
// Cancel any outgoing refetches
|
|
96
|
+
await queryClient.cancelQueries({ queryKey: listQueryKey });
|
|
97
|
+
await queryClient.cancelQueries({ queryKey: unreadCountQueryKey });
|
|
98
|
+
// Snapshot previous values
|
|
99
|
+
const previousList = queryClient.getQueryData(listQueryKey);
|
|
100
|
+
const previousCount = queryClient.getQueryData(unreadCountQueryKey);
|
|
101
|
+
// Optimistically mark all as read
|
|
102
|
+
// When unreadOnly is true, clear the list (all items are now read)
|
|
103
|
+
// Otherwise, just mark all as read
|
|
104
|
+
if (previousList) {
|
|
105
|
+
queryClient.setQueryData(listQueryKey, Object.assign(Object.assign({}, previousList), { notifications: unreadOnly
|
|
106
|
+
? []
|
|
107
|
+
: previousList.notifications.map((n) => (Object.assign(Object.assign({}, n), { read: true }))) }));
|
|
108
|
+
}
|
|
109
|
+
// Set unread count to 0
|
|
110
|
+
queryClient.setQueryData(unreadCountQueryKey, { count: 0 });
|
|
111
|
+
return { previousList, previousCount };
|
|
112
|
+
},
|
|
113
|
+
onError: (_err, _vars, context) => {
|
|
114
|
+
// Rollback on error
|
|
115
|
+
if (context === null || context === void 0 ? void 0 : context.previousList) {
|
|
116
|
+
queryClient.setQueryData(listQueryKey, context.previousList);
|
|
117
|
+
}
|
|
118
|
+
if ((context === null || context === void 0 ? void 0 : context.previousCount) !== undefined) {
|
|
119
|
+
queryClient.setQueryData(unreadCountQueryKey, context.previousCount);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
onSettled: () => {
|
|
123
|
+
// Refetch to ensure consistency
|
|
124
|
+
queryClient.invalidateQueries({ queryKey: NOTIFICATIONS_QUERY_KEYS.lists() });
|
|
125
|
+
queryClient.invalidateQueries({ queryKey: unreadCountQueryKey });
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
// Mutation for dismissing a notification (with optimistic update)
|
|
129
|
+
const dismissMutation = useMutation({
|
|
130
|
+
mutationFn: (notificationId) => dismissNotificationRequest(notificationId),
|
|
131
|
+
onMutate: async (notificationId) => {
|
|
132
|
+
// Cancel any outgoing refetches
|
|
133
|
+
await queryClient.cancelQueries({ queryKey: listQueryKey });
|
|
134
|
+
await queryClient.cancelQueries({ queryKey: unreadCountQueryKey });
|
|
135
|
+
// Snapshot previous values
|
|
136
|
+
const previousList = queryClient.getQueryData(listQueryKey);
|
|
137
|
+
const previousCount = queryClient.getQueryData(unreadCountQueryKey);
|
|
138
|
+
// Optimistically remove the notification
|
|
139
|
+
if (previousList) {
|
|
140
|
+
const notification = previousList.notifications.find((n) => n.id === notificationId);
|
|
141
|
+
const wasUnread = notification && !notification.read;
|
|
142
|
+
queryClient.setQueryData(listQueryKey, Object.assign(Object.assign({}, previousList), { notifications: previousList.notifications.filter((n) => n.id !== notificationId) }));
|
|
143
|
+
// Decrease unread count if notification was unread
|
|
144
|
+
if (wasUnread && previousCount !== undefined && previousCount.count > 0) {
|
|
145
|
+
queryClient.setQueryData(unreadCountQueryKey, {
|
|
146
|
+
count: previousCount.count - 1,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return { previousList, previousCount };
|
|
151
|
+
},
|
|
152
|
+
onError: (_err, _notificationId, context) => {
|
|
153
|
+
// Rollback on error
|
|
154
|
+
if (context === null || context === void 0 ? void 0 : context.previousList) {
|
|
155
|
+
queryClient.setQueryData(listQueryKey, context.previousList);
|
|
156
|
+
}
|
|
157
|
+
if ((context === null || context === void 0 ? void 0 : context.previousCount) !== undefined) {
|
|
158
|
+
queryClient.setQueryData(unreadCountQueryKey, context.previousCount);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
onSettled: () => {
|
|
162
|
+
// Refetch to ensure consistency
|
|
163
|
+
queryClient.invalidateQueries({ queryKey: NOTIFICATIONS_QUERY_KEYS.lists() });
|
|
164
|
+
queryClient.invalidateQueries({ queryKey: unreadCountQueryKey });
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
// Mutation for dismissing all notifications (with optimistic update)
|
|
168
|
+
const dismissAllMutation = useMutation({
|
|
169
|
+
mutationFn: () => dismissAllRequest(),
|
|
170
|
+
onMutate: async () => {
|
|
171
|
+
// Cancel any outgoing refetches
|
|
172
|
+
await queryClient.cancelQueries({ queryKey: listQueryKey });
|
|
173
|
+
await queryClient.cancelQueries({ queryKey: unreadCountQueryKey });
|
|
174
|
+
// Snapshot previous values
|
|
175
|
+
const previousList = queryClient.getQueryData(listQueryKey);
|
|
176
|
+
const previousCount = queryClient.getQueryData(unreadCountQueryKey);
|
|
177
|
+
// Optimistically clear all notifications
|
|
178
|
+
if (previousList) {
|
|
179
|
+
queryClient.setQueryData(listQueryKey, Object.assign(Object.assign({}, previousList), { notifications: [], nextCursor: undefined }));
|
|
180
|
+
}
|
|
181
|
+
// Set unread count to 0
|
|
182
|
+
queryClient.setQueryData(unreadCountQueryKey, { count: 0 });
|
|
183
|
+
return { previousList, previousCount };
|
|
184
|
+
},
|
|
185
|
+
onError: (_err, _vars, context) => {
|
|
186
|
+
// Rollback on error
|
|
187
|
+
if (context === null || context === void 0 ? void 0 : context.previousList) {
|
|
188
|
+
queryClient.setQueryData(listQueryKey, context.previousList);
|
|
189
|
+
}
|
|
190
|
+
if ((context === null || context === void 0 ? void 0 : context.previousCount) !== undefined) {
|
|
191
|
+
queryClient.setQueryData(unreadCountQueryKey, context.previousCount);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
onSettled: () => {
|
|
195
|
+
// Refetch to ensure consistency
|
|
196
|
+
queryClient.invalidateQueries({ queryKey: NOTIFICATIONS_QUERY_KEYS.lists() });
|
|
197
|
+
queryClient.invalidateQueries({ queryKey: unreadCountQueryKey });
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
// Convert notifications to display format
|
|
201
|
+
const notifications = (((_a = notificationsQuery.data) === null || _a === void 0 ? void 0 : _a.notifications) || []).map(toDisplayNotification);
|
|
202
|
+
return {
|
|
203
|
+
// Notifications data
|
|
204
|
+
notifications,
|
|
205
|
+
notificationsRaw: ((_b = notificationsQuery.data) === null || _b === void 0 ? void 0 : _b.notifications) || [],
|
|
206
|
+
unreadCount: (_d = (_c = unreadCountQuery.data) === null || _c === void 0 ? void 0 : _c.count) !== null && _d !== void 0 ? _d : 0,
|
|
207
|
+
nextCursor: (_e = notificationsQuery.data) === null || _e === void 0 ? void 0 : _e.nextCursor,
|
|
208
|
+
hasMore: !!((_f = notificationsQuery.data) === null || _f === void 0 ? void 0 : _f.nextCursor),
|
|
209
|
+
// Loading states
|
|
210
|
+
isLoading: notificationsQuery.isLoading,
|
|
211
|
+
isLoadingUnreadCount: unreadCountQuery.isLoading,
|
|
212
|
+
isFetching: notificationsQuery.isFetching,
|
|
213
|
+
// Error states
|
|
214
|
+
error: notificationsQuery.error,
|
|
215
|
+
unreadCountError: unreadCountQuery.error,
|
|
216
|
+
// Mutations
|
|
217
|
+
markAsRead: markAsReadMutation.mutateAsync,
|
|
218
|
+
markAllAsRead: markAllAsReadMutation.mutateAsync,
|
|
219
|
+
dismiss: dismissMutation.mutateAsync,
|
|
220
|
+
dismissAll: dismissAllMutation.mutateAsync,
|
|
221
|
+
// Mutation states
|
|
222
|
+
isMarkingAsRead: markAsReadMutation.isPending,
|
|
223
|
+
isMarkingAllAsRead: markAllAsReadMutation.isPending,
|
|
224
|
+
isDismissing: dismissMutation.isPending,
|
|
225
|
+
isDismissingAll: dismissAllMutation.isPending,
|
|
226
|
+
// Refetch functions
|
|
227
|
+
refetch: notificationsQuery.refetch,
|
|
228
|
+
refetchUnreadCount: unreadCountQuery.refetch,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Hook for fetching more notifications (pagination)
|
|
233
|
+
*
|
|
234
|
+
* @param cursor - The cursor from previous fetch
|
|
235
|
+
* @param options - Hook options
|
|
236
|
+
*/
|
|
237
|
+
export function useLoadMoreNotifications(cursor, options = {}) {
|
|
238
|
+
var _a, _b, _c;
|
|
239
|
+
const { limit = 20, unreadOnly = false } = options;
|
|
240
|
+
const query = useQuery({
|
|
241
|
+
queryKey: NOTIFICATIONS_QUERY_KEYS.list({ limit, unreadOnly, cursor }),
|
|
242
|
+
queryFn: () => fetchNotifications({ limit, unreadOnly, cursor }),
|
|
243
|
+
enabled: !!cursor,
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
notifications: (((_a = query.data) === null || _a === void 0 ? void 0 : _a.notifications) || []).map(toDisplayNotification),
|
|
247
|
+
nextCursor: (_b = query.data) === null || _b === void 0 ? void 0 : _b.nextCursor,
|
|
248
|
+
hasMore: !!((_c = query.data) === null || _c === void 0 ? void 0 : _c.nextCursor),
|
|
249
|
+
isLoading: query.isLoading,
|
|
250
|
+
error: query.error,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=use-notifications-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-notifications-api.js","sourceRoot":"","sources":["../../../lib/notifications/hooks/use-notifications-api.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAsC,EAAE;;IAC1E,MAAM,EACJ,KAAK,GAAG,EAAE,EACV,aAAa,GAAG,IAAI,EACpB,eAAe,GAAG,2BAA2B,EAC7C,UAAU,GAAG,KAAK,GACnB,GAAG,OAAO,CAAC;IAEZ,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,+BAA+B;IAC/B,MAAM,kBAAkB,G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AK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Module
|
|
3
|
+
*
|
|
4
|
+
* In-app notification system for user events (mentions, replies).
|
|
5
|
+
*/
|
|
6
|
+
export { DEFAULT_NOTIFICATIONS_LIMIT, DEFAULT_POLLING_INTERVAL_MS, MAX_MESSAGE_LENGTH, MAX_NOTIFICATIONS_LIMIT, MAX_TITLE_LENGTH, MAX_URL_LENGTH, NOTIFICATION_SOURCE_TYPES, NOTIFICATION_TYPES, NOTIFICATIONS_API_ENDPOINT, NOTIFICATIONS_ERROR_MESSAGES, NOTIFICATIONS_QUERY_KEYS, } from "./notifications.constants";
|
|
7
|
+
export type { NotificationSourceType, NotificationType, } from "./notifications.constants";
|
|
8
|
+
export { InvalidNotificationTypeError, NotificationCreateError, NotificationNotFoundError, NotificationUnauthorizedError, NotificationUpdateError, } from "./notifications.errors";
|
|
9
|
+
export type { CreateNotificationParams, DismissNotificationParams, GetUnreadCountParams, ListNotificationsParams, MarkAllAsReadParams, MarkAsReadParams, Notification, NotificationsOperationOptions, NotificationsServiceConfig, PaginatedNotifications, } from "./notifications.interfaces";
|
|
10
|
+
export { createNotificationSchema, dismissNotificationSchema, getUnreadCountSchema, listNotificationsSchema, markAllAsReadSchema, markAsReadSchema, notificationEntitySchema, notificationSourceTypeSchema, notificationTypeSchema, } from "./notifications.schemas";
|
|
11
|
+
export type { CreateNotificationSchemaInput, DismissNotificationSchemaInput, GetUnreadCountSchemaInput, ListNotificationsSchemaInput, MarkAllAsReadSchemaInput, MarkAsReadSchemaInput, NotificationEntity, } from "./notifications.schemas";
|
|
12
|
+
export { getNotificationsService, NotificationsService, resetNotificationsService, } from "./services";
|
|
13
|
+
export { dismissNotificationRequest, fetchNotifications, fetchUnreadCount, markAllAsReadRequest, markAsReadRequest, } from "./api";
|
|
14
|
+
export type { DismissAllResponse, DismissNotificationResponse, MarkAllAsReadResponse, MarkAsReadResponse, NotificationsListResponse, UnreadCountResponse, } from "./api";
|
|
15
|
+
export { useLoadMoreNotifications, useNotificationsApi } from "./hooks";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,6CAA6C,CAAC;AACrD,YAAY,EACV,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,0CAA0C,CAAC;AAGlD,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACV,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Module
|
|
3
|
+
*
|
|
4
|
+
* In-app notification system for user events (mentions, replies).
|
|
5
|
+
*/
|
|
6
|
+
// Constants
|
|
7
|
+
export { DEFAULT_NOTIFICATIONS_LIMIT, DEFAULT_POLLING_INTERVAL_MS, MAX_MESSAGE_LENGTH, MAX_NOTIFICATIONS_LIMIT, MAX_TITLE_LENGTH, MAX_URL_LENGTH, NOTIFICATION_SOURCE_TYPES, NOTIFICATION_TYPES, NOTIFICATIONS_API_ENDPOINT, NOTIFICATIONS_ERROR_MESSAGES, NOTIFICATIONS_QUERY_KEYS, } from "./notifications.constants";
|
|
8
|
+
// Errors
|
|
9
|
+
export { InvalidNotificationTypeError, NotificationCreateError, NotificationNotFoundError, NotificationUnauthorizedError, NotificationUpdateError, } from "./notifications.errors";
|
|
10
|
+
// Schemas
|
|
11
|
+
export { createNotificationSchema, dismissNotificationSchema, getUnreadCountSchema, listNotificationsSchema, markAllAsReadSchema, markAsReadSchema, notificationEntitySchema, notificationSourceTypeSchema, notificationTypeSchema, } from "./notifications.schemas";
|
|
12
|
+
// Services
|
|
13
|
+
export { getNotificationsService, NotificationsService, resetNotificationsService, } from "./services";
|
|
14
|
+
// Client API
|
|
15
|
+
export { dismissNotificationRequest, fetchNotifications, fetchUnreadCount, markAllAsReadRequest, markAsReadRequest, } from "./api";
|
|
16
|
+
// Hooks
|
|
17
|
+
export { useLoadMoreNotifications, useNotificationsApi } from "./hooks";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY;AACZ,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,6CAA6C,CAAC;AAMrD,SAAS;AACT,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,0CAA0C,CAAC;AAgBlD,UAAU;AACV,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,2CAA2C,CAAC;AAWnD,WAAW;AACX,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,aAAa;AACb,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAUjC,QAAQ;AACR,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Notification as CoreNotification } from "./notifications.interfaces";
|
|
2
|
+
import type { Notification as ShellNotification } from "../shell/shell.interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Convert NotificationDisplay from API to shell Notification interface
|
|
5
|
+
*/
|
|
6
|
+
export declare function toShellNotification(notification: ShellNotification): ShellNotification;
|
|
7
|
+
/**
|
|
8
|
+
* Convert a Notification to the display format used by UI components
|
|
9
|
+
* (matches the Notification interface in shell.interfaces.ts)
|
|
10
|
+
*/
|
|
11
|
+
export declare function toDisplayNotification(notification: CoreNotification): ShellNotification;
|
|
12
|
+
//# sourceMappingURL=notification.utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.utilities.d.ts","sourceRoot":"","sources":["../../lib/notifications/notification.utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,iBAAiB,GAAG,iBAAiB,CAWtF;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,gBAAgB,GAAG,iBAAiB,CAWvF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert NotificationDisplay from API to shell Notification interface
|
|
3
|
+
*/
|
|
4
|
+
export function toShellNotification(notification) {
|
|
5
|
+
return {
|
|
6
|
+
id: notification.id,
|
|
7
|
+
title: notification.title,
|
|
8
|
+
message: notification.message,
|
|
9
|
+
read: notification.read,
|
|
10
|
+
createdAt: new Date(notification.createdAt),
|
|
11
|
+
url: notification.url,
|
|
12
|
+
actorName: notification.actorName,
|
|
13
|
+
type: notification.type,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Utility Functions
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Convert a Notification to the display format used by UI components
|
|
21
|
+
* (matches the Notification interface in shell.interfaces.ts)
|
|
22
|
+
*/
|
|
23
|
+
export function toDisplayNotification(notification) {
|
|
24
|
+
return {
|
|
25
|
+
id: notification.id,
|
|
26
|
+
title: notification.title,
|
|
27
|
+
message: notification.message,
|
|
28
|
+
read: notification.read,
|
|
29
|
+
createdAt: new Date(notification.createdAt),
|
|
30
|
+
url: notification.url,
|
|
31
|
+
actorName: notification.actorName,
|
|
32
|
+
type: notification.type,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=notification.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.utilities.js","sourceRoot":"","sources":["../../lib/notifications/notification.utilities.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAA+B;IACjE,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,EAAE;QACnB,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;QAC3C,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,IAAI,EAAE,YAAY,CAAC,IAAI;KACxB,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAA8B;IAClE,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,EAAE;QACnB,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;QAC3C,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,IAAI,EAAE,YAAY,CAAC,IAAI;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Service Constants
|
|
3
|
+
*/
|
|
4
|
+
import { type LucideIcon } from "lucide-react";
|
|
5
|
+
/** Default API endpoint for notifications */
|
|
6
|
+
export declare const NOTIFICATIONS_API_ENDPOINT = "/api/notifications";
|
|
7
|
+
/** Supported notification types */
|
|
8
|
+
export declare const NOTIFICATION_TYPES: {
|
|
9
|
+
readonly MENTION: "mention";
|
|
10
|
+
readonly REPLY: "reply";
|
|
11
|
+
readonly FEEDBACK_CREATED: "feedback_created";
|
|
12
|
+
readonly FEEDBACK_STATUS_CHANGED: "feedback_status_changed";
|
|
13
|
+
readonly FEEDBACK_ASSIGNED: "feedback_assigned";
|
|
14
|
+
readonly FEEDBACK_UPDATED: "feedback_updated";
|
|
15
|
+
};
|
|
16
|
+
export type NotificationType = (typeof NOTIFICATION_TYPES)[keyof typeof NOTIFICATION_TYPES];
|
|
17
|
+
/** Mapping of notification types to their icons and colors for UI display */
|
|
18
|
+
export declare const NOTIFICATION_TYPE_CONFIG: Record<string, {
|
|
19
|
+
icon: LucideIcon;
|
|
20
|
+
className: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Supported notification source types */
|
|
23
|
+
export declare const NOTIFICATION_SOURCE_TYPES: {
|
|
24
|
+
readonly COMMENT: "comment";
|
|
25
|
+
readonly FEEDBACK: "feedback";
|
|
26
|
+
};
|
|
27
|
+
export type NotificationSourceType = (typeof NOTIFICATION_SOURCE_TYPES)[keyof typeof NOTIFICATION_SOURCE_TYPES];
|
|
28
|
+
/** Notification titles for different notification types */
|
|
29
|
+
export declare const NOTIFICATION_TITLES: {
|
|
30
|
+
readonly MENTION: "New Mention";
|
|
31
|
+
readonly REPLY: "New Reply";
|
|
32
|
+
readonly FEEDBACK_ASSIGNED: "New Feedback Assigned";
|
|
33
|
+
readonly FEEDBACK_REASSIGNED: "Feedback Assigned to You";
|
|
34
|
+
readonly FEEDBACK_STATUS_CHANGED: "Feedback Status Updated";
|
|
35
|
+
readonly FEEDBACK_UPDATED: "Feedback Updated";
|
|
36
|
+
readonly FEEDBACK_CREATED: "New Feedback Created";
|
|
37
|
+
};
|
|
38
|
+
/** Default number of notifications to fetch */
|
|
39
|
+
export declare const DEFAULT_NOTIFICATIONS_LIMIT = 20;
|
|
40
|
+
/** Maximum number of notifications to fetch in one request */
|
|
41
|
+
export declare const MAX_NOTIFICATIONS_LIMIT = 100;
|
|
42
|
+
/** Default polling interval for notifications in milliseconds (30 seconds) */
|
|
43
|
+
export declare const DEFAULT_POLLING_INTERVAL_MS: number;
|
|
44
|
+
/** Maximum length of notification title */
|
|
45
|
+
export declare const MAX_TITLE_LENGTH = 100;
|
|
46
|
+
/** Maximum length of notification message */
|
|
47
|
+
export declare const MAX_MESSAGE_LENGTH = 500;
|
|
48
|
+
/** Maximum length of notification URL */
|
|
49
|
+
export declare const MAX_URL_LENGTH = 2000;
|
|
50
|
+
/** Default TTL for notifications in days (90 days). Server-side only - no need to expose to client. */
|
|
51
|
+
export declare const DEFAULT_NOTIFICATION_TTL_DAYS: number;
|
|
52
|
+
/** Convert days to seconds for DynamoDB TTL */
|
|
53
|
+
export declare const NOTIFICATION_TTL_SECONDS: number;
|
|
54
|
+
/**
|
|
55
|
+
* Notifications service error message constants
|
|
56
|
+
*/
|
|
57
|
+
export declare const NOTIFICATIONS_ERROR_MESSAGES: {
|
|
58
|
+
readonly NOTIFICATION_NOT_FOUND: (notificationId: string) => string;
|
|
59
|
+
readonly UNAUTHORIZED: (action: string) => string;
|
|
60
|
+
readonly INVALID_NOTIFICATION_TYPE: (type: string) => string;
|
|
61
|
+
readonly CREATE_FAILED: (reason: string) => string;
|
|
62
|
+
readonly UPDATE_FAILED: (reason: string) => string;
|
|
63
|
+
};
|
|
64
|
+
/** React Query key factory for notifications */
|
|
65
|
+
export declare const NOTIFICATIONS_QUERY_KEYS: {
|
|
66
|
+
readonly all: readonly ["notifications"];
|
|
67
|
+
readonly lists: () => readonly ["notifications", "list"];
|
|
68
|
+
readonly list: (filters: Record<string, unknown>) => readonly ["notifications", "list", Record<string, unknown>];
|
|
69
|
+
readonly unreadCount: () => readonly ["notifications", "unread-count"];
|
|
70
|
+
readonly detail: (id: string) => readonly ["notifications", "detail", string];
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=notifications.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.constants.d.ts","sourceRoot":"","sources":["../../lib/notifications/notifications.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,UAAU,EAKhB,MAAM,cAAc,CAAC;AAMtB,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAM/D,mCAAmC;AACnC,eAAO,MAAM,kBAAkB;;;;;;;CAOrB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE5F,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAU5F,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAM7E,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB;;;;;;;;CAQtB,CAAC;AAMX,+CAA+C;AAC/C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAM3C,8EAA8E;AAC9E,eAAO,MAAM,2BAA2B,QACoC,CAAC;AAM7E,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,yCAA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