@notificationapi/react 1.1.4 → 1.3.0
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 +19 -1
- package/dist/assets/PreferenceInput.js +46 -38
- package/dist/assets/channelUtils.js +24 -21
- package/dist/assets/createSvgIcon.js +10 -9
- package/dist/components/Notifications/interface.d.ts +2 -1
- package/dist/components/Notifications/interface.js +4 -4
- package/dist/components/Preferences/channelUtils.js +4 -3
- package/dist/components/Provider/index.d.ts +1 -0
- package/dist/components/Provider/index.js +447 -243
- package/dist/main.d.ts +1 -0
- package/dist/main.js +8 -6
- package/dist/utils/debug.d.ts +26 -0
- package/dist/utils/debug.js +61 -0
- package/package.json +7 -3
package/dist/main.d.ts
CHANGED
|
@@ -2,3 +2,4 @@
|
|
|
2
2
|
export { NotificationFeed, NotificationPopup, NotificationLauncher, NotificationCounter } from './components/Notifications';
|
|
3
3
|
export { NotificationPreferencesInline, NotificationPreferencesPopup } from './components/Preferences';
|
|
4
4
|
export { NotificationAPIProvider } from './components/Provider';
|
|
5
|
+
export { createDebugLogger, type DebugLogger } from './utils/debug';
|
package/dist/main.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { NotificationFeed as r } from "./components/Notifications/NotificationFeed.js";
|
|
2
|
-
import { NotificationPopup as
|
|
2
|
+
import { NotificationPopup as i } from "./components/Notifications/NotificationPopup.js";
|
|
3
3
|
import { NotificationLauncher as n } from "./components/Notifications/NotificationLauncher.js";
|
|
4
4
|
import { NotificationCounter as c } from "./components/Notifications/NotificationCounter.js";
|
|
5
|
-
import { N } from "./assets/NotificationPreferencesPopup.js";
|
|
6
|
-
import { NotificationPreferencesInline as
|
|
5
|
+
import { N as m } from "./assets/NotificationPreferencesPopup.js";
|
|
6
|
+
import { NotificationPreferencesInline as N } from "./components/Preferences/NotificationPreferencesInline.js";
|
|
7
7
|
import { NotificationAPIProvider as u } from "./components/Provider/index.js";
|
|
8
|
+
import { createDebugLogger as s } from "./utils/debug.js";
|
|
8
9
|
export {
|
|
9
10
|
u as NotificationAPIProvider,
|
|
10
11
|
c as NotificationCounter,
|
|
11
12
|
r as NotificationFeed,
|
|
12
13
|
n as NotificationLauncher,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
i as NotificationPopup,
|
|
15
|
+
N as NotificationPreferencesInline,
|
|
16
|
+
m as NotificationPreferencesPopup,
|
|
17
|
+
s as createDebugLogger
|
|
16
18
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface DebugLogger {
|
|
2
|
+
log: (message: string, data?: unknown) => void;
|
|
3
|
+
warn: (message: string, data?: unknown) => void;
|
|
4
|
+
error: (message: string, error?: Error | unknown, context?: Record<string, unknown>) => void;
|
|
5
|
+
group: (label: string) => void;
|
|
6
|
+
groupEnd: () => void;
|
|
7
|
+
table: (data: Record<string, unknown> | unknown[]) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const createDebugLogger: (enabled: boolean) => DebugLogger;
|
|
10
|
+
export declare const formatApiCall: (method: string, endpoint: string, params?: Record<string, unknown>) => {
|
|
11
|
+
method: string;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
params: Record<string, unknown> | undefined;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const formatWebSocketEvent: (event: string, data?: unknown) => {
|
|
17
|
+
event: string;
|
|
18
|
+
data: unknown;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const formatStateChange: (stateName: string, oldValue: unknown, newValue: unknown) => {
|
|
22
|
+
stateName: string;
|
|
23
|
+
oldValue: unknown;
|
|
24
|
+
newValue: unknown;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var a = (t, o, e) => o in t ? s(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e;
|
|
3
|
+
var n = (t, o, e) => a(t, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
class c {
|
|
5
|
+
log() {
|
|
6
|
+
}
|
|
7
|
+
warn() {
|
|
8
|
+
}
|
|
9
|
+
error() {
|
|
10
|
+
}
|
|
11
|
+
group() {
|
|
12
|
+
}
|
|
13
|
+
groupEnd() {
|
|
14
|
+
}
|
|
15
|
+
table() {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class g {
|
|
19
|
+
constructor() {
|
|
20
|
+
n(this, "prefix", "[NotificationAPI Debug]");
|
|
21
|
+
}
|
|
22
|
+
log(o, e) {
|
|
23
|
+
console.log(`${this.prefix} ${o}`, e || "");
|
|
24
|
+
}
|
|
25
|
+
warn(o, e) {
|
|
26
|
+
console.warn(`${this.prefix} ${o}`, e || "");
|
|
27
|
+
}
|
|
28
|
+
error(o, e, r) {
|
|
29
|
+
console.group(`${this.prefix} ERROR: ${o}`), e && console.error("Error:", e), r && console.error("Context:", r), e instanceof Error && e.stack && console.error("Stack trace:", e.stack), console.groupEnd();
|
|
30
|
+
}
|
|
31
|
+
group(o) {
|
|
32
|
+
console.group(`${this.prefix} ${o}`);
|
|
33
|
+
}
|
|
34
|
+
groupEnd() {
|
|
35
|
+
console.groupEnd();
|
|
36
|
+
}
|
|
37
|
+
table(o) {
|
|
38
|
+
console.table(o);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const l = (t) => t ? new g() : new c(), p = (t, o, e) => ({
|
|
42
|
+
method: t,
|
|
43
|
+
endpoint: o,
|
|
44
|
+
params: e,
|
|
45
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
46
|
+
}), u = (t, o) => ({
|
|
47
|
+
event: t,
|
|
48
|
+
data: o,
|
|
49
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
50
|
+
}), f = (t, o, e) => ({
|
|
51
|
+
stateName: t,
|
|
52
|
+
oldValue: o,
|
|
53
|
+
newValue: e,
|
|
54
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
l as createDebugLogger,
|
|
58
|
+
p as formatApiCall,
|
|
59
|
+
f as formatStateChange,
|
|
60
|
+
u as formatWebSocketEvent
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notificationapi/react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"overrides": {
|
|
7
7
|
"esbuild": "^0.25.0",
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
"format": "prettier --write \"{src,lib}/**/*.{ts,tsx,js,jsx,json,css,md,html}\"",
|
|
26
26
|
"prettier-check": "prettier --check \"{src,lib}/**/*.{ts,tsx,js,jsx,json,css,md,html}\"",
|
|
27
27
|
"preview": "vite preview",
|
|
28
|
-
"prepublishOnly": "npm run build"
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"test:e2e": "playwright test",
|
|
30
|
+
"test:e2e:ui": "playwright test --ui",
|
|
31
|
+
"test:e2e:headed": "playwright test --headed"
|
|
29
32
|
},
|
|
30
33
|
"peerDependencies": {
|
|
31
34
|
"react": "^17.0.2 || ^18.0.0 || ^19.0.0",
|
|
@@ -45,6 +48,7 @@
|
|
|
45
48
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
46
49
|
"faker-js": "^1.0.0",
|
|
47
50
|
"glob": "^10.4.1",
|
|
51
|
+
"@playwright/test": "^1.48.0",
|
|
48
52
|
"prettier": "^3.3.3",
|
|
49
53
|
"typescript": "^5.2.2",
|
|
50
54
|
"vite": "^5.4.18",
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
"@fontsource/roboto": "^5.1.1",
|
|
64
68
|
"@mui/icons-material": "^6.3.1",
|
|
65
69
|
"@mui/material": "^6.3.1",
|
|
66
|
-
"@notificationapi/core": "^0.0.
|
|
70
|
+
"@notificationapi/core": "^0.0.16",
|
|
67
71
|
"javascript-time-ago": "^2.5.10",
|
|
68
72
|
"liquidjs": "^10.14.0",
|
|
69
73
|
"rc-virtual-list": "^3.11.5",
|