@edusight/notification-widget 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.
Files changed (35) hide show
  1. package/README.md +74 -0
  2. package/dist/components/EmptyState.d.ts +7 -0
  3. package/dist/components/EmptyState.d.ts.map +1 -0
  4. package/dist/components/NotificationBell.d.ts +8 -0
  5. package/dist/components/NotificationBell.d.ts.map +1 -0
  6. package/dist/components/NotificationCenter.d.ts +18 -0
  7. package/dist/components/NotificationCenter.d.ts.map +1 -0
  8. package/dist/components/NotificationGroup.d.ts +13 -0
  9. package/dist/components/NotificationGroup.d.ts.map +1 -0
  10. package/dist/components/NotificationItem.d.ts +10 -0
  11. package/dist/components/NotificationItem.d.ts.map +1 -0
  12. package/dist/components/NotificationList.d.ts +16 -0
  13. package/dist/components/NotificationList.d.ts.map +1 -0
  14. package/dist/components/Preferences.d.ts +10 -0
  15. package/dist/components/Preferences.d.ts.map +1 -0
  16. package/dist/hooks/useNotificationCenter.d.ts +22 -0
  17. package/dist/hooks/useNotificationCenter.d.ts.map +1 -0
  18. package/dist/hooks/useNotifications.d.ts +21 -0
  19. package/dist/hooks/useNotifications.d.ts.map +1 -0
  20. package/dist/hooks/useWebSocket.d.ts +20 -0
  21. package/dist/hooks/useWebSocket.d.ts.map +1 -0
  22. package/dist/index.cjs.js +48 -0
  23. package/dist/index.cjs.js.map +1 -0
  24. package/dist/index.d.ts +19 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.esm.js +5038 -0
  27. package/dist/index.esm.js.map +1 -0
  28. package/dist/interfaces/notification-client.interface.d.ts +3 -0
  29. package/dist/interfaces/notification-client.interface.d.ts.map +1 -0
  30. package/dist/notification-widget.css +1 -0
  31. package/dist/services/websocket-service.d.ts +35 -0
  32. package/dist/services/websocket-service.d.ts.map +1 -0
  33. package/dist/theme/notification-theme.d.ts +3 -0
  34. package/dist/theme/notification-theme.d.ts.map +1 -0
  35. package/package.json +100 -0
@@ -0,0 +1,3 @@
1
+ import { NotificationClient } from '@edusight/notification-sdk';
2
+ export type INotificationClient = NotificationClient;
3
+ //# sourceMappingURL=notification-client.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-client.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/notification-client.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.relative{position:relative}.m-4{margin:1rem}.mr-2{margin-right:.5rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-2{height:.5rem}.h-5{height:1.25rem}.max-h-96{max-height:24rem}.w-2{width:.5rem}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.p-8{padding:2rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{--notification-primary: #1E3A8A;--notification-secondary: rgba(30, 58, 138, .75);--notification-background: #ffffff;--notification-surface: #f5f5f5;--notification-text: #333333;--notification-border: #E9EAEB}.notification-center{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}
@@ -0,0 +1,35 @@
1
+ import { Notification, NotificationClient, NotificationSocketAckEvent } from '@edusight/notification-sdk';
2
+ export interface WebSocketConfig {
3
+ client: NotificationClient;
4
+ tenantId: string;
5
+ subscriberId: string;
6
+ environmentId: string;
7
+ autoAck?: boolean;
8
+ transports?: Array<'websocket' | 'polling'>;
9
+ namespace?: string;
10
+ reconnectionDelay?: number;
11
+ reconnectionDelayMax?: number;
12
+ }
13
+ export interface WebSocketEvents {
14
+ connect: () => void;
15
+ disconnect: (reason: string) => void;
16
+ notification: (notification: Notification) => void;
17
+ ack: (acknowledgement: NotificationSocketAckEvent) => void;
18
+ error: (error: Error) => void;
19
+ }
20
+ export declare class WebSocketService {
21
+ private readonly socketClient;
22
+ private readonly listeners;
23
+ private readonly context;
24
+ private readonly config;
25
+ constructor(config: WebSocketConfig);
26
+ connect(): void;
27
+ disconnect(): void;
28
+ ackNotification(notificationId: string): void;
29
+ isConnected(): boolean;
30
+ on<K extends keyof WebSocketEvents>(event: K, handler: WebSocketEvents[K]): void;
31
+ off<K extends keyof WebSocketEvents>(event: K, handler: WebSocketEvents[K]): void;
32
+ private emit;
33
+ private normalizeNotification;
34
+ }
35
+ //# sourceMappingURL=websocket-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-service.d.ts","sourceRoot":"","sources":["../../src/services/websocket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAEZ,kBAAkB,EAClB,0BAA0B,EAO3B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,GAAG,EAAE,CAAC,eAAe,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAC3D,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC/B;AAqBD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IACxD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmD;IAC7E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;gBAE7B,MAAM,EAAE,eAAe;IA6CnC,OAAO,IAAI,IAAI;IAIf,UAAU,IAAI,IAAI;IAIlB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAQ7C,WAAW,IAAI,OAAO;IAItB,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;IAOhF,GAAG,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;IAIjF,OAAO,CAAC,IAAI;IAiBZ,OAAO,CAAC,qBAAqB;CAsC9B"}
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ export declare const notificationTheme: Theme;
3
+ //# sourceMappingURL=notification-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-theme.d.ts","sourceRoot":"","sources":["../../src/theme/notification-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,iBAAiB,EAAE,KAuD9B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@edusight/notification-widget",
3
+ "version": "1.0.1",
4
+ "type": "module",
5
+ "description": "React notification center widget with Material UI and Tailwind CSS for EduSight Notification Service",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.esm.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./styles": "./dist/styles.css",
16
+ "./theme": "./dist/theme/index.js"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE",
22
+ "CHANGELOG.md"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/EduSight-ai/EduSight-Notification-Widget.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/EduSight-ai/EduSight-Notification-Widget.git/issues"
30
+ },
31
+ "homepage": "https://github.com/EduSight-ai/EduSight-Notification-Widget#readme",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "build": "vite build",
37
+ "build:watch": "vite build --watch",
38
+ "test": "jest",
39
+ "test:watch": "jest --watch",
40
+ "test:coverage": "jest --coverage",
41
+ "lint": "eslint src --ext .ts,.tsx",
42
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
43
+ "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
44
+ "type-check": "tsc --noEmit",
45
+ "prepublishOnly": "npm run build && npm run test && npm run type-check"
46
+ },
47
+ "keywords": [
48
+ "edusight",
49
+ "notifications",
50
+ "widget",
51
+ "react",
52
+ "material-ui",
53
+ "tailwind"
54
+ ],
55
+ "author": "EduSight",
56
+ "license": "MIT",
57
+ "dependencies": {
58
+ "@edusight/notification-sdk": "file:../Edusight-Notification-SDK",
59
+ "@emotion/react": "^11.14.0",
60
+ "@emotion/styled": "^11.14.1",
61
+ "@mui/icons-material": "^6.1.8",
62
+ "@mui/material": "^6.5.0",
63
+ "socket.io-client": "^4.8.1",
64
+ "date-fns": "^2.30.0"
65
+ },
66
+ "peerDependencies": {
67
+ "react": "^18.2.0",
68
+ "react-dom": "^18.2.0"
69
+ },
70
+ "devDependencies": {
71
+ "@testing-library/jest-dom": "^6.9.1",
72
+ "@testing-library/react": "^16.3.0",
73
+ "@testing-library/user-event": "^14.6.1",
74
+ "@types/node": "^20.17.6",
75
+ "@types/react": "^18.2.17",
76
+ "@types/react-dom": "^18.2.7",
77
+ "@typescript-eslint/eslint-plugin": "^8.18.2",
78
+ "@typescript-eslint/parser": "^8.18.2",
79
+ "@vitejs/plugin-react": "^4.0.3",
80
+ "autoprefixer": "^10.4.14",
81
+ "eslint": "^9.18.0",
82
+ "eslint-config-prettier": "^9.1.0",
83
+ "eslint-plugin-import": "^2.31.0",
84
+ "eslint-plugin-prettier": "^5.2.1",
85
+ "eslint-plugin-react": "^7.37.2",
86
+ "eslint-plugin-react-hooks": "^5.1.0",
87
+ "jest": "^29.7.0",
88
+ "jest-environment-jsdom": "^29.7.0",
89
+ "postcss": "^8.4.27",
90
+ "prettier": "^3.4.2",
91
+ "tailwindcss": "^3.4.1",
92
+ "ts-jest": "^29.2.5",
93
+ "typescript": "^5.7.2",
94
+ "vite": "^7.1.12",
95
+ "vite-plugin-dts": "^4.3.0"
96
+ },
97
+ "engines": {
98
+ "node": ">=18.0.0"
99
+ }
100
+ }