@notificationapi/react 0.0.27 → 0.0.28
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 +99 -3
- package/dist/components/Notifications/Inbox.js +1 -1
- package/dist/components/Notifications/NotificationLauncher.js +17 -15
- package/dist/components/Notifications/NotificationPopup.d.ts +1 -0
- package/dist/components/Notifications/NotificationPopup.js +14 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
[](https://notificationapi.com)
|
|
2
|
+
|
|
3
|
+
The React SDK is mainly used for displaying In-App Notifications and allowing users to see and change their Notification Preferences.
|
|
4
|
+
|
|
5
|
+
# Docs
|
|
6
|
+
|
|
7
|
+
Please refer to our [documentations](https://docs.notificationapi.com).
|
|
8
|
+
|
|
9
|
+
# Development
|
|
10
|
+
|
|
11
|
+
1. Install dependencies:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. Run the example application:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm run dev
|
|
21
|
+
```
|
|
22
|
+
|
|
1
23
|
# React + TypeScript + Vite
|
|
2
24
|
|
|
3
25
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
@@ -20,11 +42,85 @@ export default {
|
|
|
20
42
|
ecmaVersion: 'latest',
|
|
21
43
|
sourceType: 'module',
|
|
22
44
|
project: ['./tsconfig.json', './tsconfig.node.json'],
|
|
23
|
-
tsconfigRootDir: __dirname
|
|
24
|
-
}
|
|
25
|
-
}
|
|
45
|
+
tsconfigRootDir: __dirname
|
|
46
|
+
}
|
|
47
|
+
};
|
|
26
48
|
```
|
|
27
49
|
|
|
28
50
|
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
|
29
51
|
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
|
30
52
|
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
|
|
53
|
+
|
|
54
|
+
## Contributing
|
|
55
|
+
|
|
56
|
+
We welcome contributions! To ensure smooth collaboration, please follow these steps:
|
|
57
|
+
|
|
58
|
+
1. **Clone the Repository**
|
|
59
|
+
|
|
60
|
+
- Fork the repository to your GitHub account.
|
|
61
|
+
- Clone it to your local machine:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/your-username/repo-name.git
|
|
65
|
+
cd repo-name
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. **Create a Branch**
|
|
69
|
+
|
|
70
|
+
- Create a new branch for your changes:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git checkout -b your-branch-name
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. **Make Your Changes**
|
|
77
|
+
|
|
78
|
+
- Make your changes in the relevant files.
|
|
79
|
+
- Thoroughly test your changes to ensure they work as expected.
|
|
80
|
+
|
|
81
|
+
4. **Versioning**
|
|
82
|
+
|
|
83
|
+
- Before committing your changes, update the package version by running:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm version <type>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **Versioning Types:**
|
|
90
|
+
|
|
91
|
+
- **major**: For breaking changes or large-scale features.
|
|
92
|
+
- **minor**: For adding functionality in a backwards-compatible manner.
|
|
93
|
+
- **patch**: For backwards-compatible bug fixes or small improvements.
|
|
94
|
+
|
|
95
|
+
- For example, to update a patch version:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm version patch
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
5. **Commit and Push**
|
|
102
|
+
|
|
103
|
+
- Once you’ve made and tested your changes, commit them with a meaningful message:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git add .
|
|
107
|
+
git commit -m "Describe your changes"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- Push your branch to GitHub:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git push origin your-branch-name
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
6. **Submit a Pull Request**
|
|
117
|
+
|
|
118
|
+
- Create a pull request (PR) on GitHub.
|
|
119
|
+
- Provide a clear description of what your changes do.
|
|
120
|
+
- Link any relevant issues.
|
|
121
|
+
|
|
122
|
+
7. **Update Documentation**
|
|
123
|
+
- If your changes affect the documentation, please update it accordingly.
|
|
124
|
+
- You can find the documentation repository here: [NotificationAPI Docs](https://github.com/notificationapi-com/docs).
|
|
125
|
+
|
|
126
|
+
Thank you for contributing!
|
|
@@ -6185,7 +6185,7 @@ const us = (e) => {
|
|
|
6185
6185
|
data: s,
|
|
6186
6186
|
height: e.maxHeight,
|
|
6187
6187
|
itemHeight: 47,
|
|
6188
|
-
itemKey:
|
|
6188
|
+
itemKey: (u) => u[0].id,
|
|
6189
6189
|
onScroll: (u) => {
|
|
6190
6190
|
Math.abs(
|
|
6191
6191
|
u.currentTarget.scrollHeight - u.currentTarget.scrollTop - e.maxHeight
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { Inbox as
|
|
1
|
+
import { jsx as i, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { Inbox as h } 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
6
|
import { NotificationPreferencesPopup as I } from "../Preferences/NotificationPreferencesPopup.js";
|
|
7
7
|
import "../Preferences/PreferenceInput.js";
|
|
8
|
-
import { R as
|
|
9
|
-
import { P
|
|
10
|
-
import { B as
|
|
8
|
+
import { R as S } from "../../assets/channelUtils.js";
|
|
9
|
+
import { P } from "../../assets/index.js";
|
|
10
|
+
import { B as C } from "../../assets/button.js";
|
|
11
11
|
const B = (t) => {
|
|
12
|
-
var a, r, d,
|
|
13
|
-
const [
|
|
12
|
+
var a, r, d, c;
|
|
13
|
+
const [u, o] = m(!1), n = b(s);
|
|
14
14
|
if (!n)
|
|
15
15
|
return null;
|
|
16
16
|
const e = {
|
|
17
17
|
buttonIcon: t.buttonIcon || /* @__PURE__ */ i(
|
|
18
|
-
|
|
18
|
+
S,
|
|
19
19
|
{
|
|
20
20
|
style: {
|
|
21
|
-
fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20)
|
|
21
|
+
fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
|
|
22
|
+
color: t.iconColor || "#000000"
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
),
|
|
@@ -28,6 +29,7 @@ const B = (t) => {
|
|
|
28
29
|
popupHeight: t.popupHeight || 600,
|
|
29
30
|
buttonIconSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
|
|
30
31
|
imageShape: t.imageShape || "circle",
|
|
32
|
+
iconColor: t.iconColor || "#000000",
|
|
31
33
|
pagination: t.pagination || "INFINITE_SCROLL",
|
|
32
34
|
pageSize: t.pageSize || 10,
|
|
33
35
|
pagePosition: t.pagePosition || "top",
|
|
@@ -44,10 +46,10 @@ const B = (t) => {
|
|
|
44
46
|
button2ClickHandler: ((d = t.header) == null ? void 0 : d.button2ClickHandler) ?? (() => o(!0))
|
|
45
47
|
},
|
|
46
48
|
renderers: {
|
|
47
|
-
notification: (
|
|
49
|
+
notification: (c = t.renderers) == null ? void 0 : c.notification
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ l(
|
|
51
53
|
"div",
|
|
52
54
|
{
|
|
53
55
|
style: {
|
|
@@ -58,12 +60,12 @@ const B = (t) => {
|
|
|
58
60
|
},
|
|
59
61
|
children: [
|
|
60
62
|
/* @__PURE__ */ i(
|
|
61
|
-
|
|
63
|
+
P,
|
|
62
64
|
{
|
|
63
65
|
autoAdjustOverflow: !0,
|
|
64
66
|
trigger: "click",
|
|
65
67
|
content: /* @__PURE__ */ i(
|
|
66
|
-
|
|
68
|
+
h,
|
|
67
69
|
{
|
|
68
70
|
maxHeight: 500,
|
|
69
71
|
pagination: e.pagination,
|
|
@@ -99,7 +101,7 @@ const B = (t) => {
|
|
|
99
101
|
},
|
|
100
102
|
count: e.count,
|
|
101
103
|
children: /* @__PURE__ */ i(
|
|
102
|
-
|
|
104
|
+
C,
|
|
103
105
|
{
|
|
104
106
|
icon: e.buttonIcon,
|
|
105
107
|
style: {
|
|
@@ -119,7 +121,7 @@ const B = (t) => {
|
|
|
119
121
|
/* @__PURE__ */ i(
|
|
120
122
|
I,
|
|
121
123
|
{
|
|
122
|
-
open:
|
|
124
|
+
open: u,
|
|
123
125
|
onClose: () => o(!1)
|
|
124
126
|
}
|
|
125
127
|
)
|
|
@@ -6,20 +6,21 @@ import { useState as b, useContext as I } from "react";
|
|
|
6
6
|
import { NotificationPreferencesPopup as P } from "../Preferences/NotificationPreferencesPopup.js";
|
|
7
7
|
import "../Preferences/PreferenceInput.js";
|
|
8
8
|
import { Filter as S } from "./interface.js";
|
|
9
|
-
import { R as
|
|
10
|
-
import { P as
|
|
11
|
-
import { B as
|
|
9
|
+
import { R as x } from "../../assets/channelUtils.js";
|
|
10
|
+
import { P as C } from "../../assets/index.js";
|
|
11
|
+
import { B as s } from "../../assets/button.js";
|
|
12
12
|
const F = (t) => {
|
|
13
|
-
var a, r,
|
|
14
|
-
const [
|
|
13
|
+
var a, r, c, d;
|
|
14
|
+
const [u, o] = b(!1), n = I(p);
|
|
15
15
|
if (!n)
|
|
16
16
|
return null;
|
|
17
17
|
const e = {
|
|
18
18
|
buttonIcon: t.buttonIcon || /* @__PURE__ */ i(
|
|
19
|
-
|
|
19
|
+
x,
|
|
20
20
|
{
|
|
21
21
|
style: {
|
|
22
|
-
fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20)
|
|
22
|
+
fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
|
|
23
|
+
color: t.iconColor || "#000000"
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
),
|
|
@@ -29,6 +30,7 @@ const F = (t) => {
|
|
|
29
30
|
popupHeight: t.popupHeight || 600,
|
|
30
31
|
buttonIconSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
|
|
31
32
|
imageShape: t.imageShape || "circle",
|
|
33
|
+
iconColor: t.iconColor || "#000000",
|
|
32
34
|
pagination: t.pagination || "INFINITE_SCROLL",
|
|
33
35
|
pageSize: t.pageSize || 10,
|
|
34
36
|
pagePosition: t.pagePosition || "top",
|
|
@@ -39,15 +41,15 @@ const F = (t) => {
|
|
|
39
41
|
header: {
|
|
40
42
|
title: (a = t.header) == null ? void 0 : a.title,
|
|
41
43
|
button1ClickHandler: ((r = t.header) == null ? void 0 : r.button1ClickHandler) ?? n.markAsArchived,
|
|
42
|
-
button2ClickHandler: ((
|
|
44
|
+
button2ClickHandler: ((c = t.header) == null ? void 0 : c.button2ClickHandler) ?? (() => o(!0))
|
|
43
45
|
},
|
|
44
46
|
renderers: {
|
|
45
|
-
notification: (
|
|
47
|
+
notification: (d = t.renderers) == null ? void 0 : d.notification
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
return /* @__PURE__ */ h(f, { children: [
|
|
49
51
|
/* @__PURE__ */ i(
|
|
50
|
-
|
|
52
|
+
C,
|
|
51
53
|
{
|
|
52
54
|
autoAdjustOverflow: !0,
|
|
53
55
|
trigger: "click",
|
|
@@ -90,7 +92,7 @@ const F = (t) => {
|
|
|
90
92
|
count: e.count,
|
|
91
93
|
filter: e.filter,
|
|
92
94
|
children: /* @__PURE__ */ i(
|
|
93
|
-
|
|
95
|
+
s,
|
|
94
96
|
{
|
|
95
97
|
icon: e.buttonIcon,
|
|
96
98
|
style: {
|
|
@@ -110,7 +112,7 @@ const F = (t) => {
|
|
|
110
112
|
/* @__PURE__ */ i(
|
|
111
113
|
P,
|
|
112
114
|
{
|
|
113
|
-
open:
|
|
115
|
+
open: u,
|
|
114
116
|
onClose: () => o(!1)
|
|
115
117
|
}
|
|
116
118
|
)
|