@notificationapi/react 0.0.24 → 0.0.25
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/AntdIcon.js +200 -0
- package/dist/assets/Notification.js +118 -119
- package/dist/assets/PurePanel.js +69 -0
- package/dist/assets/RightOutlined.js +13 -0
- package/dist/assets/button.js +19 -18
- package/dist/assets/channelUtils.js +77 -0
- package/dist/assets/colors.js +8534 -9304
- package/dist/assets/index.js +16 -15
- package/dist/assets/index2.js +33 -32
- package/dist/assets/index3.js +722 -8531
- package/dist/assets/index4.js +8408 -0
- package/dist/assets/pickAttrs.js +42 -0
- package/dist/components/Notifications/Inbox.d.ts +3 -7
- package/dist/components/Notifications/Inbox.js +6250 -8
- package/dist/components/Notifications/InboxHeader.d.ts +1 -1
- package/dist/components/Notifications/InboxHeader.js +8 -7
- package/dist/components/Notifications/Notification.d.ts +2 -5
- package/dist/components/Notifications/Notification.js +3 -4
- package/dist/components/Notifications/NotificationCounter.d.ts +2 -2
- package/dist/components/Notifications/NotificationFeed.d.ts +4 -5
- package/dist/components/Notifications/NotificationFeed.js +28 -26
- package/dist/components/Notifications/NotificationLauncher.d.ts +1 -6
- package/dist/components/Notifications/NotificationLauncher.js +16 -18
- package/dist/components/Notifications/NotificationPopup.d.ts +5 -9
- package/dist/components/Notifications/NotificationPopup.js +119 -12
- package/dist/components/Notifications/UnreadBadge.d.ts +4 -7
- package/dist/components/Notifications/UnreadBadge.js +8 -10
- package/dist/components/Notifications/index.js +5 -5
- package/dist/components/Notifications/interface.d.ts +46 -0
- package/dist/components/Notifications/interface.js +19 -0
- package/dist/components/Preferences/NotificationPreferencesInline.d.ts +1 -1
- package/dist/components/Preferences/NotificationPreferencesInline.js +1 -1
- package/dist/components/Preferences/NotificationPreferencesPopup.js +1503 -4
- package/dist/components/Preferences/PreferenceInput.d.ts +5 -4
- package/dist/components/Preferences/PreferenceInput.js +1435 -4
- package/dist/components/Preferences/Preferences.d.ts +1 -4
- package/dist/components/Preferences/Preferences.js +581 -8
- package/dist/components/Preferences/channelUtils.d.ts +4 -0
- package/dist/components/Preferences/channelUtils.js +8 -0
- package/dist/components/Preferences/index.js +1 -1
- package/dist/components/Provider/index.d.ts +2 -2
- package/dist/components/Provider/index.js +150 -126
- package/dist/main.d.ts +2 -2
- package/dist/main.js +9 -9
- package/package.json +5 -2
- package/dist/assets/Inbox.js +0 -6363
- package/dist/assets/NotificationPreferencesPopup.js +0 -1562
- package/dist/assets/Preferences.js +0 -2120
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type InboxHeaderProps = {
|
|
3
3
|
title?: JSX.Element;
|
|
4
|
-
button1ClickHandler?: (ids: string[] |
|
|
4
|
+
button1ClickHandler?: (ids: string[] | 'ALL') => void;
|
|
5
5
|
button2ClickHandler?: () => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const InboxHeader: (props: InboxHeaderProps) => JSX.Element;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { T as s, R as d } from "../../assets/index4.js";
|
|
3
3
|
import { P as c } from "../../assets/index.js";
|
|
4
4
|
import { B as a } from "../../assets/button.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as m } from "../../assets/index3.js";
|
|
6
6
|
import * as i from "react";
|
|
7
|
+
import { I as f } from "../../assets/AntdIcon.js";
|
|
7
8
|
var u = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z" } }] }, name: "setting", theme: "outlined" }, p = function(l, r) {
|
|
8
|
-
return /* @__PURE__ */ i.createElement(
|
|
9
|
+
return /* @__PURE__ */ i.createElement(f, m({}, l, {
|
|
9
10
|
ref: r,
|
|
10
11
|
icon: u
|
|
11
12
|
}));
|
|
12
13
|
}, o = /* @__PURE__ */ i.forwardRef(p);
|
|
13
14
|
process.env.NODE_ENV !== "production" && (o.displayName = "SettingOutlined");
|
|
14
|
-
const
|
|
15
|
-
const l = e.title ?? /* @__PURE__ */ t(
|
|
15
|
+
const R = (e) => {
|
|
16
|
+
const l = e.title ?? /* @__PURE__ */ t(s.Text, { strong: !0, children: "Notifications" });
|
|
16
17
|
return /* @__PURE__ */ n(
|
|
17
18
|
"div",
|
|
18
19
|
{
|
|
@@ -27,7 +28,7 @@ const C = (e) => {
|
|
|
27
28
|
/* @__PURE__ */ t(c, { content: "Resolve all", children: /* @__PURE__ */ t(
|
|
28
29
|
a,
|
|
29
30
|
{
|
|
30
|
-
icon: /* @__PURE__ */ t(
|
|
31
|
+
icon: /* @__PURE__ */ t(d, {}),
|
|
31
32
|
size: "small",
|
|
32
33
|
type: "text",
|
|
33
34
|
onClick: () => {
|
|
@@ -50,5 +51,5 @@ const C = (e) => {
|
|
|
50
51
|
);
|
|
51
52
|
};
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
R as InboxHeader
|
|
54
55
|
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
2
|
+
import { ImageShape } from './interface';
|
|
2
3
|
|
|
3
|
-
export declare enum ImageShape {
|
|
4
|
-
square = "square",
|
|
5
|
-
circle = "circle"
|
|
6
|
-
}
|
|
7
4
|
export type NotificationProps = {
|
|
8
5
|
notifications: InAppNotification[];
|
|
9
|
-
markAsArchived: (ids: string[] |
|
|
6
|
+
markAsArchived: (ids: string[] | 'ALL') => void;
|
|
10
7
|
markAsClicked: (ids: string[]) => void;
|
|
11
8
|
imageShape: keyof typeof ImageShape;
|
|
12
9
|
renderer?: (notification: InAppNotification[]) => JSX.Element;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "../../assets/
|
|
2
|
+
import { N as a } from "../../assets/Notification.js";
|
|
3
|
+
import "../../assets/index4.js";
|
|
4
4
|
import "../../assets/button.js";
|
|
5
5
|
import "../../assets/index2.js";
|
|
6
6
|
export {
|
|
7
|
-
a as
|
|
8
|
-
e as Notification
|
|
7
|
+
a as Notification
|
|
9
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { UnreadBadgeProps } from './UnreadBadge';
|
|
3
3
|
|
|
4
|
-
export type NotificationCounterProps = Omit<UnreadBadgeProps,
|
|
5
|
-
count?: UnreadBadgeProps[
|
|
4
|
+
export type NotificationCounterProps = Omit<UnreadBadgeProps, 'count'> & {
|
|
5
|
+
count?: UnreadBadgeProps['count'];
|
|
6
6
|
};
|
|
7
7
|
export declare const NotificationCounter: React.FC<PropsWithChildren<NotificationCounterProps>>;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ImageShape, NotificationProps } from './Notification';
|
|
3
|
-
import { Filter } from './NotificationPopup';
|
|
1
|
+
import { NotificationProps } from './Notification';
|
|
4
2
|
import { InboxHeaderProps } from './InboxHeader';
|
|
5
3
|
import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
4
|
+
import { Filter, ImageShape, Pagination } from './interface';
|
|
6
5
|
|
|
7
6
|
export type NotificationFeedProps = {
|
|
8
7
|
imageShape?: keyof typeof ImageShape;
|
|
9
8
|
pagination?: keyof typeof Pagination;
|
|
10
9
|
pageSize?: number;
|
|
11
|
-
pagePosition?:
|
|
10
|
+
pagePosition?: 'top' | 'bottom';
|
|
12
11
|
infiniteScrollHeight?: number;
|
|
13
12
|
style?: React.CSSProperties;
|
|
14
13
|
filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
|
|
15
14
|
renderers?: {
|
|
16
|
-
notification?: NotificationProps[
|
|
15
|
+
notification?: NotificationProps['renderer'];
|
|
17
16
|
};
|
|
18
17
|
header?: InboxHeaderProps;
|
|
19
18
|
};
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import { NotificationAPIContext as
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
const
|
|
9
|
-
var r,
|
|
10
|
-
const [
|
|
11
|
-
if (
|
|
1
|
+
import { jsxs as d, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useContext as s, useEffect as h } from "react";
|
|
3
|
+
import { Inbox as u } from "./Inbox.js";
|
|
4
|
+
import { NotificationAPIContext as S } from "../Provider/index.js";
|
|
5
|
+
import { NotificationPreferencesPopup as x } from "../Preferences/NotificationPreferencesPopup.js";
|
|
6
|
+
import "../Preferences/PreferenceInput.js";
|
|
7
|
+
import { Filter as H } from "./interface.js";
|
|
8
|
+
const v = (e) => {
|
|
9
|
+
var r, o, a, l;
|
|
10
|
+
const [c, n] = m(!1), t = s(S);
|
|
11
|
+
if (h(() => {
|
|
12
|
+
if (!t)
|
|
13
|
+
return;
|
|
14
|
+
t.markAsOpened();
|
|
15
|
+
const g = setInterval(() => {
|
|
16
|
+
t.markAsOpened();
|
|
17
|
+
}, 5e3);
|
|
18
|
+
return () => clearInterval(g);
|
|
19
|
+
}, [t]), !t)
|
|
12
20
|
return null;
|
|
13
21
|
const i = {
|
|
14
22
|
imageShape: e.imageShape || "circle",
|
|
@@ -16,24 +24,18 @@ const N = (e) => {
|
|
|
16
24
|
pageSize: e.pageSize || 10,
|
|
17
25
|
pagePosition: e.pagePosition || "top",
|
|
18
26
|
style: e.style || {},
|
|
19
|
-
filter: e.filter ||
|
|
27
|
+
filter: e.filter || H.ALL,
|
|
20
28
|
infiniteScrollHeight: e.infiniteScrollHeight ? e.infiniteScrollHeight : window.innerHeight * 0.75,
|
|
21
29
|
renderers: {
|
|
22
30
|
notification: (r = e.renderers) == null ? void 0 : r.notification
|
|
23
31
|
},
|
|
24
32
|
header: {
|
|
25
|
-
title: (
|
|
26
|
-
button1ClickHandler: ((
|
|
33
|
+
title: (o = e.header) == null ? void 0 : o.title,
|
|
34
|
+
button1ClickHandler: ((a = e.header) == null ? void 0 : a.button1ClickHandler) ?? t.markAsArchived,
|
|
27
35
|
button2ClickHandler: ((l = e.header) == null ? void 0 : l.button2ClickHandler) ?? (() => n(!0))
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
|
-
return
|
|
31
|
-
t.markAsOpened();
|
|
32
|
-
const g = setInterval(() => {
|
|
33
|
-
t.markAsOpened();
|
|
34
|
-
}, 5e3);
|
|
35
|
-
return () => clearInterval(g);
|
|
36
|
-
}, []), /* @__PURE__ */ d(
|
|
38
|
+
return /* @__PURE__ */ d(
|
|
37
39
|
"div",
|
|
38
40
|
{
|
|
39
41
|
style: {
|
|
@@ -43,7 +45,7 @@ const N = (e) => {
|
|
|
43
45
|
...e.style
|
|
44
46
|
},
|
|
45
47
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ f(
|
|
47
49
|
u,
|
|
48
50
|
{
|
|
49
51
|
maxHeight: i.infiniteScrollHeight,
|
|
@@ -56,10 +58,10 @@ const N = (e) => {
|
|
|
56
58
|
header: i.header
|
|
57
59
|
}
|
|
58
60
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
61
|
+
/* @__PURE__ */ f(
|
|
62
|
+
x,
|
|
61
63
|
{
|
|
62
|
-
open:
|
|
64
|
+
open: c,
|
|
63
65
|
onClose: () => n(!1)
|
|
64
66
|
}
|
|
65
67
|
)
|
|
@@ -68,5 +70,5 @@ const N = (e) => {
|
|
|
68
70
|
);
|
|
69
71
|
};
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
v as NotificationFeed
|
|
72
74
|
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { NotificationPopupProps } from './NotificationPopup';
|
|
2
|
+
import { Position } from './interface';
|
|
2
3
|
|
|
3
|
-
export declare enum Position {
|
|
4
|
-
TOP_LEFT = "top-left",
|
|
5
|
-
TOP_RIGHT = "top-right",
|
|
6
|
-
BOTTOM_LEFT = "bottom-left",
|
|
7
|
-
BOTTOM_RIGHT = "bottom-right"
|
|
8
|
-
}
|
|
9
4
|
type NotificationLaucherProps = NotificationPopupProps & {
|
|
10
5
|
position?: keyof typeof Position;
|
|
11
6
|
offsetX?: number | string;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Inbox as l } from "./Inbox.js";
|
|
3
3
|
import { UnreadBadge as g } from "./UnreadBadge.js";
|
|
4
4
|
import { useState as m, useContext as b } from "react";
|
|
5
5
|
import { NotificationAPIContext as s } from "../Provider/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import { R as p } from "../../assets/
|
|
9
|
-
import { P as
|
|
10
|
-
import { B as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const [u, o] = m(!1), n = b(s);
|
|
6
|
+
import { NotificationPreferencesPopup as I } from "../Preferences/NotificationPreferencesPopup.js";
|
|
7
|
+
import "../Preferences/PreferenceInput.js";
|
|
8
|
+
import { R as p } from "../../assets/channelUtils.js";
|
|
9
|
+
import { P as S } from "../../assets/index.js";
|
|
10
|
+
import { B as P } from "../../assets/button.js";
|
|
11
|
+
const B = (t) => {
|
|
12
|
+
var a, r, d, u;
|
|
13
|
+
const [c, o] = m(!1), n = b(s);
|
|
15
14
|
if (!n)
|
|
16
15
|
return null;
|
|
17
16
|
const e = {
|
|
@@ -45,7 +44,7 @@ const _ = (t) => {
|
|
|
45
44
|
button2ClickHandler: ((d = t.header) == null ? void 0 : d.button2ClickHandler) ?? (() => o(!0))
|
|
46
45
|
},
|
|
47
46
|
renderers: {
|
|
48
|
-
notification: (
|
|
47
|
+
notification: (u = t.renderers) == null ? void 0 : u.notification
|
|
49
48
|
}
|
|
50
49
|
};
|
|
51
50
|
return /* @__PURE__ */ h(
|
|
@@ -59,7 +58,7 @@ const _ = (t) => {
|
|
|
59
58
|
},
|
|
60
59
|
children: [
|
|
61
60
|
/* @__PURE__ */ i(
|
|
62
|
-
|
|
61
|
+
S,
|
|
63
62
|
{
|
|
64
63
|
autoAdjustOverflow: !0,
|
|
65
64
|
trigger: "click",
|
|
@@ -81,8 +80,8 @@ const _ = (t) => {
|
|
|
81
80
|
padding: "0 16px",
|
|
82
81
|
minWidth: e.popupWidth
|
|
83
82
|
},
|
|
84
|
-
onOpenChange: (
|
|
85
|
-
|
|
83
|
+
onOpenChange: (f) => {
|
|
84
|
+
f && n.markAsOpened();
|
|
86
85
|
},
|
|
87
86
|
children: /* @__PURE__ */ i(
|
|
88
87
|
"div",
|
|
@@ -100,7 +99,7 @@ const _ = (t) => {
|
|
|
100
99
|
},
|
|
101
100
|
count: e.count,
|
|
102
101
|
children: /* @__PURE__ */ i(
|
|
103
|
-
|
|
102
|
+
P,
|
|
104
103
|
{
|
|
105
104
|
icon: e.buttonIcon,
|
|
106
105
|
style: {
|
|
@@ -120,7 +119,7 @@ const _ = (t) => {
|
|
|
120
119
|
/* @__PURE__ */ i(
|
|
121
120
|
I,
|
|
122
121
|
{
|
|
123
|
-
open:
|
|
122
|
+
open: c,
|
|
124
123
|
onClose: () => o(!1)
|
|
125
124
|
}
|
|
126
125
|
)
|
|
@@ -129,6 +128,5 @@ const _ = (t) => {
|
|
|
129
128
|
);
|
|
130
129
|
};
|
|
131
130
|
export {
|
|
132
|
-
|
|
133
|
-
S as Position
|
|
131
|
+
B as NotificationLauncher
|
|
134
132
|
};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { Pagination } from './Inbox';
|
|
2
1
|
import { UnreadBadgeProps } from './UnreadBadge';
|
|
3
|
-
import {
|
|
2
|
+
import { NotificationProps } from './Notification';
|
|
4
3
|
import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
5
4
|
import { InboxHeaderProps } from './InboxHeader';
|
|
5
|
+
import { Filter, ImageShape, Pagination } from './interface';
|
|
6
6
|
|
|
7
|
-
export declare enum Filter {
|
|
8
|
-
ALL = "ALL",
|
|
9
|
-
UNARCHIVED = "UNARCHIVED"
|
|
10
|
-
}
|
|
11
7
|
export type NotificationPopupProps = {
|
|
12
8
|
buttonIcon?: React.ReactNode;
|
|
13
9
|
buttonIconSize?: number;
|
|
@@ -18,13 +14,13 @@ export type NotificationPopupProps = {
|
|
|
18
14
|
imageShape?: keyof typeof ImageShape;
|
|
19
15
|
pagination?: keyof typeof Pagination;
|
|
20
16
|
pageSize?: number;
|
|
21
|
-
pagePosition?:
|
|
17
|
+
pagePosition?: 'top' | 'bottom';
|
|
22
18
|
popupZIndex?: number;
|
|
23
19
|
unreadBadgeProps?: UnreadBadgeProps;
|
|
24
|
-
count?: UnreadBadgeProps[
|
|
20
|
+
count?: UnreadBadgeProps['count'];
|
|
25
21
|
filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
|
|
26
22
|
renderers?: {
|
|
27
|
-
notification?: NotificationProps[
|
|
23
|
+
notification?: NotificationProps['renderer'];
|
|
28
24
|
};
|
|
29
25
|
header?: InboxHeaderProps;
|
|
30
26
|
};
|
|
@@ -1,14 +1,121 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "./UnreadBadge.js";
|
|
4
|
-
import "../Provider/index.js";
|
|
5
|
-
import "react";
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "../../assets/
|
|
10
|
-
import "../../assets/
|
|
1
|
+
import { jsx as i, jsxs as h, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { Inbox as g } from "./Inbox.js";
|
|
3
|
+
import { UnreadBadge as m } from "./UnreadBadge.js";
|
|
4
|
+
import { NotificationAPIContext as p } from "../Provider/index.js";
|
|
5
|
+
import { useState as b, useContext as I } from "react";
|
|
6
|
+
import { NotificationPreferencesPopup as P } from "../Preferences/NotificationPreferencesPopup.js";
|
|
7
|
+
import "../Preferences/PreferenceInput.js";
|
|
8
|
+
import { Filter as S } from "./interface.js";
|
|
9
|
+
import { R as s } from "../../assets/channelUtils.js";
|
|
10
|
+
import { P as x } from "../../assets/index.js";
|
|
11
|
+
import { B as C } from "../../assets/button.js";
|
|
12
|
+
const F = (t) => {
|
|
13
|
+
var a, r, d, u;
|
|
14
|
+
const [c, o] = b(!1), n = I(p);
|
|
15
|
+
if (!n)
|
|
16
|
+
return null;
|
|
17
|
+
const e = {
|
|
18
|
+
buttonIcon: t.buttonIcon || /* @__PURE__ */ i(
|
|
19
|
+
s,
|
|
20
|
+
{
|
|
21
|
+
style: {
|
|
22
|
+
fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
buttonWidth: t.buttonWidth || 40,
|
|
27
|
+
buttonHeight: t.buttonHeight || 40,
|
|
28
|
+
popupWidth: t.popupWidth || 400,
|
|
29
|
+
popupHeight: t.popupHeight || 600,
|
|
30
|
+
buttonIconSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
|
|
31
|
+
imageShape: t.imageShape || "circle",
|
|
32
|
+
pagination: t.pagination || "INFINITE_SCROLL",
|
|
33
|
+
pageSize: t.pageSize || 10,
|
|
34
|
+
pagePosition: t.pagePosition || "top",
|
|
35
|
+
popupZIndex: t.popupZIndex || 1030,
|
|
36
|
+
unreadBadgeProps: t.unreadBadgeProps ?? {},
|
|
37
|
+
count: t.count || "COUNT_UNOPENED_NOTIFICATIONS",
|
|
38
|
+
filter: t.filter || S.ALL,
|
|
39
|
+
header: {
|
|
40
|
+
title: (a = t.header) == null ? void 0 : a.title,
|
|
41
|
+
button1ClickHandler: ((r = t.header) == null ? void 0 : r.button1ClickHandler) ?? n.markAsArchived,
|
|
42
|
+
button2ClickHandler: ((d = t.header) == null ? void 0 : d.button2ClickHandler) ?? (() => o(!0))
|
|
43
|
+
},
|
|
44
|
+
renderers: {
|
|
45
|
+
notification: (u = t.renderers) == null ? void 0 : u.notification
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ h(f, { children: [
|
|
49
|
+
/* @__PURE__ */ i(
|
|
50
|
+
x,
|
|
51
|
+
{
|
|
52
|
+
autoAdjustOverflow: !0,
|
|
53
|
+
trigger: "click",
|
|
54
|
+
content: /* @__PURE__ */ i(
|
|
55
|
+
g,
|
|
56
|
+
{
|
|
57
|
+
maxHeight: e.popupHeight - 73,
|
|
58
|
+
pagination: e.pagination,
|
|
59
|
+
filter: e.filter,
|
|
60
|
+
imageShape: e.imageShape,
|
|
61
|
+
pageSize: e.pageSize,
|
|
62
|
+
pagePosition: e.pagePosition,
|
|
63
|
+
notificationRenderer: e.renderers.notification,
|
|
64
|
+
header: e.header
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
onOpenChange: (l) => {
|
|
68
|
+
l && n.markAsOpened();
|
|
69
|
+
},
|
|
70
|
+
arrow: !1,
|
|
71
|
+
overlayStyle: {
|
|
72
|
+
padding: "0 16px",
|
|
73
|
+
width: e.popupWidth
|
|
74
|
+
},
|
|
75
|
+
zIndex: t.popupZIndex,
|
|
76
|
+
children: /* @__PURE__ */ i(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
style: {
|
|
80
|
+
display: "inline-block"
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ i(
|
|
83
|
+
m,
|
|
84
|
+
{
|
|
85
|
+
...t.unreadBadgeProps,
|
|
86
|
+
style: {
|
|
87
|
+
top: 5,
|
|
88
|
+
right: 5
|
|
89
|
+
},
|
|
90
|
+
count: e.count,
|
|
91
|
+
filter: e.filter,
|
|
92
|
+
children: /* @__PURE__ */ i(
|
|
93
|
+
C,
|
|
94
|
+
{
|
|
95
|
+
icon: e.buttonIcon,
|
|
96
|
+
style: {
|
|
97
|
+
width: e.buttonWidth,
|
|
98
|
+
height: e.buttonHeight
|
|
99
|
+
},
|
|
100
|
+
shape: "circle",
|
|
101
|
+
type: "text"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ i(
|
|
111
|
+
P,
|
|
112
|
+
{
|
|
113
|
+
open: c,
|
|
114
|
+
onClose: () => o(!1)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] });
|
|
118
|
+
};
|
|
11
119
|
export {
|
|
12
|
-
|
|
13
|
-
c as NotificationPopup
|
|
120
|
+
F as NotificationPopup
|
|
14
121
|
};
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { NotificationPopupProps } from './NotificationPopup';
|
|
3
3
|
import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
4
|
+
import { COUNT_TYPE } from './interface';
|
|
4
5
|
|
|
5
6
|
export type UnreadBadgeProps = {
|
|
6
|
-
color?:
|
|
7
|
+
color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold' | undefined;
|
|
7
8
|
overflowCount?: number;
|
|
8
9
|
dot?: boolean;
|
|
9
10
|
showZero?: boolean;
|
|
10
|
-
size?:
|
|
11
|
+
size?: 'default' | 'small';
|
|
11
12
|
style?: React.CSSProperties;
|
|
12
13
|
count?: keyof typeof COUNT_TYPE | ((notification: InAppNotification) => boolean);
|
|
13
|
-
filter?: NotificationPopupProps[
|
|
14
|
+
filter?: NotificationPopupProps['filter'];
|
|
14
15
|
};
|
|
15
|
-
export declare enum COUNT_TYPE {
|
|
16
|
-
COUNT_UNOPENED_NOTIFICATIONS = "COUNT_UNOPENED_NOTIFICATIONS",
|
|
17
|
-
COUNT_UNARCHIVED_NOTIFICATIONS = "COUNT_UNARCHIVED_NOTIFICATIONS"
|
|
18
|
-
}
|
|
19
16
|
export declare const UnreadBadge: React.FunctionComponent<PropsWithChildren<UnreadBadgeProps>>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as r } from "react";
|
|
3
|
-
import { NotificationAPIContext as
|
|
4
|
-
import { B as
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
I,
|
|
3
|
+
import { NotificationAPIContext as c } from "../Provider/index.js";
|
|
4
|
+
import { B as l } from "../../assets/index2.js";
|
|
5
|
+
const h = (e) => {
|
|
6
|
+
const o = r(c);
|
|
7
|
+
return /* @__PURE__ */ i(
|
|
8
|
+
l,
|
|
10
9
|
{
|
|
11
10
|
count: ((n) => e.count === "COUNT_UNOPENED_NOTIFICATIONS" || e.count === void 0 ? n.filter((t) => !t.opened && !t.seen).length : e.count === "COUNT_UNARCHIVED_NOTIFICATIONS" ? n.filter(
|
|
12
11
|
(t) => !t.archived && !t.clicked && !t.replies && !t.actioned1 && !t.actioned2
|
|
@@ -24,6 +23,5 @@ const d = (e) => {
|
|
|
24
23
|
);
|
|
25
24
|
};
|
|
26
25
|
export {
|
|
27
|
-
|
|
28
|
-
d as UnreadBadge
|
|
26
|
+
h as UnreadBadge
|
|
29
27
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NotificationFeed as i } from "./NotificationFeed.js";
|
|
2
|
-
import {
|
|
3
|
-
import { NotificationLauncher as
|
|
4
|
-
import { NotificationCounter as
|
|
2
|
+
import { NotificationPopup as e } from "./NotificationPopup.js";
|
|
3
|
+
import { NotificationLauncher as n } from "./NotificationLauncher.js";
|
|
4
|
+
import { NotificationCounter as a } from "./NotificationCounter.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as NotificationCounter,
|
|
7
7
|
i as NotificationFeed,
|
|
8
|
-
|
|
8
|
+
n as NotificationLauncher,
|
|
9
9
|
e as NotificationPopup
|
|
10
10
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare enum Pagination {
|
|
2
|
+
INFINITE_SCROLL = "infinite_scroll",
|
|
3
|
+
PAGINATED = "paginated"
|
|
4
|
+
}
|
|
5
|
+
export declare enum ImageShape {
|
|
6
|
+
square = "square",
|
|
7
|
+
circle = "circle"
|
|
8
|
+
}
|
|
9
|
+
export declare enum Filter {
|
|
10
|
+
ALL = "ALL",
|
|
11
|
+
UNARCHIVED = "UNARCHIVED"
|
|
12
|
+
}
|
|
13
|
+
export declare enum Channels {
|
|
14
|
+
EMAIL = "EMAIL",
|
|
15
|
+
INAPP_WEB = "INAPP_WEB",
|
|
16
|
+
SMS = "SMS",
|
|
17
|
+
CALL = "CALL",
|
|
18
|
+
PUSH = "PUSH",
|
|
19
|
+
WEB_PUSH = "WEB_PUSH"
|
|
20
|
+
}
|
|
21
|
+
export declare enum DeliveryOptions {
|
|
22
|
+
OFF = "off",
|
|
23
|
+
INSTANT = "instant",
|
|
24
|
+
HOURLY = "hourly",
|
|
25
|
+
DAILY = "daily",
|
|
26
|
+
WEEKLY = "weekly",
|
|
27
|
+
MONTHLY = "monthly"
|
|
28
|
+
}
|
|
29
|
+
export declare enum COUNT_TYPE {
|
|
30
|
+
COUNT_UNOPENED_NOTIFICATIONS = "COUNT_UNOPENED_NOTIFICATIONS",
|
|
31
|
+
COUNT_UNARCHIVED_NOTIFICATIONS = "COUNT_UNARCHIVED_NOTIFICATIONS"
|
|
32
|
+
}
|
|
33
|
+
export declare enum Position {
|
|
34
|
+
TOP_LEFT = "top-left",
|
|
35
|
+
TOP_RIGHT = "top-right",
|
|
36
|
+
BOTTOM_LEFT = "bottom-left",
|
|
37
|
+
BOTTOM_RIGHT = "bottom-right"
|
|
38
|
+
}
|
|
39
|
+
export declare const NOTIFICATION_ACTIONS: {
|
|
40
|
+
opened: string;
|
|
41
|
+
clicked: string;
|
|
42
|
+
archived: string;
|
|
43
|
+
replied: string;
|
|
44
|
+
actioned1: string;
|
|
45
|
+
actioned2: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var N = /* @__PURE__ */ ((I) => (I.INFINITE_SCROLL = "infinite_scroll", I.PAGINATED = "paginated", I))(N || {}), r = /* @__PURE__ */ ((I) => (I.square = "square", I.circle = "circle", I))(r || {}), T = /* @__PURE__ */ ((I) => (I.ALL = "ALL", I.UNARCHIVED = "UNARCHIVED", I))(T || {}), A = /* @__PURE__ */ ((I) => (I.EMAIL = "EMAIL", I.INAPP_WEB = "INAPP_WEB", I.SMS = "SMS", I.CALL = "CALL", I.PUSH = "PUSH", I.WEB_PUSH = "WEB_PUSH", I))(A || {}), O = /* @__PURE__ */ ((I) => (I.OFF = "off", I.INSTANT = "instant", I.HOURLY = "hourly", I.DAILY = "daily", I.WEEKLY = "weekly", I.MONTHLY = "monthly", I))(O || {}), E = /* @__PURE__ */ ((I) => (I.COUNT_UNOPENED_NOTIFICATIONS = "COUNT_UNOPENED_NOTIFICATIONS", I.COUNT_UNARCHIVED_NOTIFICATIONS = "COUNT_UNARCHIVED_NOTIFICATIONS", I))(E || {}), t = /* @__PURE__ */ ((I) => (I.TOP_LEFT = "top-left", I.TOP_RIGHT = "top-right", I.BOTTOM_LEFT = "bottom-left", I.BOTTOM_RIGHT = "bottom-right", I))(t || {});
|
|
2
|
+
const L = {
|
|
3
|
+
opened: "opened",
|
|
4
|
+
clicked: "clicked",
|
|
5
|
+
archived: "archived",
|
|
6
|
+
replied: "replied",
|
|
7
|
+
actioned1: "actioned1",
|
|
8
|
+
actioned2: "actioned2"
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
E as COUNT_TYPE,
|
|
12
|
+
A as Channels,
|
|
13
|
+
O as DeliveryOptions,
|
|
14
|
+
T as Filter,
|
|
15
|
+
r as ImageShape,
|
|
16
|
+
L as NOTIFICATION_ACTIONS,
|
|
17
|
+
N as Pagination,
|
|
18
|
+
t as Position
|
|
19
|
+
};
|