@novu/react 3.0.0 → 3.0.3
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/cjs/hooks/NovuProvider.cjs +1 -1
- package/dist/esm/hooks/NovuProvider.js +1 -1
- package/package.json +2 -2
- package/dist/client/components/index.d.mts +0 -168
- package/dist/client/components/index.d.ts +0 -168
- package/dist/client/components/index.js +0 -853
- package/dist/client/components/index.js.map +0 -1
- package/dist/client/components/index.mjs +0 -805
- package/dist/client/components/index.mjs.map +0 -1
- package/dist/client/hooks/index.d.mts +0 -75
- package/dist/client/hooks/index.d.ts +0 -75
- package/dist/client/hooks/index.js +0 -395
- package/dist/client/hooks/index.js.map +0 -1
- package/dist/client/hooks/index.mjs +0 -364
- package/dist/client/hooks/index.mjs.map +0 -1
- package/dist/client/themes/index.d.mts +0 -1
- package/dist/client/themes/index.d.ts +0 -1
- package/dist/client/themes/index.js +0 -25
- package/dist/client/themes/index.js.map +0 -1
- package/dist/client/themes/index.mjs +0 -3
- package/dist/client/themes/index.mjs.map +0 -1
- package/dist/server/index.d.mts +0 -141
- package/dist/server/index.d.ts +0 -141
- package/dist/server/index.js +0 -415
- package/dist/server/index.js.map +0 -1
- package/dist/server/index.mjs +0 -379
- package/dist/server/index.mjs.map +0 -1
package/dist/server/index.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { Notification, NotificationClickHandler, NotificationActionClickHandler, InboxProps as InboxProps$1, Appearance, Localization, Tab, PreferencesFilter, RouterPush } from '@novu/js/ui';
|
|
2
|
-
export { Notification } from '@novu/js/ui';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { Novu, NovuOptions, Notification as Notification$1, NovuError, Preference, NotificationFilter } from '@novu/js';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
type NotificationsRenderer = (notification: Notification) => React.ReactNode;
|
|
8
|
-
type SubjectRenderer = (notification: Notification) => React.ReactNode;
|
|
9
|
-
type BodyRenderer = (notification: Notification) => React.ReactNode;
|
|
10
|
-
type BellRenderer = (unreadCount: number) => React.ReactNode;
|
|
11
|
-
type DefaultInboxProps = {
|
|
12
|
-
open?: boolean;
|
|
13
|
-
renderNotification?: NotificationsRenderer;
|
|
14
|
-
renderSubject?: SubjectRenderer;
|
|
15
|
-
renderBody?: BodyRenderer;
|
|
16
|
-
renderBell?: BellRenderer;
|
|
17
|
-
onNotificationClick?: NotificationClickHandler;
|
|
18
|
-
onPrimaryActionClick?: NotificationActionClickHandler;
|
|
19
|
-
onSecondaryActionClick?: NotificationActionClickHandler;
|
|
20
|
-
placement?: InboxProps$1['placement'];
|
|
21
|
-
placementOffset?: InboxProps$1['placementOffset'];
|
|
22
|
-
};
|
|
23
|
-
type BaseProps = {
|
|
24
|
-
applicationIdentifier: string;
|
|
25
|
-
subscriberId: string;
|
|
26
|
-
subscriberHash?: string;
|
|
27
|
-
backendUrl?: string;
|
|
28
|
-
socketUrl?: string;
|
|
29
|
-
appearance?: Appearance;
|
|
30
|
-
localization?: Localization;
|
|
31
|
-
tabs?: Array<Tab>;
|
|
32
|
-
preferencesFilter?: PreferencesFilter;
|
|
33
|
-
routerPush?: RouterPush;
|
|
34
|
-
};
|
|
35
|
-
type NotificationRendererProps = {
|
|
36
|
-
renderNotification: NotificationsRenderer;
|
|
37
|
-
renderSubject?: never;
|
|
38
|
-
renderBody?: never;
|
|
39
|
-
};
|
|
40
|
-
type SubjectBodyRendererProps = {
|
|
41
|
-
renderNotification?: never;
|
|
42
|
-
renderSubject?: SubjectRenderer;
|
|
43
|
-
renderBody?: BodyRenderer;
|
|
44
|
-
};
|
|
45
|
-
type NoRendererProps = {
|
|
46
|
-
renderNotification?: undefined;
|
|
47
|
-
renderSubject?: undefined;
|
|
48
|
-
renderBody?: undefined;
|
|
49
|
-
};
|
|
50
|
-
type DefaultProps = BaseProps & DefaultInboxProps & {
|
|
51
|
-
children?: never;
|
|
52
|
-
} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
|
|
53
|
-
type WithChildrenProps = BaseProps & {
|
|
54
|
-
children: React.ReactNode;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
type InboxProps = DefaultProps | WithChildrenProps;
|
|
58
|
-
|
|
59
|
-
type NovuProviderProps = NovuOptions & {
|
|
60
|
-
children: ReactNode;
|
|
61
|
-
};
|
|
62
|
-
declare const NovuProvider: ({ children, applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, }: NovuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
63
|
-
declare const useNovu: () => Novu;
|
|
64
|
-
|
|
65
|
-
type UseNotificationsProps = {
|
|
66
|
-
tags?: string[];
|
|
67
|
-
read?: boolean;
|
|
68
|
-
archived?: boolean;
|
|
69
|
-
limit?: number;
|
|
70
|
-
onSuccess?: (data: Notification$1[]) => void;
|
|
71
|
-
onError?: (error: NovuError) => void;
|
|
72
|
-
};
|
|
73
|
-
declare const useNotifications: (props?: UseNotificationsProps) => {
|
|
74
|
-
readAll: () => Promise<{
|
|
75
|
-
data?: void | undefined;
|
|
76
|
-
error?: NovuError | undefined;
|
|
77
|
-
}>;
|
|
78
|
-
archiveAll: () => Promise<{
|
|
79
|
-
data?: void | undefined;
|
|
80
|
-
error?: NovuError | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
archiveAllRead: () => Promise<{
|
|
83
|
-
data?: void | undefined;
|
|
84
|
-
error?: NovuError | undefined;
|
|
85
|
-
}>;
|
|
86
|
-
notifications: Notification$1[] | undefined;
|
|
87
|
-
error: NovuError | undefined;
|
|
88
|
-
isLoading: boolean;
|
|
89
|
-
isFetching: boolean;
|
|
90
|
-
refetch: () => Promise<void>;
|
|
91
|
-
fetchMore: () => Promise<void>;
|
|
92
|
-
hasMore: boolean;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type UsePreferencesProps = {
|
|
96
|
-
filter?: {
|
|
97
|
-
tags?: string[];
|
|
98
|
-
};
|
|
99
|
-
onSuccess?: (data: Preference[]) => void;
|
|
100
|
-
onError?: (error: NovuError) => void;
|
|
101
|
-
};
|
|
102
|
-
type UsePreferencesResult = {
|
|
103
|
-
preferences?: Preference[];
|
|
104
|
-
error?: NovuError;
|
|
105
|
-
isLoading: boolean;
|
|
106
|
-
isFetching: boolean;
|
|
107
|
-
refetch: () => Promise<void>;
|
|
108
|
-
};
|
|
109
|
-
declare const usePreferences: (props?: UsePreferencesProps) => UsePreferencesResult;
|
|
110
|
-
|
|
111
|
-
type Count = {
|
|
112
|
-
count: number;
|
|
113
|
-
filter: NotificationFilter;
|
|
114
|
-
};
|
|
115
|
-
type UseCountsProps = {
|
|
116
|
-
filters: NotificationFilter[];
|
|
117
|
-
onSuccess?: (data: Count[]) => void;
|
|
118
|
-
onError?: (error: NovuError) => void;
|
|
119
|
-
};
|
|
120
|
-
type UseCountsResult = {
|
|
121
|
-
counts?: Count[];
|
|
122
|
-
error?: NovuError;
|
|
123
|
-
isLoading: boolean;
|
|
124
|
-
isFetching: boolean;
|
|
125
|
-
refetch: () => Promise<void>;
|
|
126
|
-
};
|
|
127
|
-
declare const useCounts: (props: UseCountsProps) => UseCountsResult;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Exporting all components from the components folder
|
|
131
|
-
* as empty functions to fix build errors in SSR
|
|
132
|
-
* This will be replaced with actual components
|
|
133
|
-
* when we implement the SSR components in @novu/js/ui
|
|
134
|
-
*/
|
|
135
|
-
declare function Inbox(): void;
|
|
136
|
-
declare function InboxContent(): void;
|
|
137
|
-
declare function Notifications(): void;
|
|
138
|
-
declare function Preferences(): void;
|
|
139
|
-
declare function Bell(): void;
|
|
140
|
-
|
|
141
|
-
export { type BaseProps, Bell, type BellRenderer, type BodyRenderer, type DefaultInboxProps, type DefaultProps, Inbox, InboxContent, type InboxProps, type NoRendererProps, type NotificationRendererProps, Notifications, type NotificationsRenderer, NovuProvider, Preferences, type SubjectBodyRendererProps, type SubjectRenderer, type UseNotificationsProps, type WithChildrenProps, useCounts, useNotifications, useNovu, usePreferences };
|
package/dist/server/index.js
DELETED
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name2 in all)
|
|
8
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/server/index.ts
|
|
21
|
-
var server_exports = {};
|
|
22
|
-
__export(server_exports, {
|
|
23
|
-
Bell: () => Bell,
|
|
24
|
-
Inbox: () => Inbox,
|
|
25
|
-
InboxContent: () => InboxContent,
|
|
26
|
-
Notifications: () => Notifications,
|
|
27
|
-
NovuProvider: () => NovuProvider,
|
|
28
|
-
Preferences: () => Preferences,
|
|
29
|
-
useCounts: () => useCounts,
|
|
30
|
-
useNotifications: () => useNotifications,
|
|
31
|
-
useNovu: () => useNovu,
|
|
32
|
-
usePreferences: () => usePreferences
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(server_exports);
|
|
35
|
-
|
|
36
|
-
// src/hooks/NovuProvider.tsx
|
|
37
|
-
var import_js = require("@novu/js");
|
|
38
|
-
var import_react = require("react");
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
var version = "2.6.6";
|
|
41
|
-
var name = "@novu/react";
|
|
42
|
-
var baseUserAgent = `${name}@${version}`;
|
|
43
|
-
var NovuContext = (0, import_react.createContext)(void 0);
|
|
44
|
-
var NovuProvider = ({
|
|
45
|
-
children,
|
|
46
|
-
applicationIdentifier,
|
|
47
|
-
subscriberId,
|
|
48
|
-
subscriberHash,
|
|
49
|
-
backendUrl,
|
|
50
|
-
socketUrl,
|
|
51
|
-
useCache
|
|
52
|
-
}) => {
|
|
53
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
-
InternalNovuProvider,
|
|
55
|
-
{
|
|
56
|
-
applicationIdentifier,
|
|
57
|
-
subscriberId,
|
|
58
|
-
subscriberHash,
|
|
59
|
-
backendUrl,
|
|
60
|
-
socketUrl,
|
|
61
|
-
useCache,
|
|
62
|
-
userAgentType: "hooks",
|
|
63
|
-
children
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
var InternalNovuProvider = ({
|
|
68
|
-
children,
|
|
69
|
-
applicationIdentifier,
|
|
70
|
-
subscriberId,
|
|
71
|
-
subscriberHash,
|
|
72
|
-
backendUrl,
|
|
73
|
-
socketUrl,
|
|
74
|
-
useCache,
|
|
75
|
-
userAgentType
|
|
76
|
-
}) => {
|
|
77
|
-
const novu = (0, import_react.useMemo)(
|
|
78
|
-
() => new import_js.Novu({
|
|
79
|
-
applicationIdentifier,
|
|
80
|
-
subscriberId,
|
|
81
|
-
subscriberHash,
|
|
82
|
-
backendUrl,
|
|
83
|
-
socketUrl,
|
|
84
|
-
useCache,
|
|
85
|
-
__userAgent: `${baseUserAgent} ${userAgentType}`
|
|
86
|
-
}),
|
|
87
|
-
[applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, userAgentType]
|
|
88
|
-
);
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NovuContext.Provider, { value: novu, children });
|
|
90
|
-
};
|
|
91
|
-
var useNovu = () => {
|
|
92
|
-
const context = (0, import_react.useContext)(NovuContext);
|
|
93
|
-
if (!context) {
|
|
94
|
-
throw new Error("useNovu must be used within a <NovuProvider />");
|
|
95
|
-
}
|
|
96
|
-
return context;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// src/hooks/useNotifications.ts
|
|
100
|
-
var import_react2 = require("react");
|
|
101
|
-
var import_js2 = require("@novu/js");
|
|
102
|
-
var useNotifications = (props) => {
|
|
103
|
-
const { tags, read, archived = false, limit, onSuccess, onError } = props || {};
|
|
104
|
-
const filterRef = (0, import_react2.useRef)(void 0);
|
|
105
|
-
const { notifications, on } = useNovu();
|
|
106
|
-
const [data, setData] = (0, import_react2.useState)();
|
|
107
|
-
const [error, setError] = (0, import_react2.useState)();
|
|
108
|
-
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
109
|
-
const [isFetching, setIsFetching] = (0, import_react2.useState)(false);
|
|
110
|
-
const [hasMore, setHasMore] = (0, import_react2.useState)(false);
|
|
111
|
-
const length = data?.length;
|
|
112
|
-
const after = length ? data[length - 1].id : void 0;
|
|
113
|
-
const sync = (event) => {
|
|
114
|
-
if (!event.data || filterRef.current && !(0, import_js2.isSameFilter)(filterRef.current, event.data.filter)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
setData(event.data.notifications);
|
|
118
|
-
setHasMore(event.data.hasMore);
|
|
119
|
-
};
|
|
120
|
-
(0, import_react2.useEffect)(() => {
|
|
121
|
-
const cleanup = on("notifications.list.updated", sync);
|
|
122
|
-
return () => {
|
|
123
|
-
cleanup();
|
|
124
|
-
};
|
|
125
|
-
}, []);
|
|
126
|
-
(0, import_react2.useEffect)(() => {
|
|
127
|
-
const newFilter = { tags, read, archived };
|
|
128
|
-
if (filterRef.current && (0, import_js2.isSameFilter)(filterRef.current, newFilter)) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
notifications.clearCache({ filter: filterRef.current });
|
|
132
|
-
filterRef.current = newFilter;
|
|
133
|
-
fetchNotifications({ refetch: true });
|
|
134
|
-
}, [tags, read, archived]);
|
|
135
|
-
const fetchNotifications = async (options) => {
|
|
136
|
-
if (options?.refetch) {
|
|
137
|
-
setError(void 0);
|
|
138
|
-
setIsLoading(true);
|
|
139
|
-
setIsFetching(false);
|
|
140
|
-
}
|
|
141
|
-
setIsFetching(true);
|
|
142
|
-
const response = await notifications.list({
|
|
143
|
-
tags,
|
|
144
|
-
read,
|
|
145
|
-
archived,
|
|
146
|
-
limit,
|
|
147
|
-
after: options?.refetch ? void 0 : after
|
|
148
|
-
});
|
|
149
|
-
if (response.error) {
|
|
150
|
-
setError(response.error);
|
|
151
|
-
onError?.(response.error);
|
|
152
|
-
} else {
|
|
153
|
-
onSuccess?.(response.data.notifications);
|
|
154
|
-
setData(response.data.notifications);
|
|
155
|
-
setHasMore(response.data.hasMore);
|
|
156
|
-
}
|
|
157
|
-
setIsLoading(false);
|
|
158
|
-
setIsFetching(false);
|
|
159
|
-
};
|
|
160
|
-
const refetch = () => {
|
|
161
|
-
notifications.clearCache({ filter: { tags, read, archived } });
|
|
162
|
-
return fetchNotifications({ refetch: true });
|
|
163
|
-
};
|
|
164
|
-
const fetchMore = async () => {
|
|
165
|
-
if (!hasMore || isFetching) return;
|
|
166
|
-
return fetchNotifications();
|
|
167
|
-
};
|
|
168
|
-
const readAll = async () => {
|
|
169
|
-
return await notifications.readAll({ tags });
|
|
170
|
-
};
|
|
171
|
-
const archiveAll = async () => {
|
|
172
|
-
return await notifications.archiveAll({ tags });
|
|
173
|
-
};
|
|
174
|
-
const archiveAllRead = async () => {
|
|
175
|
-
return await notifications.archiveAllRead({ tags });
|
|
176
|
-
};
|
|
177
|
-
return {
|
|
178
|
-
readAll,
|
|
179
|
-
archiveAll,
|
|
180
|
-
archiveAllRead,
|
|
181
|
-
notifications: data,
|
|
182
|
-
error,
|
|
183
|
-
isLoading,
|
|
184
|
-
isFetching,
|
|
185
|
-
refetch,
|
|
186
|
-
fetchMore,
|
|
187
|
-
hasMore
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// src/hooks/usePreferences.ts
|
|
192
|
-
var import_react3 = require("react");
|
|
193
|
-
var usePreferences = (props) => {
|
|
194
|
-
const { onSuccess, onError } = props || {};
|
|
195
|
-
const [data, setData] = (0, import_react3.useState)();
|
|
196
|
-
const { preferences, on } = useNovu();
|
|
197
|
-
const [error, setError] = (0, import_react3.useState)();
|
|
198
|
-
const [isLoading, setIsLoading] = (0, import_react3.useState)(true);
|
|
199
|
-
const [isFetching, setIsFetching] = (0, import_react3.useState)(false);
|
|
200
|
-
const sync = (event) => {
|
|
201
|
-
if (!event.data) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
setData(event.data);
|
|
205
|
-
};
|
|
206
|
-
(0, import_react3.useEffect)(() => {
|
|
207
|
-
fetchPreferences();
|
|
208
|
-
const listUpdatedCleanup = on("preferences.list.updated", sync);
|
|
209
|
-
const listPendingCleanup = on("preferences.list.pending", sync);
|
|
210
|
-
const listResolvedCleanup = on("preferences.list.resolved", sync);
|
|
211
|
-
return () => {
|
|
212
|
-
listUpdatedCleanup();
|
|
213
|
-
listPendingCleanup();
|
|
214
|
-
listResolvedCleanup();
|
|
215
|
-
};
|
|
216
|
-
}, []);
|
|
217
|
-
const fetchPreferences = async () => {
|
|
218
|
-
setIsFetching(true);
|
|
219
|
-
const response = await preferences.list(props?.filter);
|
|
220
|
-
if (response.error) {
|
|
221
|
-
setError(response.error);
|
|
222
|
-
onError?.(response.error);
|
|
223
|
-
} else {
|
|
224
|
-
onSuccess?.(response.data);
|
|
225
|
-
}
|
|
226
|
-
setIsLoading(false);
|
|
227
|
-
setIsFetching(false);
|
|
228
|
-
};
|
|
229
|
-
const refetch = () => {
|
|
230
|
-
preferences.cache.clearAll();
|
|
231
|
-
return fetchPreferences();
|
|
232
|
-
};
|
|
233
|
-
return {
|
|
234
|
-
preferences: data,
|
|
235
|
-
error,
|
|
236
|
-
isLoading,
|
|
237
|
-
isFetching,
|
|
238
|
-
refetch
|
|
239
|
-
};
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
// src/hooks/useCounts.ts
|
|
243
|
-
var import_react6 = require("react");
|
|
244
|
-
var import_js3 = require("@novu/js");
|
|
245
|
-
|
|
246
|
-
// src/hooks/internal/useWebsocketEvent.ts
|
|
247
|
-
var import_react5 = require("react");
|
|
248
|
-
|
|
249
|
-
// src/utils/requestLock.ts
|
|
250
|
-
function requestLock(id, cb) {
|
|
251
|
-
if (!("locks" in navigator)) {
|
|
252
|
-
cb(id);
|
|
253
|
-
return () => {
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
let isFulfilled = false;
|
|
257
|
-
let promiseResolve;
|
|
258
|
-
const promise = new Promise((resolve) => {
|
|
259
|
-
promiseResolve = resolve;
|
|
260
|
-
});
|
|
261
|
-
navigator.locks.request(id, () => {
|
|
262
|
-
if (!isFulfilled) {
|
|
263
|
-
cb(id);
|
|
264
|
-
}
|
|
265
|
-
return promise;
|
|
266
|
-
});
|
|
267
|
-
return () => {
|
|
268
|
-
isFulfilled = true;
|
|
269
|
-
promiseResolve();
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// src/hooks/internal/useBrowserTabsChannel.ts
|
|
274
|
-
var import_react4 = require("react");
|
|
275
|
-
var useBrowserTabsChannel = ({
|
|
276
|
-
channelName,
|
|
277
|
-
onMessage
|
|
278
|
-
}) => {
|
|
279
|
-
const [tabsChannel] = (0, import_react4.useState)(
|
|
280
|
-
typeof BroadcastChannel !== "undefined" ? new BroadcastChannel(channelName) : void 0
|
|
281
|
-
);
|
|
282
|
-
const postMessage = (data) => {
|
|
283
|
-
tabsChannel?.postMessage(data);
|
|
284
|
-
};
|
|
285
|
-
(0, import_react4.useEffect)(() => {
|
|
286
|
-
const listener = (event) => {
|
|
287
|
-
onMessage(event.data);
|
|
288
|
-
};
|
|
289
|
-
tabsChannel?.addEventListener("message", listener);
|
|
290
|
-
return () => {
|
|
291
|
-
tabsChannel?.removeEventListener("message", listener);
|
|
292
|
-
};
|
|
293
|
-
}, []);
|
|
294
|
-
return { postMessage };
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// src/hooks/internal/useWebsocketEvent.ts
|
|
298
|
-
var useWebSocketEvent = ({
|
|
299
|
-
event: webSocketEvent,
|
|
300
|
-
eventHandler: onMessage
|
|
301
|
-
}) => {
|
|
302
|
-
const novu = useNovu();
|
|
303
|
-
const { postMessage } = useBrowserTabsChannel({ channelName: `nv.${webSocketEvent}`, onMessage });
|
|
304
|
-
const updateReadCount = (data) => {
|
|
305
|
-
onMessage(data);
|
|
306
|
-
postMessage(data);
|
|
307
|
-
};
|
|
308
|
-
(0, import_react5.useEffect)(() => {
|
|
309
|
-
let cleanup;
|
|
310
|
-
const resolveLock = requestLock(`nv.${webSocketEvent}`, () => {
|
|
311
|
-
cleanup = novu.on(webSocketEvent, updateReadCount);
|
|
312
|
-
});
|
|
313
|
-
return () => {
|
|
314
|
-
if (cleanup) {
|
|
315
|
-
cleanup();
|
|
316
|
-
}
|
|
317
|
-
resolveLock();
|
|
318
|
-
};
|
|
319
|
-
}, []);
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
// src/hooks/useCounts.ts
|
|
323
|
-
var useCounts = (props) => {
|
|
324
|
-
const { filters, onSuccess, onError } = props;
|
|
325
|
-
const { notifications } = useNovu();
|
|
326
|
-
const [error, setError] = (0, import_react6.useState)();
|
|
327
|
-
const [counts, setCounts] = (0, import_react6.useState)();
|
|
328
|
-
const [isLoading, setIsLoading] = (0, import_react6.useState)(true);
|
|
329
|
-
const [isFetching, setIsFetching] = (0, import_react6.useState)(false);
|
|
330
|
-
const sync = async (notification) => {
|
|
331
|
-
const existingCounts = counts ?? new Array(filters.length).fill(void 0);
|
|
332
|
-
let countFiltersToFetch = [];
|
|
333
|
-
if (notification) {
|
|
334
|
-
for (let i = 0; i < existingCounts.length; i++) {
|
|
335
|
-
const filter = filters[i];
|
|
336
|
-
if ((0, import_js3.areTagsEqual)(filter.tags, notification.tags)) {
|
|
337
|
-
countFiltersToFetch.push(filter);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
} else {
|
|
341
|
-
countFiltersToFetch = filters;
|
|
342
|
-
}
|
|
343
|
-
if (countFiltersToFetch.length === 0) {
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
setIsFetching(true);
|
|
347
|
-
const countsRes = await notifications.count({ filters: countFiltersToFetch });
|
|
348
|
-
setIsFetching(false);
|
|
349
|
-
setIsLoading(false);
|
|
350
|
-
if (countsRes.error) {
|
|
351
|
-
setError(countsRes.error);
|
|
352
|
-
onError?.(countsRes.error);
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
const data = countsRes.data;
|
|
356
|
-
onSuccess?.(data.counts);
|
|
357
|
-
setCounts((oldCounts) => {
|
|
358
|
-
const newCounts = [];
|
|
359
|
-
const countsReceived = data.counts;
|
|
360
|
-
for (let i = 0; i < existingCounts.length; i++) {
|
|
361
|
-
const countReceived = countsReceived.find((c) => (0, import_js3.areTagsEqual)(c.filter.tags, existingCounts[i]?.filter.tags));
|
|
362
|
-
newCounts.push(countReceived || oldCounts[i]);
|
|
363
|
-
}
|
|
364
|
-
return newCounts;
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
useWebSocketEvent({
|
|
368
|
-
event: "notifications.notification_received",
|
|
369
|
-
eventHandler: (data) => {
|
|
370
|
-
sync(data.result);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
useWebSocketEvent({
|
|
374
|
-
event: "notifications.unread_count_changed",
|
|
375
|
-
eventHandler: () => {
|
|
376
|
-
sync();
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
(0, import_react6.useEffect)(() => {
|
|
380
|
-
setError(void 0);
|
|
381
|
-
setIsLoading(true);
|
|
382
|
-
setIsFetching(false);
|
|
383
|
-
sync();
|
|
384
|
-
}, [JSON.stringify(filters)]);
|
|
385
|
-
const refetch = async () => {
|
|
386
|
-
await sync();
|
|
387
|
-
};
|
|
388
|
-
return { counts, error, refetch, isLoading, isFetching };
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
// src/server/index.ts
|
|
392
|
-
function Inbox() {
|
|
393
|
-
}
|
|
394
|
-
function InboxContent() {
|
|
395
|
-
}
|
|
396
|
-
function Notifications() {
|
|
397
|
-
}
|
|
398
|
-
function Preferences() {
|
|
399
|
-
}
|
|
400
|
-
function Bell() {
|
|
401
|
-
}
|
|
402
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
403
|
-
0 && (module.exports = {
|
|
404
|
-
Bell,
|
|
405
|
-
Inbox,
|
|
406
|
-
InboxContent,
|
|
407
|
-
Notifications,
|
|
408
|
-
NovuProvider,
|
|
409
|
-
Preferences,
|
|
410
|
-
useCounts,
|
|
411
|
-
useNotifications,
|
|
412
|
-
useNovu,
|
|
413
|
-
usePreferences
|
|
414
|
-
});
|
|
415
|
-
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/index.ts","../../src/hooks/NovuProvider.tsx","../../src/hooks/useNotifications.ts","../../src/hooks/usePreferences.ts","../../src/hooks/useCounts.ts","../../src/hooks/internal/useWebsocketEvent.ts","../../src/utils/requestLock.ts","../../src/hooks/internal/useBrowserTabsChannel.ts"],"sourcesContent":["export type * from '../utils/types';\nexport type { InboxProps } from '../components/Inbox';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @novu/js/ui\n */\nexport function Inbox() {}\nexport function InboxContent() {}\nexport function Notifications() {}\nexport function Preferences() {}\nexport function Bell() {}\n\n// Hooks\nexport { NovuProvider } from '../index';\nexport * from '../hooks';\n","import { Novu, NovuOptions } from '@novu/js';\nimport { ReactNode, createContext, useContext, useMemo } from 'react';\n\n// @ts-ignore\nconst version = PACKAGE_VERSION;\n// @ts-ignore\nconst name = PACKAGE_NAME;\nconst baseUserAgent = `${name}@${version}`;\n\ntype NovuProviderProps = NovuOptions & {\n children: ReactNode;\n};\n\nconst NovuContext = createContext<Novu | undefined>(undefined);\n\nexport const NovuProvider = ({\n children,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n backendUrl,\n socketUrl,\n useCache,\n}: NovuProviderProps) => {\n return (\n <InternalNovuProvider\n applicationIdentifier={applicationIdentifier}\n subscriberId={subscriberId}\n subscriberHash={subscriberHash}\n backendUrl={backendUrl}\n socketUrl={socketUrl}\n useCache={useCache}\n userAgentType=\"hooks\"\n >\n {children}\n </InternalNovuProvider>\n );\n};\n\n/**\n * @internal Should be used internally not to be exposed outside of the library\n * This is needed to differentiate between the hooks and components user agents\n * Better to use this internally to avoid confusion.\n */\nexport const InternalNovuProvider = ({\n children,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n backendUrl,\n socketUrl,\n useCache,\n userAgentType,\n}: NovuProviderProps & { userAgentType: 'components' | 'hooks' }) => {\n const novu = useMemo(\n () =>\n new Novu({\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n backendUrl,\n socketUrl,\n useCache,\n __userAgent: `${baseUserAgent} ${userAgentType}`,\n }),\n [applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, userAgentType]\n );\n\n return <NovuContext.Provider value={novu}>{children}</NovuContext.Provider>;\n};\n\nexport const useNovu = () => {\n const context = useContext(NovuContext);\n if (!context) {\n throw new Error('useNovu must be used within a <NovuProvider />');\n }\n\n return context;\n};\n\nexport const useUnsafeNovu = () => {\n const context = useContext(NovuContext);\n\n return context;\n};\n","import { useState, useEffect, useRef } from 'react';\nimport { ListNotificationsResponse, Notification, NovuError, isSameFilter, NotificationFilter } from '@novu/js';\nimport { useNovu } from './NovuProvider';\n\nexport type UseNotificationsProps = {\n tags?: string[];\n read?: boolean;\n archived?: boolean;\n limit?: number;\n onSuccess?: (data: Notification[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport const useNotifications = (props?: UseNotificationsProps) => {\n const { tags, read, archived = false, limit, onSuccess, onError } = props || {};\n const filterRef = useRef<NotificationFilter | undefined>(undefined);\n const { notifications, on } = useNovu();\n const [data, setData] = useState<Array<Notification>>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n const [hasMore, setHasMore] = useState(false);\n const length = data?.length;\n const after = length ? data[length - 1].id : undefined;\n\n const sync = (event: { data?: ListNotificationsResponse }) => {\n if (!event.data || (filterRef.current && !isSameFilter(filterRef.current, event.data.filter))) {\n return;\n }\n setData(event.data.notifications);\n setHasMore(event.data.hasMore);\n };\n\n useEffect(() => {\n const cleanup = on('notifications.list.updated', sync);\n\n return () => {\n cleanup();\n };\n }, []);\n\n useEffect(() => {\n const newFilter = { tags, read, archived };\n if (filterRef.current && isSameFilter(filterRef.current, newFilter)) {\n return;\n }\n\n notifications.clearCache({ filter: filterRef.current });\n filterRef.current = newFilter;\n\n fetchNotifications({ refetch: true });\n }, [tags, read, archived]);\n\n const fetchNotifications = async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n }\n setIsFetching(true);\n const response = await notifications.list({\n tags,\n read,\n archived,\n limit,\n after: options?.refetch ? undefined : after,\n });\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else {\n onSuccess?.(response.data!.notifications);\n setData(response.data!.notifications);\n setHasMore(response.data!.hasMore);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n notifications.clearCache({ filter: { tags, read, archived } });\n\n return fetchNotifications({ refetch: true });\n };\n\n const fetchMore = async () => {\n if (!hasMore || isFetching) return;\n\n return fetchNotifications();\n };\n\n const readAll = async () => {\n return await notifications.readAll({ tags });\n };\n\n const archiveAll = async () => {\n return await notifications.archiveAll({ tags });\n };\n\n const archiveAllRead = async () => {\n return await notifications.archiveAllRead({ tags });\n };\n\n return {\n readAll,\n archiveAll,\n archiveAllRead,\n notifications: data,\n error,\n isLoading,\n isFetching,\n refetch,\n fetchMore,\n hasMore,\n };\n};\n","import { NovuError, Preference } from '@novu/js';\nimport { useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\ntype UsePreferencesProps = {\n filter?: { tags?: string[] };\n onSuccess?: (data: Preference[]) => void;\n onError?: (error: NovuError) => void;\n};\n\ntype UsePreferencesResult = {\n preferences?: Preference[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const usePreferences = (props?: UsePreferencesProps): UsePreferencesResult => {\n const { onSuccess, onError } = props || {};\n const [data, setData] = useState<Preference[]>();\n const { preferences, on } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = (event: { data?: Preference[] }) => {\n if (!event.data) {\n return;\n }\n setData(event.data);\n };\n\n useEffect(() => {\n fetchPreferences();\n\n const listUpdatedCleanup = on('preferences.list.updated', sync);\n const listPendingCleanup = on('preferences.list.pending', sync);\n const listResolvedCleanup = on('preferences.list.resolved', sync);\n\n return () => {\n listUpdatedCleanup();\n listPendingCleanup();\n listResolvedCleanup();\n };\n }, []);\n\n const fetchPreferences = async () => {\n setIsFetching(true);\n const response = await preferences.list(props?.filter);\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else {\n onSuccess?.(response.data!);\n }\n setIsLoading(false);\n setIsFetching(false);\n };\n\n const refetch = () => {\n preferences.cache.clearAll();\n\n return fetchPreferences();\n };\n\n return {\n preferences: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n","import { useEffect, useState } from 'react';\nimport { Notification, NotificationFilter, NovuError, areTagsEqual } from '@novu/js';\nimport { useNovu } from './NovuProvider';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\n\ntype Count = {\n count: number;\n filter: NotificationFilter;\n};\n\ntype UseCountsProps = {\n filters: NotificationFilter[];\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\ntype UseCountsResult = {\n counts?: Count[];\n error?: NovuError;\n isLoading: boolean; // initial loading\n isFetching: boolean; // the request is in flight\n refetch: () => Promise<void>;\n};\n\nexport const useCounts = (props: UseCountsProps): UseCountsResult => {\n const { filters, onSuccess, onError } = props;\n const { notifications } = useNovu();\n const [error, setError] = useState<NovuError>();\n const [counts, setCounts] = useState<Count[]>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const sync = async (notification?: Notification) => {\n const existingCounts = counts ?? (new Array(filters.length).fill(undefined) as (Count | undefined)[]);\n let countFiltersToFetch: NotificationFilter[] = [];\n if (notification) {\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < existingCounts.length; i++) {\n const filter = filters[i];\n if (areTagsEqual(filter.tags, notification.tags)) {\n countFiltersToFetch.push(filter);\n }\n }\n } else {\n countFiltersToFetch = filters;\n }\n\n if (countFiltersToFetch.length === 0) {\n return;\n }\n\n setIsFetching(true);\n const countsRes = await notifications.count({ filters: countFiltersToFetch });\n setIsFetching(false);\n setIsLoading(false);\n if (countsRes.error) {\n setError(countsRes.error);\n onError?.(countsRes.error);\n\n return;\n }\n const data = countsRes.data!;\n onSuccess?.(data.counts);\n\n setCounts((oldCounts) => {\n const newCounts: Count[] = [];\n const countsReceived = data.counts;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < existingCounts.length; i++) {\n const countReceived = countsReceived.find((c) => areTagsEqual(c.filter.tags, existingCounts[i]?.filter.tags));\n\n newCounts.push(countReceived || oldCounts![i]);\n }\n\n return newCounts;\n });\n };\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n eventHandler: (data) => {\n sync(data.result);\n },\n });\n\n useWebSocketEvent({\n event: 'notifications.unread_count_changed',\n eventHandler: () => {\n sync();\n },\n });\n\n useEffect(() => {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n sync();\n }, [JSON.stringify(filters)]);\n\n const refetch = async () => {\n await sync();\n };\n\n return { counts, error, refetch, isLoading, isFetching };\n};\n","import { EventHandler, Events, SocketEventNames } from '@novu/js';\nimport { useEffect } from 'react';\nimport { useNovu } from '../NovuProvider';\nimport { requestLock } from '../../utils/requestLock';\nimport { useBrowserTabsChannel } from './useBrowserTabsChannel';\n\nexport const useWebSocketEvent = <E extends SocketEventNames>({\n event: webSocketEvent,\n eventHandler: onMessage,\n}: {\n event: E;\n eventHandler: (args: Events[E]) => void;\n}) => {\n const novu = useNovu();\n const { postMessage } = useBrowserTabsChannel({ channelName: `nv.${webSocketEvent}`, onMessage });\n\n const updateReadCount: EventHandler<Events[E]> = (data) => {\n onMessage(data);\n postMessage(data);\n };\n\n useEffect(() => {\n let cleanup: () => void;\n const resolveLock = requestLock(`nv.${webSocketEvent}`, () => {\n cleanup = novu.on(webSocketEvent, updateReadCount);\n });\n\n return () => {\n if (cleanup) {\n cleanup();\n }\n\n resolveLock();\n };\n }, []);\n};\n","export function requestLock(id: string, cb: (id: string) => void) {\n // Check if the Lock API is available\n if (!('locks' in navigator)) {\n // If Lock API is not available, immediately invoke the callback and return a no-op function\n cb(id);\n return () => {};\n }\n\n let isFulfilled = false;\n let promiseResolve: () => void;\n\n const promise = new Promise<void>((resolve) => {\n promiseResolve = resolve;\n });\n\n navigator.locks.request(id, () => {\n if (!isFulfilled) {\n cb(id);\n }\n\n return promise;\n });\n\n return () => {\n isFulfilled = true;\n promiseResolve();\n };\n}\n","import { useEffect, useState } from 'react';\n\nexport const useBrowserTabsChannel = <T = unknown>({\n channelName,\n onMessage,\n}: {\n channelName: string;\n onMessage: (args: T) => void;\n}) => {\n const [tabsChannel] = useState(\n typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(channelName) : undefined\n );\n\n const postMessage = (data: T) => {\n tabsChannel?.postMessage(data);\n };\n\n useEffect(() => {\n const listener = (event: MessageEvent<T>) => {\n onMessage(event.data);\n };\n\n tabsChannel?.addEventListener('message', listener);\n\n return () => {\n tabsChannel?.removeEventListener('message', listener);\n };\n }, []);\n\n return { postMessage };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,gBAAkC;AAClC,mBAA8D;AAwB1D;AArBJ,IAAM,UAAU;AAEhB,IAAM,OAAO;AACb,IAAM,gBAAgB,GAAG,IAAI,IAAI,OAAO;AAMxC,IAAM,kBAAc,4BAAgC,MAAS;AAEtD,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAc;AAAA,MAEb;AAAA;AAAA,EACH;AAEJ;AAOO,IAAM,uBAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAqE;AACnE,QAAM,WAAO;AAAA,IACX,MACE,IAAI,eAAK;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,GAAG,aAAa,IAAI,aAAa;AAAA,IAChD,CAAC;AAAA,IACH,CAAC,uBAAuB,cAAc,gBAAgB,YAAY,WAAW,UAAU,aAAa;AAAA,EACtG;AAEA,SAAO,4CAAC,YAAY,UAAZ,EAAqB,OAAO,MAAO,UAAS;AACtD;AAEO,IAAM,UAAU,MAAM;AAC3B,QAAM,cAAU,yBAAW,WAAW;AACtC,MAAI,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,iBAAiB,KAAK;AAG5B,eAAS,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;AAC9C,cAAM,gBAAgB,eAAe,KAAK,CAAC,UAAM,yBAAa,EAAE,OAAO,MAAM,eAAe,CAAC,GAAG,OAAO,IAAI,CAAC;AAE5G,kBAAU,KAAK,iBAAiB,UAAW,CAAC,CAAC;AAAA,MAC/C;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,oBAAkB;AAAA,IAChB,OAAO;AAAA,IACP,cAAc,CAAC,SAAS;AACtB,WAAK,KAAK,MAAM;AAAA,IAClB;AAAA,EACF,CAAC;AAED,oBAAkB;AAAA,IAChB,OAAO;AAAA,IACP,cAAc,MAAM;AAClB,WAAK;AAAA,IACP;AAAA,EACF,CAAC;AAED,+BAAU,MAAM;AACd,aAAS,MAAS;AAClB,iBAAa,IAAI;AACjB,kBAAc,KAAK;AACnB,SAAK;AAAA,EACP,GAAG,CAAC,KAAK,UAAU,OAAO,CAAC,CAAC;AAE5B,QAAM,UAAU,YAAY;AAC1B,UAAM,KAAK;AAAA,EACb;AAEA,SAAO,EAAE,QAAQ,OAAO,SAAS,WAAW,WAAW;AACzD;;;AJhGO,SAAS,QAAQ;AAAC;AAClB,SAAS,eAAe;AAAC;AACzB,SAAS,gBAAgB;AAAC;AAC1B,SAAS,cAAc;AAAC;AACxB,SAAS,OAAO;AAAC;","names":["import_react","import_js","import_react","import_react","import_js","import_react","import_react"]}
|