sevago-sso-fe 1.0.29 → 1.0.31

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.
@@ -1,14 +1,9 @@
1
- import { LoginDto, LogoutDto, RefreshTokenDto, ResetPasswordDto, SubscribeUnsubscribeTopicDto } from '../../apis/auth/auth.interface';
1
+ import { LoginDto, LogoutDto, RefreshTokenDto, ResetPasswordDto } from '../../apis/auth/auth.interface';
2
2
  import { UpdateAccountDto } from '../../apis/user/user.interface';
3
3
  export declare const login: import('@reduxjs/toolkit').AsyncThunk<import('../../apis').ResponseAuth, LoginDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
4
4
  export declare const logout: import('@reduxjs/toolkit').AsyncThunk<import('axios').AxiosResponse<any, any, {}>, LogoutDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
5
5
  export declare const resetPassword: import('@reduxjs/toolkit').AsyncThunk<import('../../apis').ResponseAuth, ResetPasswordDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
6
6
  export declare const refreshToken: import('@reduxjs/toolkit').AsyncThunk<Omit<import('../../apis').ResponseAuth, "user">, RefreshTokenDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
7
- export declare const subscribeTopic: import('@reduxjs/toolkit').AsyncThunk<{
8
- fcmToken: string;
9
- }, SubscribeUnsubscribeTopicDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
10
- export declare const unsubscribeTopic: import('@reduxjs/toolkit').AsyncThunk<import('axios').AxiosResponse<any, any, {}>, SubscribeUnsubscribeTopicDto, import('@reduxjs/toolkit').AsyncThunkConfig>;
11
- export declare const changeNotificationCount: import('@reduxjs/toolkit').AsyncThunk<number, number, import('@reduxjs/toolkit').AsyncThunkConfig>;
12
7
  export declare const changeSidebarCount: import('@reduxjs/toolkit').AsyncThunk<{
13
8
  sidebarPath: string;
14
9
  count: number;
@@ -5,8 +5,6 @@ export interface GlobalAccountState {
5
5
  user: User | null;
6
6
  accessToken: string;
7
7
  refreshToken: string;
8
- fcmToken: string;
9
- notificationCount: number;
10
8
  userUnitPositionId: string;
11
9
  sidebarCountObj: Record<string, number>;
12
10
  current_access?: CURRENT_ACCESS | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sevago-sso-fe",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Sevago SSO Frontend Library - A comprehensive SSO solution with React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -50,7 +50,6 @@
50
50
  "dependencies": {
51
51
  "axios": "^1.12.2",
52
52
  "dayjs": "^1.11.18",
53
- "firebase": "^12.3.0",
54
53
  "formik": "^2.4.6",
55
54
  "framer-motion": "^12.23.22",
56
55
  "socket.io-client": "^4.8.1",
@@ -1,3 +0,0 @@
1
- import { Messaging } from 'firebase/messaging';
2
- declare const messaging: Messaging;
3
- export { messaging };
@@ -1,91 +0,0 @@
1
- importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-app-compat.js');
2
- importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging-compat.js');
3
-
4
- const firebaseConfig = {
5
- apiKey: 'AIzaSyDXrZ73I7V8SPVt3zBgVj5avaMayzgCCoM',
6
- authDomain: 'fir-f1106.firebaseapp.com',
7
- projectId: 'fir-f1106',
8
- storageBucket: 'fir-f1106.firebasestorage.app',
9
- messagingSenderId: '813698704964',
10
- appId: '1:813698704964:web:b122c75c3e48824449fe11',
11
- };
12
-
13
- firebase.initializeApp(firebaseConfig);
14
-
15
- // Push event khi nhận thông báo
16
- self.addEventListener('push', function (event) {
17
- if (!event.data) return;
18
-
19
- const data = event.data.json().data;
20
-
21
- const title = data.title;
22
- const body = data.message;
23
- const icon = '/images/logo-192x192.png';
24
-
25
- event.waitUntil(
26
- (async () => {
27
- const allClients = await self.clients.matchAll({
28
- type: 'window',
29
- includeUncontrolled: true,
30
- });
31
-
32
- const yourDomainClients = allClients.filter((client) => {
33
- try {
34
- const url = new URL(client.url);
35
- return url.origin === 'http://localhost:6003';
36
- } catch {
37
- return false;
38
- }
39
- });
40
-
41
- // Kiểm tra xem có tab nào cùng domain đang focus không
42
- // Lưu ý: client.focused có thể không hỗ trợ ở một số trình duyệt, có thể cần workaround ở client
43
- const hasFocused = yourDomainClients.some((client) => client.focused);
44
-
45
- if (hasFocused) {
46
- // Nếu có tab focus, gửi message để React UI xử lý
47
- yourDomainClients.forEach((client) => client.postMessage(data));
48
- // Không show notification hệ thống
49
- return;
50
- } else {
51
- // Không có tab focus, show notification hệ thống
52
- await self.registration.showNotification(title, { body, icon, data });
53
-
54
- // Gửi message cho các tab cùng domain (nếu muốn)
55
- yourDomainClients.forEach((client) => client.postMessage(data));
56
- }
57
- })(),
58
- );
59
- });
60
-
61
- // Xử lý khi người dùng click vào thông báo
62
- self.addEventListener('notificationclick', function (event) {
63
- event.notification.close();
64
-
65
- const { path } = event.notification.data || {};
66
-
67
- if (!path) return;
68
-
69
- event.waitUntil(
70
- clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
71
- const existingClient = clientList.find((client) => client.url === path && 'focus' in client);
72
- if (existingClient) return existingClient.focus();
73
- if (clients.openWindow) return clients.openWindow(path);
74
- }),
75
- );
76
- });
77
-
78
- // Gửi thông báo về các tab đang mở
79
- function notifyClients(payload) {
80
- self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clients) => {
81
- clients.forEach((client) => {
82
- client.postMessage({
83
- type: 'NOTIFICATION_RECEIVED',
84
- title: payload.data?.title || 'Thông báo',
85
- body: payload.data?.message || '',
86
- icon: payload.data?.icon || '/images/logo-192x192.png',
87
- data: payload.data || payload,
88
- });
89
- });
90
- });
91
- }