@notificationapi/react 0.0.13 → 0.0.14
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/assets/Inbox.js +233 -222
- package/dist/assets/Notification.js +1 -1
- package/dist/components/Notifications/Inbox.d.ts +3 -2
- package/dist/components/Notifications/Notification.d.ts +4 -2
- package/dist/components/Notifications/NotificationFeed.d.ts +4 -1
- package/dist/components/Notifications/NotificationFeed.js +16 -11
- package/dist/components/Notifications/NotificationLauncher.js +19 -14
- package/dist/components/Notifications/NotificationPopup.d.ts +4 -1
- package/dist/components/Provider/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -4492,7 +4492,7 @@ const pu = Un.div`
|
|
|
4492
4492
|
&:hover .notification-archive-button {
|
|
4493
4493
|
visibility: ${(e) => e.$archived ? "hidden" : "visible"};
|
|
4494
4494
|
}
|
|
4495
|
-
`, wu = (e) => /* @__PURE__ */ lt(
|
|
4495
|
+
`, wu = (e) => e.renderer ? e.renderer(e.notification) : /* @__PURE__ */ lt(
|
|
4496
4496
|
pu,
|
|
4497
4497
|
{
|
|
4498
4498
|
$redirect: !!e.notification.redirectURL,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { ImageShape } from './Notification';
|
|
2
2
|
import { NotificationPopupProps } from './NotificationPopup';
|
|
3
|
+
import { InAppNotification } from '../../interface';
|
|
3
4
|
|
|
4
5
|
export declare enum Pagination {
|
|
5
6
|
INFINITE_SCROLL = "infinite_scroll",
|
|
6
7
|
PAGINATED = "paginated"
|
|
7
8
|
}
|
|
8
|
-
type InboxProps = {
|
|
9
|
+
export type InboxProps = {
|
|
9
10
|
pagination: keyof typeof Pagination;
|
|
10
11
|
maxHeight: number;
|
|
11
12
|
filter: NotificationPopupProps["filter"];
|
|
12
13
|
imageShape: keyof typeof ImageShape;
|
|
13
14
|
pageSize: number;
|
|
14
15
|
pagePosition: NotificationPopupProps["pagePosition"];
|
|
16
|
+
notificationRenderer: ((notification: InAppNotification) => JSX.Element) | undefined;
|
|
15
17
|
};
|
|
16
18
|
export declare const Inbox: React.FC<InboxProps>;
|
|
17
|
-
export {};
|
|
@@ -4,9 +4,11 @@ export declare enum ImageShape {
|
|
|
4
4
|
square = "square",
|
|
5
5
|
circle = "circle"
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type NotificationProps = {
|
|
8
8
|
notification: InAppNotification;
|
|
9
9
|
markAsArchived: (ids: string[] | "ALL") => void;
|
|
10
10
|
markAsClicked: (id: string) => void;
|
|
11
11
|
imageShape: keyof typeof ImageShape;
|
|
12
|
-
|
|
12
|
+
renderer?: (notification: InAppNotification) => JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export declare const Notification: (props: NotificationProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pagination } from './Inbox';
|
|
2
|
-
import { ImageShape } from './Notification';
|
|
2
|
+
import { ImageShape, NotificationProps } from './Notification';
|
|
3
3
|
import { Filter } from './NotificationPopup';
|
|
4
4
|
import { InAppNotification } from '../../interface';
|
|
5
5
|
|
|
@@ -11,5 +11,8 @@ export type NotificationFeedProps = {
|
|
|
11
11
|
infiniteScrollHeight?: number;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
|
|
14
|
+
renderers?: {
|
|
15
|
+
notification?: NotificationProps["renderer"];
|
|
16
|
+
};
|
|
14
17
|
};
|
|
15
18
|
export declare const NotificationFeed: React.FC<NotificationFeedProps>;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { F as
|
|
4
|
-
import { NotificationAPIContext as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as r, useEffect as g } from "react";
|
|
3
|
+
import { F as f, I as l } from "../../assets/Inbox.js";
|
|
4
|
+
import { NotificationAPIContext as c } from "../Provider/index.js";
|
|
5
5
|
const h = (i) => {
|
|
6
|
+
var n;
|
|
6
7
|
const e = {
|
|
7
8
|
imageShape: i.imageShape || "circle",
|
|
8
9
|
pagination: i.pagination || "INFINITE_SCROLL",
|
|
9
10
|
pageSize: i.pageSize || 10,
|
|
10
11
|
pagePosition: i.pagePosition || "top",
|
|
11
12
|
style: i.style || {},
|
|
12
|
-
filter: i.filter ||
|
|
13
|
-
infiniteScrollHeight: i.infiniteScrollHeight ? i.infiniteScrollHeight : window.innerHeight * 0.75
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
filter: i.filter || f.ALL,
|
|
14
|
+
infiniteScrollHeight: i.infiniteScrollHeight ? i.infiniteScrollHeight : window.innerHeight * 0.75,
|
|
15
|
+
renderers: {
|
|
16
|
+
notification: (n = i.renderers) == null ? void 0 : n.notification
|
|
17
|
+
}
|
|
18
|
+
}, t = r(c);
|
|
19
|
+
return t ? (g(() => {
|
|
16
20
|
t.markAsOpened();
|
|
17
21
|
const a = setInterval(() => {
|
|
18
22
|
t.markAsOpened();
|
|
19
23
|
}, 5e3);
|
|
20
24
|
return () => clearInterval(a);
|
|
21
|
-
}, []), /* @__PURE__ */
|
|
25
|
+
}, []), /* @__PURE__ */ o(
|
|
22
26
|
"div",
|
|
23
27
|
{
|
|
24
28
|
style: {
|
|
@@ -27,7 +31,7 @@ const h = (i) => {
|
|
|
27
31
|
background: "#fff",
|
|
28
32
|
...i.style
|
|
29
33
|
},
|
|
30
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ o(
|
|
31
35
|
l,
|
|
32
36
|
{
|
|
33
37
|
maxHeight: e.infiniteScrollHeight,
|
|
@@ -35,7 +39,8 @@ const h = (i) => {
|
|
|
35
39
|
filter: e.filter,
|
|
36
40
|
imageShape: e.imageShape,
|
|
37
41
|
pageSize: e.pageSize,
|
|
38
|
-
pagePosition: e.pagePosition
|
|
42
|
+
pagePosition: e.pagePosition,
|
|
43
|
+
notificationRenderer: e.renderers.notification
|
|
39
44
|
}
|
|
40
45
|
)
|
|
41
46
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { I as
|
|
2
|
+
import { I as r } from "../../assets/Inbox.js";
|
|
3
3
|
import { UnreadBadge as f } from "./UnreadBadge.js";
|
|
4
|
-
import { useContext as
|
|
4
|
+
import { useContext as d } from "react";
|
|
5
5
|
import { NotificationAPIContext as g } from "../Provider/index.js";
|
|
6
6
|
import { P as u } from "../../assets/index.js";
|
|
7
|
-
import { B as
|
|
8
|
-
import { R as
|
|
7
|
+
import { B as c } from "../../assets/button.js";
|
|
8
|
+
import { R as h } from "../../assets/BellOutlined.js";
|
|
9
9
|
var l = /* @__PURE__ */ ((t) => (t.TOP_LEFT = "top-left", t.TOP_RIGHT = "top-right", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right", t))(l || {});
|
|
10
|
-
const
|
|
10
|
+
const y = (t) => {
|
|
11
|
+
var n;
|
|
11
12
|
const e = {
|
|
12
13
|
buttonWidth: t.buttonWidth || 40,
|
|
13
14
|
buttonHeight: t.buttonHeight || 40,
|
|
@@ -27,8 +28,11 @@ const S = (t) => {
|
|
|
27
28
|
offsetY: t.offsetY || 16,
|
|
28
29
|
position: t.position || "BOTTOM_RIGHT",
|
|
29
30
|
count: t.count || "COUNT_UNOPENED_NOTIFICATIONS",
|
|
30
|
-
filter: t.filter || "ALL"
|
|
31
|
-
|
|
31
|
+
filter: t.filter || "ALL",
|
|
32
|
+
renderers: {
|
|
33
|
+
notification: (n = t.renderers) == null ? void 0 : n.notification
|
|
34
|
+
}
|
|
35
|
+
}, o = d(g);
|
|
32
36
|
return o ? /* @__PURE__ */ i(
|
|
33
37
|
"div",
|
|
34
38
|
{
|
|
@@ -44,14 +48,15 @@ const S = (t) => {
|
|
|
44
48
|
autoAdjustOverflow: !0,
|
|
45
49
|
trigger: "click",
|
|
46
50
|
content: /* @__PURE__ */ i(
|
|
47
|
-
|
|
51
|
+
r,
|
|
48
52
|
{
|
|
49
53
|
maxHeight: 500,
|
|
50
54
|
pagination: e.pagination,
|
|
51
55
|
filter: e.filter,
|
|
52
56
|
imageShape: e.imageShape,
|
|
53
57
|
pageSize: e.pageSize,
|
|
54
|
-
pagePosition: e.pagePosition
|
|
58
|
+
pagePosition: e.pagePosition,
|
|
59
|
+
notificationRenderer: e.renderers.notification
|
|
55
60
|
}
|
|
56
61
|
),
|
|
57
62
|
arrow: !1,
|
|
@@ -59,8 +64,8 @@ const S = (t) => {
|
|
|
59
64
|
padding: "0 16px",
|
|
60
65
|
minWidth: e.popupWidth
|
|
61
66
|
},
|
|
62
|
-
onOpenChange: (
|
|
63
|
-
|
|
67
|
+
onOpenChange: (a) => {
|
|
68
|
+
a && o.markAsOpened();
|
|
64
69
|
},
|
|
65
70
|
children: /* @__PURE__ */ i(
|
|
66
71
|
"div",
|
|
@@ -78,10 +83,10 @@ const S = (t) => {
|
|
|
78
83
|
},
|
|
79
84
|
count: e.count,
|
|
80
85
|
children: /* @__PURE__ */ i(
|
|
81
|
-
|
|
86
|
+
c,
|
|
82
87
|
{
|
|
83
88
|
icon: /* @__PURE__ */ i(
|
|
84
|
-
|
|
89
|
+
h,
|
|
85
90
|
{
|
|
86
91
|
style: {
|
|
87
92
|
fontSize: e.buttonIconSize
|
|
@@ -106,6 +111,6 @@ const S = (t) => {
|
|
|
106
111
|
) : null;
|
|
107
112
|
};
|
|
108
113
|
export {
|
|
109
|
-
|
|
114
|
+
y as NotificationLauncher,
|
|
110
115
|
l as Position
|
|
111
116
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Pagination } from './Inbox';
|
|
2
2
|
import { UnreadBadgeProps } from './UnreadBadge';
|
|
3
|
-
import { ImageShape } from './Notification';
|
|
3
|
+
import { ImageShape, NotificationProps } from './Notification';
|
|
4
4
|
import { InAppNotification } from '../../interface';
|
|
5
5
|
|
|
6
6
|
export declare enum Filter {
|
|
@@ -21,5 +21,8 @@ export type NotificationPopupProps = {
|
|
|
21
21
|
unreadBadgeProps?: UnreadBadgeProps;
|
|
22
22
|
count?: UnreadBadgeProps["count"];
|
|
23
23
|
filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
|
|
24
|
+
renderers?: {
|
|
25
|
+
notification?: NotificationProps["renderer"];
|
|
26
|
+
};
|
|
24
27
|
};
|
|
25
28
|
export declare const NotificationPopup: React.FC<NotificationPopupProps>;
|
|
@@ -25,7 +25,7 @@ export declare enum DeliveryOptions {
|
|
|
25
25
|
WEEKLY = "weekly",
|
|
26
26
|
MONTHLY = "monthly"
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
28
|
+
export interface NotificationConfig {
|
|
29
29
|
envId: string;
|
|
30
30
|
notificationId: string;
|
|
31
31
|
title: string;
|
|
@@ -82,7 +82,7 @@ export interface Preferences {
|
|
|
82
82
|
notificationId: string;
|
|
83
83
|
title: string;
|
|
84
84
|
channels: Channels[];
|
|
85
|
-
options:
|
|
85
|
+
options: NotificationConfig["options"];
|
|
86
86
|
}[];
|
|
87
87
|
subNotifications: {
|
|
88
88
|
notificationId: string;
|