@notificationapi/react 0.0.37 → 1.0.1
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/Badge.js +456 -0
- package/dist/assets/Box.js +57 -0
- package/dist/assets/ButtonBase.js +1224 -0
- package/dist/assets/DefaultPropsProvider.js +4368 -0
- package/dist/assets/Divider.js +343 -0
- package/dist/assets/IconButton.js +225 -0
- package/dist/assets/Inbox.js +3051 -0
- package/dist/assets/InboxHeader.js +2338 -0
- package/dist/assets/Notification.js +5349 -7150
- package/dist/assets/NotificationPreferencesPopup.js +1694 -0
- package/dist/assets/Paper.js +154 -0
- package/dist/assets/Popover.js +451 -0
- package/dist/assets/Portal.js +110 -0
- package/dist/assets/PreferenceInput.js +1545 -1366
- package/dist/assets/Typography.js +292 -0
- package/dist/assets/WebPushOptInMessage.js +794 -407
- package/dist/assets/channelUtils.js +33 -65
- package/dist/assets/createSimplePaletteValueFilter.js +17 -0
- package/dist/assets/createSvgIcon.js +248 -0
- package/dist/assets/integerPropType.js +31 -0
- package/dist/assets/resolveComponentProps.js +93 -0
- package/dist/assets/style.css +1 -0
- package/dist/assets/useSlotProps.js +24 -0
- package/dist/assets/useTheme.js +10 -0
- package/dist/assets/useTheme2.js +16 -0
- package/dist/assets/utils.js +743 -0
- package/dist/components/Notifications/DefaultEmpty.d.ts +3 -0
- package/dist/components/Notifications/DefaultEmpty.js +7 -0
- package/dist/components/Notifications/Inbox.d.ts +4 -4
- package/dist/components/Notifications/Inbox.js +9 -6450
- package/dist/components/Notifications/InboxHeader.d.ts +1 -1
- package/dist/components/Notifications/InboxHeader.js +7 -53
- package/dist/components/Notifications/Notification.d.ts +3 -4
- package/dist/components/Notifications/Notification.js +6 -5
- package/dist/components/Notifications/NotificationCounter.js +16 -6
- package/dist/components/Notifications/NotificationFeed.d.ts +1 -2
- package/dist/components/Notifications/NotificationFeed.js +41 -38
- package/dist/components/Notifications/NotificationLauncher.d.ts +1 -0
- package/dist/components/Notifications/NotificationLauncher.js +100 -114
- package/dist/components/Notifications/NotificationPopup.d.ts +3 -4
- package/dist/components/Notifications/NotificationPopup.js +86 -88
- package/dist/components/Notifications/UnreadBadge.d.ts +7 -4
- package/dist/components/Notifications/UnreadBadge.js +28 -20
- package/dist/components/Notifications/interface.d.ts +0 -4
- package/dist/components/Notifications/interface.js +4 -5
- package/dist/components/Preferences/NotificationPreferencesInline.js +14 -14
- package/dist/components/Preferences/NotificationPreferencesPopup.js +7 -2068
- package/dist/components/Preferences/PreferenceInput.js +4 -3
- package/dist/components/Preferences/Preferences.js +1042 -547
- package/dist/components/Preferences/channelUtils.js +3 -4
- package/dist/components/Preferences/index.js +1 -1
- package/dist/components/Provider/context.d.ts +27 -0
- package/dist/components/Provider/context.js +7 -0
- package/dist/components/Provider/index.d.ts +2 -25
- package/dist/components/Provider/index.js +22 -24
- package/dist/components/WebPush/WebPushOptInMessage.js +3 -4
- package/dist/main.d.ts +1 -0
- package/dist/main.js +4 -4
- package/package.json +14 -12
- package/dist/assets/AntdIcon.js +0 -200
- package/dist/assets/CloseOutlined.js +0 -13
- package/dist/assets/PurePanel.js +0 -59
- package/dist/assets/RightOutlined.js +0 -13
- package/dist/assets/button.js +0 -1660
- package/dist/assets/colors.js +0 -36
- package/dist/assets/compact-item.js +0 -860
- package/dist/assets/index.js +0 -271
- package/dist/assets/index2.js +0 -647
- package/dist/assets/index3.js +0 -7527
- package/dist/assets/pickAttrs.js +0 -42
- package/dist/assets/presets.js +0 -810
- package/dist/assets/reactNode.js +0 -20821
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { D as P } from "../../assets/PreferenceInput.js";
|
|
8
|
-
import { W as S } from "../../assets/WebPushOptInMessage.js";
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useContext as I } from "react";
|
|
3
|
+
import { I as P } from "../../assets/Inbox.js";
|
|
4
|
+
import { UnreadBadge as b } from "./UnreadBadge.js";
|
|
5
|
+
import { NotificationAPIContext as C } from "../Provider/context.js";
|
|
6
|
+
import { N as S } from "../../assets/NotificationPreferencesPopup.js";
|
|
9
7
|
import { Filter as x } from "./interface.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
import { W as N } from "../../assets/WebPushOptInMessage.js";
|
|
9
|
+
import { N as O } from "../../assets/channelUtils.js";
|
|
10
|
+
import { I as y } from "../../assets/IconButton.js";
|
|
11
|
+
import { P as k } from "../../assets/Popover.js";
|
|
12
|
+
import { D as z } from "../../assets/Divider.js";
|
|
13
|
+
const R = (e) => {
|
|
14
|
+
var d, c, u, s;
|
|
15
|
+
const [f, a] = p(!1), [i, l] = p(null), o = I(C);
|
|
16
|
+
if (!o)
|
|
17
17
|
return null;
|
|
18
18
|
const t = {
|
|
19
|
-
buttonIcon: e.buttonIcon || /* @__PURE__ */
|
|
20
|
-
|
|
19
|
+
buttonIcon: e.buttonIcon || /* @__PURE__ */ n(
|
|
20
|
+
O,
|
|
21
21
|
{
|
|
22
22
|
style: {
|
|
23
|
-
fontSize: e.buttonIconSize ||
|
|
23
|
+
fontSize: e.buttonIconSize || 20,
|
|
24
24
|
color: e.iconColor || "#000000"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
),
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
buttonStyles: {
|
|
29
|
+
width: 40,
|
|
30
|
+
height: 40,
|
|
31
|
+
...e.buttonStyles
|
|
32
|
+
},
|
|
30
33
|
popupWidth: e.popupWidth || 400,
|
|
31
34
|
popupHeight: e.popupHeight || 600,
|
|
32
|
-
buttonIconSize: e.buttonIconSize ||
|
|
33
|
-
imageShape: e.imageShape || "circle",
|
|
35
|
+
buttonIconSize: e.buttonIconSize || 20,
|
|
34
36
|
iconColor: e.iconColor || "#000000",
|
|
35
37
|
pagination: e.pagination || "INFINITE_SCROLL",
|
|
36
38
|
pageSize: e.pageSize || 10,
|
|
@@ -40,91 +42,87 @@ const T = (e) => {
|
|
|
40
42
|
count: e.count || "COUNT_UNOPENED_NOTIFICATIONS",
|
|
41
43
|
filter: e.filter || x.ALL,
|
|
42
44
|
header: {
|
|
43
|
-
title: (
|
|
44
|
-
button1ClickHandler: ((
|
|
45
|
-
button2ClickHandler: ((
|
|
45
|
+
title: (d = e.header) == null ? void 0 : d.title,
|
|
46
|
+
button1ClickHandler: ((c = e.header) == null ? void 0 : c.button1ClickHandler) ?? o.markAsArchived,
|
|
47
|
+
button2ClickHandler: ((u = e.header) == null ? void 0 : u.button2ClickHandler) ?? (() => a(!0))
|
|
46
48
|
},
|
|
47
49
|
renderers: {
|
|
48
|
-
notification: (
|
|
50
|
+
notification: (s = e.renderers) == null ? void 0 : s.notification
|
|
49
51
|
}
|
|
52
|
+
}, h = (g) => {
|
|
53
|
+
l(g.currentTarget), o.markAsOpened();
|
|
50
54
|
};
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
55
|
+
return /* @__PURE__ */ r(m, { children: [
|
|
56
|
+
/* @__PURE__ */ n(
|
|
57
|
+
"div",
|
|
54
58
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
content: /* @__PURE__ */ o(l, { children: [
|
|
58
|
-
/* @__PURE__ */ i(
|
|
59
|
-
f,
|
|
60
|
-
{
|
|
61
|
-
maxHeight: t.popupHeight - 73,
|
|
62
|
-
pagination: t.pagination,
|
|
63
|
-
filter: t.filter,
|
|
64
|
-
imageShape: t.imageShape,
|
|
65
|
-
pageSize: t.pageSize,
|
|
66
|
-
pagePosition: t.pagePosition,
|
|
67
|
-
notificationRenderer: t.renderers.notification,
|
|
68
|
-
header: t.header
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
n.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ o("div", { children: [
|
|
72
|
-
/* @__PURE__ */ i(P, { style: { margin: "10px 0" } }),
|
|
73
|
-
/* @__PURE__ */ i(S, { hideAfterInteraction: !0 })
|
|
74
|
-
] })
|
|
75
|
-
] }),
|
|
76
|
-
onOpenChange: (g) => {
|
|
77
|
-
g && n.markAsOpened();
|
|
59
|
+
style: {
|
|
60
|
+
display: "inline-block"
|
|
78
61
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
children: /* @__PURE__ */ n(
|
|
63
|
+
b,
|
|
64
|
+
{
|
|
65
|
+
...e.unreadBadgeProps,
|
|
66
|
+
count: t.count,
|
|
67
|
+
filter: t.filter,
|
|
68
|
+
children: /* @__PURE__ */ n(y, { onClick: h, style: t.buttonStyles, children: t.buttonIcon })
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ n(
|
|
74
|
+
k,
|
|
75
|
+
{
|
|
76
|
+
open: !!i,
|
|
77
|
+
onClose: () => l(null),
|
|
78
|
+
anchorEl: i,
|
|
79
|
+
slotProps: {
|
|
80
|
+
paper: {
|
|
81
|
+
style: {
|
|
82
|
+
borderRadius: 8
|
|
83
|
+
}
|
|
84
|
+
}
|
|
83
85
|
},
|
|
84
|
-
|
|
85
|
-
children: /* @__PURE__ */
|
|
86
|
+
"aria-hidden": !i,
|
|
87
|
+
children: /* @__PURE__ */ r(
|
|
86
88
|
"div",
|
|
87
89
|
{
|
|
88
90
|
style: {
|
|
89
|
-
|
|
91
|
+
width: t.popupWidth,
|
|
92
|
+
padding: "0 16px",
|
|
93
|
+
zIndex: e.popupZIndex
|
|
90
94
|
},
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
shape: "circle",
|
|
110
|
-
type: "text"
|
|
111
|
-
}
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
)
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ n(
|
|
97
|
+
P,
|
|
98
|
+
{
|
|
99
|
+
maxHeight: t.popupHeight - 73,
|
|
100
|
+
pagination: t.pagination,
|
|
101
|
+
filter: t.filter,
|
|
102
|
+
pageSize: t.pageSize,
|
|
103
|
+
pagePosition: t.pagePosition,
|
|
104
|
+
notificationRenderer: t.renderers.notification,
|
|
105
|
+
header: t.header
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
o.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ r("div", { children: [
|
|
109
|
+
/* @__PURE__ */ n(z, { style: { margin: "10px 0" } }),
|
|
110
|
+
/* @__PURE__ */ n(N, { hideAfterInteraction: !0 })
|
|
111
|
+
] })
|
|
112
|
+
]
|
|
115
113
|
}
|
|
116
114
|
)
|
|
117
115
|
}
|
|
118
116
|
),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
117
|
+
/* @__PURE__ */ n(
|
|
118
|
+
S,
|
|
121
119
|
{
|
|
122
|
-
open:
|
|
123
|
-
onClose: () =>
|
|
120
|
+
open: f,
|
|
121
|
+
onClose: () => a(!1)
|
|
124
122
|
}
|
|
125
123
|
)
|
|
126
124
|
] });
|
|
127
125
|
};
|
|
128
126
|
export {
|
|
129
|
-
|
|
127
|
+
R as NotificationPopup
|
|
130
128
|
};
|
|
@@ -4,13 +4,16 @@ import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
|
4
4
|
import { COUNT_TYPE } from './interface';
|
|
5
5
|
|
|
6
6
|
export type UnreadBadgeProps = {
|
|
7
|
-
color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold' | undefined;
|
|
8
|
-
overflowCount?: number;
|
|
9
7
|
dot?: boolean;
|
|
10
8
|
showZero?: boolean;
|
|
11
|
-
|
|
12
|
-
style?: React.CSSProperties;
|
|
9
|
+
max?: number;
|
|
13
10
|
count?: keyof typeof COUNT_TYPE | ((notification: InAppNotification) => boolean);
|
|
14
11
|
filter?: NotificationPopupProps['filter'];
|
|
12
|
+
offset?: {
|
|
13
|
+
top?: number;
|
|
14
|
+
right?: number;
|
|
15
|
+
bottom?: number;
|
|
16
|
+
left?: number;
|
|
17
|
+
};
|
|
15
18
|
};
|
|
16
19
|
export declare const UnreadBadge: React.FunctionComponent<PropsWithChildren<UnreadBadgeProps>>;
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { NotificationAPIContext as
|
|
4
|
-
import { B as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as a } from "react";
|
|
3
|
+
import { NotificationAPIContext as d } from "../Provider/context.js";
|
|
4
|
+
import { B as u } from "../../assets/Badge.js";
|
|
5
|
+
const C = (t) => {
|
|
6
|
+
var r, i, c, f;
|
|
7
|
+
const o = a(d);
|
|
8
|
+
return /* @__PURE__ */ l(
|
|
9
|
+
u,
|
|
9
10
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
showZero:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
overlap: "circular",
|
|
12
|
+
badgeContent: ((n) => t.count === "COUNT_UNOPENED_NOTIFICATIONS" || t.count === void 0 ? n.filter((e) => !e.opened && !e.seen).length : t.count === "COUNT_UNARCHIVED_NOTIFICATIONS" ? n.filter(
|
|
13
|
+
(e) => !e.archived && !e.clicked && !e.replies && !e.actioned1 && !e.actioned2
|
|
14
|
+
).length : n.filter(t.count).length)((o == null ? void 0 : o.notifications) || []),
|
|
15
|
+
max: t.max,
|
|
16
|
+
variant: t.dot ? "dot" : "standard",
|
|
17
|
+
showZero: t.showZero,
|
|
18
|
+
color: "error",
|
|
19
|
+
slotProps: {
|
|
20
|
+
badge: {
|
|
21
|
+
style: {
|
|
22
|
+
top: (r = t.offset) == null ? void 0 : r.top,
|
|
23
|
+
right: (i = t.offset) == null ? void 0 : i.right,
|
|
24
|
+
bottom: (c = t.offset) == null ? void 0 : c.bottom,
|
|
25
|
+
left: (f = t.offset) == null ? void 0 : f.left
|
|
26
|
+
}
|
|
27
|
+
}
|
|
20
28
|
},
|
|
21
|
-
children:
|
|
29
|
+
children: t.children
|
|
22
30
|
}
|
|
23
31
|
);
|
|
24
32
|
};
|
|
25
33
|
export {
|
|
26
|
-
|
|
34
|
+
C as UnreadBadge
|
|
27
35
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var N = /* @__PURE__ */ ((I) => (I.INFINITE_SCROLL = "infinite_scroll", I.PAGINATED = "paginated", I))(N || {}),
|
|
1
|
+
var N = /* @__PURE__ */ ((I) => (I.INFINITE_SCROLL = "infinite_scroll", I.PAGINATED = "paginated", I))(N || {}), 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 || {}), r = /* @__PURE__ */ ((I) => (I.OFF = "off", I.INSTANT = "instant", I.HOURLY = "hourly", I.DAILY = "daily", I.WEEKLY = "weekly", I.MONTHLY = "monthly", I))(r || {}), O = /* @__PURE__ */ ((I) => (I.COUNT_UNOPENED_NOTIFICATIONS = "COUNT_UNOPENED_NOTIFICATIONS", I.COUNT_UNARCHIVED_NOTIFICATIONS = "COUNT_UNARCHIVED_NOTIFICATIONS", I))(O || {}), E = /* @__PURE__ */ ((I) => (I.TOP_LEFT = "top-left", I.TOP_RIGHT = "top-right", I.BOTTOM_LEFT = "bottom-left", I.BOTTOM_RIGHT = "bottom-right", I))(E || {});
|
|
2
2
|
const L = {
|
|
3
3
|
opened: "opened",
|
|
4
4
|
clicked: "clicked",
|
|
@@ -8,12 +8,11 @@ const L = {
|
|
|
8
8
|
actioned2: "actioned2"
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
O as COUNT_TYPE,
|
|
12
12
|
A as Channels,
|
|
13
|
-
|
|
13
|
+
r as DeliveryOptions,
|
|
14
14
|
T as Filter,
|
|
15
|
-
r as ImageShape,
|
|
16
15
|
L as NOTIFICATION_ACTIONS,
|
|
17
16
|
N as Pagination,
|
|
18
|
-
|
|
17
|
+
E as Position
|
|
19
18
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { D as
|
|
7
|
-
function
|
|
8
|
-
const e =
|
|
9
|
-
return e ? /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */ t(
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as i } from "react";
|
|
3
|
+
import { Preferences as n } from "./Preferences.js";
|
|
4
|
+
import { NotificationAPIContext as o } from "../Provider/context.js";
|
|
5
|
+
import { W as s } from "../../assets/WebPushOptInMessage.js";
|
|
6
|
+
import { D as f } from "../../assets/Divider.js";
|
|
7
|
+
function u(l) {
|
|
8
|
+
const e = i(o);
|
|
9
|
+
return e ? /* @__PURE__ */ r("div", { style: { borderRadius: 8, border: "1px solid #dcdcdc" }, children: [
|
|
10
|
+
/* @__PURE__ */ t(n, {}),
|
|
11
11
|
" ",
|
|
12
|
-
e.webPushOptInMessage && /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */ t(
|
|
12
|
+
e.webPushOptInMessage && /* @__PURE__ */ r("div", { children: [
|
|
13
|
+
/* @__PURE__ */ t(f, { style: { margin: "10px 0" } }),
|
|
14
14
|
/* @__PURE__ */ t(
|
|
15
|
-
|
|
15
|
+
s,
|
|
16
16
|
{
|
|
17
17
|
hideAfterInteraction: !1,
|
|
18
18
|
descriptionStyle: {
|
|
@@ -38,5 +38,5 @@ function I(m) {
|
|
|
38
38
|
] }) : null;
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
u as NotificationPreferencesInline
|
|
42
42
|
};
|