@novu/react 3.11.0 → 3.11.2-nightly.20251224.eb609546a3
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/README.md +10 -18
- package/dist/cjs/components/Inbox.cjs +5 -1
- package/dist/cjs/components/Inbox.cjs.map +1 -1
- package/dist/cjs/components/NovuUI.cjs +3 -1
- package/dist/cjs/components/NovuUI.cjs.map +1 -1
- package/dist/cjs/components/NovuUI.d.cts +9 -9
- package/dist/cjs/components/index.cjs +7 -1
- package/dist/cjs/components/index.cjs.map +1 -1
- package/dist/cjs/components/index.d.cts +5 -0
- package/dist/cjs/components/subscription/DefaultSubscription.cjs +59 -0
- package/dist/cjs/components/subscription/DefaultSubscription.cjs.map +1 -0
- package/dist/cjs/components/subscription/DefaultSubscription.d.cts +11 -0
- package/dist/cjs/components/subscription/Subscription.cjs +80 -0
- package/dist/cjs/components/subscription/Subscription.cjs.map +1 -0
- package/dist/cjs/components/subscription/Subscription.d.cts +22 -0
- package/dist/cjs/components/subscription/SubscriptionButton.cjs +91 -0
- package/dist/cjs/components/subscription/SubscriptionButton.cjs.map +1 -0
- package/dist/cjs/components/subscription/SubscriptionButton.d.cts +8 -0
- package/dist/cjs/components/subscription/SubscriptionPreferences.cjs +91 -0
- package/dist/cjs/components/subscription/SubscriptionPreferences.cjs.map +1 -0
- package/dist/cjs/components/subscription/SubscriptionPreferences.d.cts +8 -0
- package/dist/cjs/hooks/NovuProvider.cjs +21 -18
- package/dist/cjs/hooks/NovuProvider.cjs.map +1 -1
- package/dist/cjs/hooks/index.cjs +11 -1
- package/dist/cjs/hooks/index.cjs.map +1 -1
- package/dist/cjs/hooks/index.d.cts +7 -1
- package/dist/cjs/hooks/useCounts.cjs +2 -2
- package/dist/cjs/hooks/useCounts.cjs.map +1 -1
- package/dist/cjs/hooks/useCreateSubscription.cjs +61 -0
- package/dist/cjs/hooks/useCreateSubscription.cjs.map +1 -0
- package/dist/cjs/hooks/useCreateSubscription.d.cts +17 -0
- package/dist/cjs/hooks/useNotifications.cjs +57 -60
- package/dist/cjs/hooks/useNotifications.cjs.map +1 -1
- package/dist/cjs/hooks/useRemoveSubscription.cjs +61 -0
- package/dist/cjs/hooks/useRemoveSubscription.cjs.map +1 -0
- package/dist/cjs/hooks/useRemoveSubscription.d.cts +17 -0
- package/dist/cjs/hooks/useSubscription.cjs +156 -0
- package/dist/cjs/hooks/useSubscription.cjs.map +1 -0
- package/dist/cjs/hooks/useSubscription.d.cts +21 -0
- package/dist/cjs/hooks/useSubscriptions.cjs +121 -0
- package/dist/cjs/hooks/useSubscriptions.cjs.map +1 -0
- package/dist/cjs/hooks/useSubscriptions.d.cts +36 -0
- package/dist/cjs/hooks/useUpdateSubscription.cjs +61 -0
- package/dist/cjs/hooks/useUpdateSubscription.cjs.map +1 -0
- package/dist/cjs/hooks/useUpdateSubscription.d.cts +18 -0
- package/dist/cjs/index.cjs +18 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +14 -3
- package/dist/cjs/server/index.cjs +61 -2
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/index.d.cts +18 -4
- package/dist/cjs/utils/appearance.cjs.map +1 -1
- package/dist/cjs/utils/appearance.d.cts +3 -3
- package/dist/cjs/utils/types.cjs.map +1 -1
- package/dist/cjs/utils/types.d.cts +32 -11
- package/dist/esm/components/Inbox.js +5 -1
- package/dist/esm/components/Inbox.js.map +1 -1
- package/dist/esm/components/NovuUI.d.ts +9 -9
- package/dist/esm/components/NovuUI.js +3 -1
- package/dist/esm/components/NovuUI.js.map +1 -1
- package/dist/esm/components/index.d.ts +5 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/subscription/DefaultSubscription.d.ts +11 -0
- package/dist/esm/components/subscription/DefaultSubscription.js +34 -0
- package/dist/esm/components/subscription/DefaultSubscription.js.map +1 -0
- package/dist/esm/components/subscription/Subscription.d.ts +22 -0
- package/dist/esm/components/subscription/Subscription.js +45 -0
- package/dist/esm/components/subscription/Subscription.js.map +1 -0
- package/dist/esm/components/subscription/SubscriptionButton.d.ts +8 -0
- package/dist/esm/components/subscription/SubscriptionButton.js +56 -0
- package/dist/esm/components/subscription/SubscriptionButton.js.map +1 -0
- package/dist/esm/components/subscription/SubscriptionPreferences.d.ts +8 -0
- package/dist/esm/components/subscription/SubscriptionPreferences.js +56 -0
- package/dist/esm/components/subscription/SubscriptionPreferences.js.map +1 -0
- package/dist/esm/hooks/NovuProvider.js +22 -19
- package/dist/esm/hooks/NovuProvider.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +7 -1
- package/dist/esm/hooks/index.js +5 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useCounts.js +3 -3
- package/dist/esm/hooks/useCounts.js.map +1 -1
- package/dist/esm/hooks/useCreateSubscription.d.ts +17 -0
- package/dist/esm/hooks/useCreateSubscription.js +36 -0
- package/dist/esm/hooks/useCreateSubscription.js.map +1 -0
- package/dist/esm/hooks/useNotifications.js +58 -61
- package/dist/esm/hooks/useNotifications.js.map +1 -1
- package/dist/esm/hooks/useRemoveSubscription.d.ts +17 -0
- package/dist/esm/hooks/useRemoveSubscription.js +36 -0
- package/dist/esm/hooks/useRemoveSubscription.js.map +1 -0
- package/dist/esm/hooks/useSubscription.d.ts +21 -0
- package/dist/esm/hooks/useSubscription.js +129 -0
- package/dist/esm/hooks/useSubscription.js.map +1 -0
- package/dist/esm/hooks/useSubscriptions.d.ts +36 -0
- package/dist/esm/hooks/useSubscriptions.js +96 -0
- package/dist/esm/hooks/useSubscriptions.js.map +1 -0
- package/dist/esm/hooks/useUpdateSubscription.d.ts +18 -0
- package/dist/esm/hooks/useUpdateSubscription.js +36 -0
- package/dist/esm/hooks/useUpdateSubscription.js.map +1 -0
- package/dist/esm/index.d.ts +14 -3
- package/dist/esm/index.js +32 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/index.d.ts +18 -4
- package/dist/esm/server/index.js +53 -2
- package/dist/esm/server/index.js.map +1 -1
- package/dist/esm/utils/appearance.d.ts +3 -3
- package/dist/esm/utils/appearance.js.map +1 -1
- package/dist/esm/utils/types.d.ts +32 -11
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): AllAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance = { ...restAppearance } as AllAppearance;\n\n if (icons) {\n const jsIcons: AllIconOverrides = {};\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\n\n for (const iconKey of iconKeys) {\n // @ts-expect-error: cant easily fix this type error\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\n\n if (reactRenderer) {\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\n return mountElement(el, reactRenderer(props));\n };\n }\n }\n\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\n jsAppearance.icons = jsIcons;\n } else {\n // If original didn't have icons, ensure the clone doesn't either\n delete jsAppearance.icons;\n }\n\n return jsAppearance;\n}\n"],"mappings":";AAIO,SAAS,qBACd,YACA,cAC2B;AAC3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAAe,EAAE,GAAG,eAAe;AAEzC,MAAI,OAAO;AACT,UAAM,UAA4B,CAAC;AACnC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAE9B,YAAM,gBAAgB,MAAM,OAAO;AAEnC,UAAI,eAAe;AACjB,gBAAQ,OAAO,IAAI,CAAC,IAAoB,UAA8B;AACpE,iBAAO,aAAa,IAAI,cAAc,KAAK,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAGA,iBAAa,QAAQ;AAAA,EACvB,OAAO;AAEL,WAAO,aAAa;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnreadCount, DefaultSchedule, Context, Subscriber } from '@novu/js';
|
|
2
|
-
import { Notification,
|
|
2
|
+
import { Notification, InboxIconKey, InboxTheme, SubscriptionIconKey, SubscriptionTheme, AllIconKey, AllTheme, NotificationClickHandler, NotificationActionClickHandler, InboxProps, InboxLocalization, Tab, PreferencesFilter, PreferenceGroups, PreferencesSort, RouterPush } from '@novu/js/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type NotificationsRenderer = (notification: Notification) => React.ReactNode;
|
|
@@ -13,14 +13,32 @@ type ReactIconRendererProps = {
|
|
|
13
13
|
class?: string;
|
|
14
14
|
};
|
|
15
15
|
type ReactIconRenderer = (props: ReactIconRendererProps) => ReactNode;
|
|
16
|
-
type
|
|
17
|
-
[key in
|
|
16
|
+
type ReactInboxIconOverrides = {
|
|
17
|
+
[key in InboxIconKey]?: ReactIconRenderer;
|
|
18
18
|
};
|
|
19
|
-
type
|
|
20
|
-
icons?:
|
|
19
|
+
type ReactInboxTheme = Omit<InboxTheme, 'icons'> & {
|
|
20
|
+
icons?: ReactInboxIconOverrides;
|
|
21
21
|
};
|
|
22
|
-
type
|
|
23
|
-
|
|
22
|
+
type ReactSubscriptionIconOverrides = {
|
|
23
|
+
[key in SubscriptionIconKey]?: ReactIconRenderer;
|
|
24
|
+
};
|
|
25
|
+
type ReactSubscriptionTheme = Omit<SubscriptionTheme, 'icons'> & {
|
|
26
|
+
icons?: ReactSubscriptionIconOverrides;
|
|
27
|
+
};
|
|
28
|
+
type ReactAllIconOverrides = {
|
|
29
|
+
[key in AllIconKey]?: ReactIconRenderer;
|
|
30
|
+
};
|
|
31
|
+
type ReactAllTheme = Omit<AllTheme, 'icons'> & {
|
|
32
|
+
icons?: ReactAllIconOverrides;
|
|
33
|
+
};
|
|
34
|
+
type ReactInboxAppearance = ReactInboxTheme & {
|
|
35
|
+
baseTheme?: InboxTheme | InboxTheme[];
|
|
36
|
+
};
|
|
37
|
+
type ReactSubscriptionAppearance = ReactSubscriptionTheme & {
|
|
38
|
+
baseTheme?: SubscriptionTheme | SubscriptionTheme[];
|
|
39
|
+
};
|
|
40
|
+
type ReactAllAppearance = ReactAllTheme & {
|
|
41
|
+
baseTheme?: ReactAllTheme | ReactAllTheme[];
|
|
24
42
|
};
|
|
25
43
|
type DefaultInboxProps = {
|
|
26
44
|
open?: boolean;
|
|
@@ -42,8 +60,8 @@ type StandardBaseProps = {
|
|
|
42
60
|
contextHash?: string;
|
|
43
61
|
backendUrl?: string;
|
|
44
62
|
socketUrl?: string;
|
|
45
|
-
appearance?:
|
|
46
|
-
localization?:
|
|
63
|
+
appearance?: ReactInboxAppearance;
|
|
64
|
+
localization?: InboxLocalization;
|
|
47
65
|
tabs?: Array<Tab>;
|
|
48
66
|
preferencesFilter?: PreferencesFilter;
|
|
49
67
|
preferenceGroups?: PreferenceGroups;
|
|
@@ -65,7 +83,10 @@ type StandardBaseProps = {
|
|
|
65
83
|
subscriberId?: never;
|
|
66
84
|
applicationIdentifier?: never;
|
|
67
85
|
});
|
|
68
|
-
type
|
|
86
|
+
type InboxBaseProps = Omit<StandardBaseProps, 'appearance'> & {
|
|
87
|
+
appearance?: ReactInboxAppearance;
|
|
88
|
+
};
|
|
89
|
+
type BaseProps = InboxBaseProps;
|
|
69
90
|
type NotificationRendererProps = {
|
|
70
91
|
renderNotification: NotificationsRenderer;
|
|
71
92
|
renderAvatar?: never;
|
|
@@ -97,4 +118,4 @@ type WithChildrenProps = BaseProps & {
|
|
|
97
118
|
children: React.ReactNode;
|
|
98
119
|
};
|
|
99
120
|
|
|
100
|
-
export type { AvatarRenderer, BaseProps, BellRenderer, BodyRenderer, CustomActionsRenderer, DefaultActionsRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer,
|
|
121
|
+
export type { AvatarRenderer, BaseProps, BellRenderer, BodyRenderer, CustomActionsRenderer, DefaultActionsRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, ReactAllAppearance, ReactAllIconOverrides, ReactAllTheme, ReactIconRenderer, ReactIconRendererProps, ReactInboxAppearance, ReactInboxIconOverrides, ReactInboxTheme, ReactSubscriptionAppearance, ReactSubscriptionIconOverrides, ReactSubscriptionTheme, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novu/react",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.2-nightly.20251224.eb609546a3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/novuhq/novu",
|
|
@@ -90,6 +90,14 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build:watch": "tsup --watch",
|
|
95
|
+
"build": "tsup && pnpm run check-exports",
|
|
96
|
+
"check-exports": "attw --pack .",
|
|
97
|
+
"check": "biome check .",
|
|
98
|
+
"check:fix": "biome check --write .",
|
|
99
|
+
"publish:rc": "pnpm publish --tag rc"
|
|
100
|
+
},
|
|
93
101
|
"browserslist": {
|
|
94
102
|
"production": [
|
|
95
103
|
">0.2%",
|
|
@@ -121,19 +129,11 @@
|
|
|
121
129
|
}
|
|
122
130
|
},
|
|
123
131
|
"dependencies": {
|
|
124
|
-
"@novu/js": "
|
|
132
|
+
"@novu/js": "workspace:*"
|
|
125
133
|
},
|
|
126
134
|
"nx": {
|
|
127
135
|
"tags": [
|
|
128
136
|
"type:package"
|
|
129
137
|
]
|
|
130
|
-
},
|
|
131
|
-
"scripts": {
|
|
132
|
-
"build:watch": "tsup --watch",
|
|
133
|
-
"build": "tsup && pnpm run check-exports",
|
|
134
|
-
"check-exports": "attw --pack .",
|
|
135
|
-
"check": "biome check .",
|
|
136
|
-
"check:fix": "biome check --write .",
|
|
137
|
-
"publish:rc": "pnpm publish --tag rc"
|
|
138
138
|
}
|
|
139
|
-
}
|
|
139
|
+
}
|