@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.
@@ -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";
32
+ var version = "3.0.3";
33
33
  var name = "@novu/react";
34
34
  var baseUserAgent = `${name}@${version}`;
35
35
  var NovuContext = (0, import_react.createContext)(void 0);
@@ -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";
5
+ var version = "3.0.3";
6
6
  var name = "@novu/react";
7
7
  var baseUserAgent = `${name}@${version}`;
8
8
  var NovuContext = createContext(void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novu/react",
3
- "version": "3.0.0",
3
+ "version": "3.0.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/novuhq/novu",
@@ -110,7 +110,7 @@
110
110
  }
111
111
  },
112
112
  "dependencies": {
113
- "@novu/js": "3.0.0"
113
+ "@novu/js": "3.0.3"
114
114
  },
115
115
  "nx": {
116
116
  "tags": [
@@ -1,168 +0,0 @@
1
- import React$1, { ReactNode } from 'react';
2
- import { Notification, NotificationClickHandler, NotificationActionClickHandler, InboxProps as InboxProps$1, Appearance, Localization, Tab, PreferencesFilter, RouterPush, InboxPage } from '@novu/js/ui';
3
- export { Notification } from '@novu/js/ui';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { Novu, NovuOptions, Notification as Notification$1, NovuError, Preference, NotificationFilter } from '@novu/js';
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 BellProps = {
58
- renderBell?: BellRenderer;
59
- };
60
- declare const Bell: React$1.ComponentType<BellProps & {
61
- children?: React$1.ReactNode | undefined;
62
- }>;
63
-
64
- type InboxProps = DefaultProps | WithChildrenProps;
65
- declare const Inbox: React$1.MemoExoticComponent<(props: InboxProps) => react_jsx_runtime.JSX.Element>;
66
-
67
- declare const Preferences: () => react_jsx_runtime.JSX.Element;
68
-
69
- type NotificationProps = {
70
- onNotificationClick?: NotificationClickHandler;
71
- onPrimaryActionClick?: NotificationActionClickHandler;
72
- onSecondaryActionClick?: NotificationActionClickHandler;
73
- } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
74
- declare const Notifications: React$1.ComponentType<NotificationProps & {
75
- children?: React$1.ReactNode | undefined;
76
- }>;
77
-
78
- type InboxContentProps = {
79
- onNotificationClick?: NotificationClickHandler;
80
- onPrimaryActionClick?: NotificationActionClickHandler;
81
- onSecondaryActionClick?: NotificationActionClickHandler;
82
- initialPage?: InboxPage;
83
- hideNav?: boolean;
84
- } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
85
- declare const InboxContent: React$1.ComponentType<InboxContentProps & {
86
- children?: React$1.ReactNode | undefined;
87
- }>;
88
-
89
- type NovuProviderProps = NovuOptions & {
90
- children: ReactNode;
91
- };
92
- declare const NovuProvider: ({ children, applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, }: NovuProviderProps) => react_jsx_runtime.JSX.Element;
93
- /**
94
- * @internal Should be used internally not to be exposed outside of the library
95
- * This is needed to differentiate between the hooks and components user agents
96
- * Better to use this internally to avoid confusion.
97
- */
98
- declare const InternalNovuProvider: ({ children, applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, userAgentType, }: NovuProviderProps & {
99
- userAgentType: "components" | "hooks";
100
- }) => react_jsx_runtime.JSX.Element;
101
- declare const useNovu: () => Novu;
102
- declare const useUnsafeNovu: () => Novu | undefined;
103
-
104
- type UseNotificationsProps = {
105
- tags?: string[];
106
- read?: boolean;
107
- archived?: boolean;
108
- limit?: number;
109
- onSuccess?: (data: Notification$1[]) => void;
110
- onError?: (error: NovuError) => void;
111
- };
112
- declare const useNotifications: (props?: UseNotificationsProps) => {
113
- readAll: () => Promise<{
114
- data?: void | undefined;
115
- error?: NovuError | undefined;
116
- }>;
117
- archiveAll: () => Promise<{
118
- data?: void | undefined;
119
- error?: NovuError | undefined;
120
- }>;
121
- archiveAllRead: () => Promise<{
122
- data?: void | undefined;
123
- error?: NovuError | undefined;
124
- }>;
125
- notifications: Notification$1[] | undefined;
126
- error: NovuError | undefined;
127
- isLoading: boolean;
128
- isFetching: boolean;
129
- refetch: () => Promise<void>;
130
- fetchMore: () => Promise<void>;
131
- hasMore: boolean;
132
- };
133
-
134
- type UsePreferencesProps = {
135
- filter?: {
136
- tags?: string[];
137
- };
138
- onSuccess?: (data: Preference[]) => void;
139
- onError?: (error: NovuError) => void;
140
- };
141
- type UsePreferencesResult = {
142
- preferences?: Preference[];
143
- error?: NovuError;
144
- isLoading: boolean;
145
- isFetching: boolean;
146
- refetch: () => Promise<void>;
147
- };
148
- declare const usePreferences: (props?: UsePreferencesProps) => UsePreferencesResult;
149
-
150
- type Count = {
151
- count: number;
152
- filter: NotificationFilter;
153
- };
154
- type UseCountsProps = {
155
- filters: NotificationFilter[];
156
- onSuccess?: (data: Count[]) => void;
157
- onError?: (error: NovuError) => void;
158
- };
159
- type UseCountsResult = {
160
- counts?: Count[];
161
- error?: NovuError;
162
- isLoading: boolean;
163
- isFetching: boolean;
164
- refetch: () => Promise<void>;
165
- };
166
- declare const useCounts: (props: UseCountsProps) => UseCountsResult;
167
-
168
- export { type BaseProps, Bell, type BellProps, type BellRenderer, type BodyRenderer, type DefaultInboxProps, type DefaultProps, Inbox, InboxContent, type InboxContentProps, type InboxProps, InternalNovuProvider, type NoRendererProps, type NotificationProps, type NotificationRendererProps, Notifications, type NotificationsRenderer, NovuProvider, Preferences, type SubjectBodyRendererProps, type SubjectRenderer, type UseNotificationsProps, type WithChildrenProps, useCounts, useNotifications, useNovu, usePreferences, useUnsafeNovu };
@@ -1,168 +0,0 @@
1
- import React$1, { ReactNode } from 'react';
2
- import { Notification, NotificationClickHandler, NotificationActionClickHandler, InboxProps as InboxProps$1, Appearance, Localization, Tab, PreferencesFilter, RouterPush, InboxPage } from '@novu/js/ui';
3
- export { Notification } from '@novu/js/ui';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { Novu, NovuOptions, Notification as Notification$1, NovuError, Preference, NotificationFilter } from '@novu/js';
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 BellProps = {
58
- renderBell?: BellRenderer;
59
- };
60
- declare const Bell: React$1.ComponentType<BellProps & {
61
- children?: React$1.ReactNode | undefined;
62
- }>;
63
-
64
- type InboxProps = DefaultProps | WithChildrenProps;
65
- declare const Inbox: React$1.MemoExoticComponent<(props: InboxProps) => react_jsx_runtime.JSX.Element>;
66
-
67
- declare const Preferences: () => react_jsx_runtime.JSX.Element;
68
-
69
- type NotificationProps = {
70
- onNotificationClick?: NotificationClickHandler;
71
- onPrimaryActionClick?: NotificationActionClickHandler;
72
- onSecondaryActionClick?: NotificationActionClickHandler;
73
- } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
74
- declare const Notifications: React$1.ComponentType<NotificationProps & {
75
- children?: React$1.ReactNode | undefined;
76
- }>;
77
-
78
- type InboxContentProps = {
79
- onNotificationClick?: NotificationClickHandler;
80
- onPrimaryActionClick?: NotificationActionClickHandler;
81
- onSecondaryActionClick?: NotificationActionClickHandler;
82
- initialPage?: InboxPage;
83
- hideNav?: boolean;
84
- } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
85
- declare const InboxContent: React$1.ComponentType<InboxContentProps & {
86
- children?: React$1.ReactNode | undefined;
87
- }>;
88
-
89
- type NovuProviderProps = NovuOptions & {
90
- children: ReactNode;
91
- };
92
- declare const NovuProvider: ({ children, applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, }: NovuProviderProps) => react_jsx_runtime.JSX.Element;
93
- /**
94
- * @internal Should be used internally not to be exposed outside of the library
95
- * This is needed to differentiate between the hooks and components user agents
96
- * Better to use this internally to avoid confusion.
97
- */
98
- declare const InternalNovuProvider: ({ children, applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl, useCache, userAgentType, }: NovuProviderProps & {
99
- userAgentType: "components" | "hooks";
100
- }) => react_jsx_runtime.JSX.Element;
101
- declare const useNovu: () => Novu;
102
- declare const useUnsafeNovu: () => Novu | undefined;
103
-
104
- type UseNotificationsProps = {
105
- tags?: string[];
106
- read?: boolean;
107
- archived?: boolean;
108
- limit?: number;
109
- onSuccess?: (data: Notification$1[]) => void;
110
- onError?: (error: NovuError) => void;
111
- };
112
- declare const useNotifications: (props?: UseNotificationsProps) => {
113
- readAll: () => Promise<{
114
- data?: void | undefined;
115
- error?: NovuError | undefined;
116
- }>;
117
- archiveAll: () => Promise<{
118
- data?: void | undefined;
119
- error?: NovuError | undefined;
120
- }>;
121
- archiveAllRead: () => Promise<{
122
- data?: void | undefined;
123
- error?: NovuError | undefined;
124
- }>;
125
- notifications: Notification$1[] | undefined;
126
- error: NovuError | undefined;
127
- isLoading: boolean;
128
- isFetching: boolean;
129
- refetch: () => Promise<void>;
130
- fetchMore: () => Promise<void>;
131
- hasMore: boolean;
132
- };
133
-
134
- type UsePreferencesProps = {
135
- filter?: {
136
- tags?: string[];
137
- };
138
- onSuccess?: (data: Preference[]) => void;
139
- onError?: (error: NovuError) => void;
140
- };
141
- type UsePreferencesResult = {
142
- preferences?: Preference[];
143
- error?: NovuError;
144
- isLoading: boolean;
145
- isFetching: boolean;
146
- refetch: () => Promise<void>;
147
- };
148
- declare const usePreferences: (props?: UsePreferencesProps) => UsePreferencesResult;
149
-
150
- type Count = {
151
- count: number;
152
- filter: NotificationFilter;
153
- };
154
- type UseCountsProps = {
155
- filters: NotificationFilter[];
156
- onSuccess?: (data: Count[]) => void;
157
- onError?: (error: NovuError) => void;
158
- };
159
- type UseCountsResult = {
160
- counts?: Count[];
161
- error?: NovuError;
162
- isLoading: boolean;
163
- isFetching: boolean;
164
- refetch: () => Promise<void>;
165
- };
166
- declare const useCounts: (props: UseCountsProps) => UseCountsResult;
167
-
168
- export { type BaseProps, Bell, type BellProps, type BellRenderer, type BodyRenderer, type DefaultInboxProps, type DefaultProps, Inbox, InboxContent, type InboxContentProps, type InboxProps, InternalNovuProvider, type NoRendererProps, type NotificationProps, type NotificationRendererProps, Notifications, type NotificationsRenderer, NovuProvider, Preferences, type SubjectBodyRendererProps, type SubjectRenderer, type UseNotificationsProps, type WithChildrenProps, useCounts, useNotifications, useNovu, usePreferences, useUnsafeNovu };