@novu/react 3.0.0-canary.0 → 3.0.0-canary.2
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/cjs/hooks/useCounts.cjs +6 -6
- package/dist/cjs/hooks/useCounts.cjs.map +1 -1
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/index.d.cts +2 -2
- package/dist/esm/hooks/NovuProvider.js +1 -1
- package/dist/esm/hooks/useCounts.js +6 -3
- package/dist/esm/hooks/useCounts.js.map +1 -1
- package/dist/esm/server/index.d.ts +2 -2
- package/dist/esm/server/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -29,7 +29,7 @@ module.exports = __toCommonJS(NovuProvider_exports);
|
|
|
29
29
|
var import_js = require("@novu/js");
|
|
30
30
|
var import_react = require("react");
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var version = "3.0.0-canary.
|
|
32
|
+
var version = "3.0.0-canary.2";
|
|
33
33
|
var name = "@novu/react";
|
|
34
34
|
var baseUserAgent = `${name}@${version}`;
|
|
35
35
|
var NovuContext = (0, import_react.createContext)(void 0);
|
|
@@ -35,7 +35,7 @@ var useCounts = (props) => {
|
|
|
35
35
|
const [isLoading, setIsLoading] = (0, import_react.useState)(true);
|
|
36
36
|
const [isFetching, setIsFetching] = (0, import_react.useState)(false);
|
|
37
37
|
const sync = async (notification) => {
|
|
38
|
-
const existingCounts = counts ??
|
|
38
|
+
const existingCounts = counts ?? filters.map((filter) => ({ count: 0, filter }));
|
|
39
39
|
let countFiltersToFetch = [];
|
|
40
40
|
if (notification) {
|
|
41
41
|
for (let i = 0; i < existingCounts.length; i++) {
|
|
@@ -65,11 +65,11 @@ var useCounts = (props) => {
|
|
|
65
65
|
const newCounts = [];
|
|
66
66
|
const countsReceived = data.counts;
|
|
67
67
|
for (let i = 0; i < existingCounts.length; i++) {
|
|
68
|
-
const countReceived = countsReceived.find((c) =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const countReceived = countsReceived.find((c) => (0, import_js.areTagsEqual)(c.filter.tags, existingCounts[i].filter.tags));
|
|
69
|
+
const count = countReceived || oldCounts && oldCounts[i];
|
|
70
|
+
if (count) {
|
|
71
|
+
newCounts.push(count);
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
return newCounts;
|
|
75
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["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\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type 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 ??
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["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\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type 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 ?? filters.map((filter) => ({ count: 0, filter }));\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 const count = countReceived || (oldCounts && oldCounts[i]);\n if (count) {\n newCounts.push(count);\n }\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 ref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,iBAAiB,KAAK;AAG5B,eAAS,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;AAC9C,cAAM,gBAAgB,eAAe,KAAK,CAAC,UAAM,wBAAa,EAAE,OAAO,MAAM,eAAe,CAAC,EAAE,OAAO,IAAI,CAAC;AAC3G,cAAM,QAAQ,iBAAkB,aAAa,UAAU,CAAC;AACxD,YAAI,OAAO;AACT,oBAAU,KAAK,KAAK;AAAA,QACtB;AAAA,MACF;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,kDAAkB;AAAA,IAChB,OAAO;AAAA,IACP,cAAc,CAAC,SAAS;AACtB,WAAK,KAAK,MAAM;AAAA,IAClB;AAAA,EACF,CAAC;AAED,kDAAkB;AAAA,IAChB,OAAO;AAAA,IACP,cAAc,MAAM;AAClB,WAAK;AAAA,IACP;AAAA,EACF,CAAC;AAED,8BAAU,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;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type {\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n} from '../hooks';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\nimport type { InboxProps } from '../components/Inbox';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\n\nexport * from '../utils/types';\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(props: InboxProps) {}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,2BAAc,+BAVd;AAkBO,SAAS,MAAM,OAAmB;AAAC;AAEnC,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AAAC;AAEjD,SAAS,UAAU;AACxB,SAAO;AACT;AAEO,SAAS,UAAU,GAAoC;AAC5D,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,YAAY,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACvE,gBAAgB,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IAC3E,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,WAAW,MAAM,QAAQ,QAAQ;AAAA,EACnC;AACF;AAEO,SAAS,eAAe,GAA8C;AAC3E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InboxProps } from '../components/Inbox.cjs';
|
|
2
1
|
import { UseNotificationsProps, UseNotificationsResult } from '../hooks/useNotifications.cjs';
|
|
3
2
|
import { UsePreferencesProps, UsePreferencesResult } from '../hooks/usePreferences.cjs';
|
|
4
3
|
import { UseCountsProps, UseCountsResult } from '../hooks/useCounts.cjs';
|
|
5
4
|
import { NovuProviderProps } from '../hooks/NovuProvider.cjs';
|
|
5
|
+
import { InboxProps } from '../components/Inbox.cjs';
|
|
6
6
|
export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from '../utils/types.cjs';
|
|
7
7
|
export { Notification } from '@novu/js/ui';
|
|
8
|
+
import '@novu/js';
|
|
8
9
|
import 'react/jsx-runtime';
|
|
9
10
|
import 'react';
|
|
10
|
-
import '@novu/js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Exporting all components from the components folder
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Novu } from "@novu/js";
|
|
3
3
|
import { createContext, useContext, useMemo } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var version = "3.0.0-canary.
|
|
5
|
+
var version = "3.0.0-canary.2";
|
|
6
6
|
var name = "@novu/react";
|
|
7
7
|
var baseUserAgent = `${name}@${version}`;
|
|
8
8
|
var NovuContext = createContext(void 0);
|
|
@@ -11,7 +11,7 @@ var useCounts = (props) => {
|
|
|
11
11
|
const [isLoading, setIsLoading] = useState(true);
|
|
12
12
|
const [isFetching, setIsFetching] = useState(false);
|
|
13
13
|
const sync = async (notification) => {
|
|
14
|
-
const existingCounts = counts ??
|
|
14
|
+
const existingCounts = counts ?? filters.map((filter) => ({ count: 0, filter }));
|
|
15
15
|
let countFiltersToFetch = [];
|
|
16
16
|
if (notification) {
|
|
17
17
|
for (let i = 0; i < existingCounts.length; i++) {
|
|
@@ -41,8 +41,11 @@ var useCounts = (props) => {
|
|
|
41
41
|
const newCounts = [];
|
|
42
42
|
const countsReceived = data.counts;
|
|
43
43
|
for (let i = 0; i < existingCounts.length; i++) {
|
|
44
|
-
const countReceived = countsReceived.find((c) => areTagsEqual(c.filter.tags, existingCounts[i]
|
|
45
|
-
|
|
44
|
+
const countReceived = countsReceived.find((c) => areTagsEqual(c.filter.tags, existingCounts[i].filter.tags));
|
|
45
|
+
const count = countReceived || oldCounts && oldCounts[i];
|
|
46
|
+
if (count) {
|
|
47
|
+
newCounts.push(count);
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
return newCounts;
|
|
48
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["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\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type 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 ??
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/useCounts.ts"],"sourcesContent":["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\nexport type UseCountsProps = {\n filters: NotificationFilter[];\n onSuccess?: (data: Count[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type 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 ?? filters.map((filter) => ({ count: 0, filter }));\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 const count = countReceived || (oldCounts && oldCounts[i]);\n if (count) {\n newCounts.push(count);\n }\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"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAsD,oBAAoB;AAC1E,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAqB3B,IAAM,YAAY,CAAC,UAA2C;AACnE,QAAM,EAAE,SAAS,WAAW,QAAQ,IAAI;AACxC,QAAM,EAAE,cAAc,IAAI,QAAQ;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB;AAC9C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkB;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,OAAO,OAAO,iBAAgC;AAClD,UAAM,iBAAiB,UAAU,QAAQ,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,EAAE;AAC/E,QAAI,sBAA4C,CAAC;AACjD,QAAI,cAAc;AAEhB,eAAS,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;AAC9C,cAAM,SAAS,QAAQ,CAAC;AACxB,YAAI,aAAa,OAAO,MAAM,aAAa,IAAI,GA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AW,WAAW;AACzD;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InboxProps } from '../components/Inbox.js';
|
|
2
1
|
import { UseNotificationsProps, UseNotificationsResult } from '../hooks/useNotifications.js';
|
|
3
2
|
import { UsePreferencesProps, UsePreferencesResult } from '../hooks/usePreferences.js';
|
|
4
3
|
import { UseCountsProps, UseCountsResult } from '../hooks/useCounts.js';
|
|
5
4
|
import { NovuProviderProps } from '../hooks/NovuProvider.js';
|
|
5
|
+
import { InboxProps } from '../components/Inbox.js';
|
|
6
6
|
export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from '../utils/types.js';
|
|
7
7
|
export { Notification } from '@novu/js/ui';
|
|
8
|
+
import '@novu/js';
|
|
8
9
|
import 'react/jsx-runtime';
|
|
9
10
|
import 'react';
|
|
10
|
-
import '@novu/js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Exporting all components from the components folder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type {\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n} from '../hooks';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\nimport type { InboxProps } from '../components/Inbox';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\n\nexport * from '../utils/types';\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(props: InboxProps) {}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n"],"mappings":";AAUA,cAAc;AAQP,SAAS,MAAM,OAAmB;AAAC;AAEnC,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AAAC;AAEjD,SAAS,UAAU;AACxB,SAAO;AACT;AAEO,SAAS,UAAU,GAAoC;AAC5D,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,YAAY,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACvE,gBAAgB,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IAC3E,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,WAAW,MAAM,QAAQ,QAAQ;AAAA,EACnC;AACF;AAEO,SAAS,eAAe,GAA8C;AAC3E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novu/react",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/novuhq/novu",
|
|
@@ -79,12 +79,6 @@
|
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
|
-
"scripts": {
|
|
83
|
-
"build:watch": "tsup --watch",
|
|
84
|
-
"build": "tsup && pnpm run check-exports",
|
|
85
|
-
"lint": "eslint src",
|
|
86
|
-
"check-exports": "attw --pack ."
|
|
87
|
-
},
|
|
88
82
|
"browserslist": {
|
|
89
83
|
"production": [
|
|
90
84
|
">0.2%",
|
|
@@ -116,11 +110,17 @@
|
|
|
116
110
|
}
|
|
117
111
|
},
|
|
118
112
|
"dependencies": {
|
|
119
|
-
"@novu/js": "3.0.0-canary.
|
|
113
|
+
"@novu/js": "3.0.0-canary.2"
|
|
120
114
|
},
|
|
121
115
|
"nx": {
|
|
122
116
|
"tags": [
|
|
123
117
|
"type:package"
|
|
124
118
|
]
|
|
119
|
+
},
|
|
120
|
+
"scripts": {
|
|
121
|
+
"build:watch": "tsup --watch",
|
|
122
|
+
"build": "tsup && pnpm run check-exports",
|
|
123
|
+
"lint": "eslint src",
|
|
124
|
+
"check-exports": "attw --pack ."
|
|
125
125
|
}
|
|
126
|
-
}
|
|
126
|
+
}
|