@ozdao/martyrs 0.2.432 → 0.2.434
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/builder.js +3 -2
- package/dist/builder.mjs +3 -2
- package/dist/martyrs/src/components/Menu/{Menu.vue2.cjs → Menu.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Menu/{Menu.vue2.js → Menu.vue.js} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue.js.map +1 -0
- package/dist/martyrs/src/components/Tab/{Tab.vue.cjs → Tab.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Tab/{Tab.vue.js → Tab.vue2.js} +2 -2
- package/dist/martyrs/src/components/Tab/{Tab.vue.cjs.map → Tab.vue2.js.map} +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
- package/dist/martyrs/src/modules/landing/landing.client.cjs +0 -6
- package/dist/martyrs/src/modules/landing/landing.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/landing/landing.client.js +0 -6
- package/dist/martyrs/src/modules/landing/landing.client.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.cjs +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs +248 -135
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.js +248 -135
- package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
- package/dist/style.css +4 -92
- package/package.json +1 -1
- package/src/builder/webpack/webpack.config.base.js +0 -1
- package/src/builder/webpack/webpack.config.client.js +4 -0
- package/src/builder/webpack/webpack.config.ssr.js +0 -1
- package/src/modules/landing/landing.client.js +6 -6
- package/src/modules/notifications/components/layouts/NotificationsLayout.vue +2 -0
- package/src/modules/notifications/notifications.client.js +351 -167
- package/src/modules/notifications/notifications2.client.js +256 -0
- package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Tab/Tab.vue.js.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.cjs +0 -101
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.js +0 -101
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.js.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.cjs +0 -85
- package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.js +0 -85
- package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.js.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.cjs +0 -97
- package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.js +0 -97
- package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.js.map +0 -1
|
@@ -11,125 +11,230 @@ const NotificationPreferences = require("./components/sections/NotificationPrefe
|
|
|
11
11
|
const Notifications = require("./components/pages/Notifications.vue.cjs");
|
|
12
12
|
const NotificationBadge = require("./components/elements/NotificationBadge.vue.cjs");
|
|
13
13
|
const NotificationItem = require("./components/blocks/NotificationItem.vue.cjs");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
class WebSocketNotificationHandler {
|
|
15
|
+
constructor(store, options = {}) {
|
|
16
|
+
this.store = store;
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.moduleName = "notifications";
|
|
19
|
+
this.listeners = [];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Connect to notifications channel
|
|
23
|
+
*/
|
|
24
|
+
connect(userId) {
|
|
25
|
+
if (typeof window === "undefined" || !userId) {
|
|
26
|
+
return Promise.resolve(false);
|
|
27
|
+
}
|
|
17
28
|
return globals_websocket.default.connect(userId).then(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const addListener = (event, handler) => {
|
|
21
|
-
listeners.push(globals_websocket.default.addEventListener(event, handler, { module: moduleName }));
|
|
22
|
-
};
|
|
23
|
-
addListener("notification", (data) => {
|
|
24
|
-
if (!data || !data.data) return;
|
|
25
|
-
const notification = data.data;
|
|
26
|
-
store.notifications.actions.addLocalNotification({
|
|
27
|
-
_id: notification._id,
|
|
28
|
-
title: notification.title,
|
|
29
|
-
body: notification.body,
|
|
30
|
-
type: notification.type || "info",
|
|
31
|
-
metadata: notification.metadata || {},
|
|
32
|
-
status: "unread",
|
|
33
|
-
createdAt: notification.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
34
|
-
updatedAt: notification.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
addListener("notification_read", (data) => {
|
|
38
|
-
store.notifications.actions.syncNotificationStatus(data.notificationId, "read");
|
|
39
|
-
});
|
|
40
|
-
return { listeners, moduleName };
|
|
29
|
+
this._registerListeners();
|
|
30
|
+
return true;
|
|
41
31
|
});
|
|
42
|
-
},
|
|
43
|
-
disconnect: (moduleName, listeners) => {
|
|
44
|
-
if (listeners) {
|
|
45
|
-
globals_websocket.default.removeModuleListeners(moduleName);
|
|
46
|
-
}
|
|
47
32
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Disconnect notification listeners
|
|
35
|
+
*/
|
|
36
|
+
disconnect() {
|
|
37
|
+
globals_websocket.default.removeModuleListeners(this.moduleName);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Register notification event listeners
|
|
41
|
+
*/
|
|
42
|
+
_registerListeners() {
|
|
43
|
+
this.listeners.push(
|
|
44
|
+
globals_websocket.default.addEventListener("notification", this._processNotification.bind(this), {
|
|
45
|
+
module: this.moduleName
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
this.listeners.push(
|
|
49
|
+
globals_websocket.default.addEventListener("notification_read", (data) => {
|
|
50
|
+
this.store.notifications.actions.syncNotificationStatus(data.notificationId, "read");
|
|
51
|
+
}, { module: this.moduleName })
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Process incoming notification
|
|
56
|
+
*/
|
|
57
|
+
_processNotification(data) {
|
|
58
|
+
if (!data || !data.data) return;
|
|
59
|
+
const notification = data.data;
|
|
60
|
+
this.store.notifications.actions.addLocalNotification({
|
|
61
|
+
_id: notification._id,
|
|
62
|
+
title: notification.title,
|
|
63
|
+
body: notification.body,
|
|
64
|
+
type: notification.type || "info",
|
|
65
|
+
metadata: notification.metadata || {},
|
|
66
|
+
status: "unread",
|
|
67
|
+
createdAt: notification.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
68
|
+
updatedAt: notification.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class CapacitorPushHandler {
|
|
73
|
+
constructor(store) {
|
|
74
|
+
this.store = store;
|
|
75
|
+
this.pushNotifications = null;
|
|
76
|
+
this.device = null;
|
|
77
|
+
this.isInitialized = false;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Initialize Capacitor plugins
|
|
81
|
+
*/
|
|
82
|
+
async initialize() {
|
|
83
|
+
if (typeof window === "undefined") {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
52
86
|
try {
|
|
53
87
|
const { Capacitor } = await Promise.resolve().then(() => require("../../../node_modules/@capacitor/core/dist/index.cjs"));
|
|
54
88
|
const { PushNotifications } = await Promise.resolve().then(() => require("../../../../node_modules/@capacitor/push-notifications/dist/esm/index.cjs"));
|
|
55
89
|
const { Device } = await Promise.resolve().then(() => require("../../../../node_modules/@capacitor/device/dist/esm/index.cjs"));
|
|
56
|
-
|
|
57
|
-
|
|
90
|
+
this.capacitor = Capacitor;
|
|
91
|
+
this.pushNotifications = PushNotifications;
|
|
92
|
+
this.device = Device;
|
|
93
|
+
if (!this.capacitor.isNativePlatform()) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
this.isInitialized = true;
|
|
97
|
+
return true;
|
|
58
98
|
} catch (error) {
|
|
59
99
|
console.error("Error importing Capacitor plugins:", error);
|
|
60
100
|
return false;
|
|
61
101
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Request permission and register for push notifications
|
|
105
|
+
*/
|
|
106
|
+
async requestPermissions() {
|
|
107
|
+
if (typeof window === "undefined") {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (!this.isInitialized) {
|
|
111
|
+
const initialized = await this.initialize();
|
|
112
|
+
if (!initialized) return false;
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const permissionResult = await this.pushNotifications.requestPermissions();
|
|
116
|
+
if (permissionResult.receive !== "granted") {
|
|
117
|
+
console.log("Push notification permission denied");
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
this._setupListeners();
|
|
121
|
+
await this.pushNotifications.register();
|
|
122
|
+
return true;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error("Error requesting push notification permissions:", error);
|
|
71
125
|
return false;
|
|
72
126
|
}
|
|
73
|
-
const setupListeners = () => {
|
|
74
|
-
pushNotifications.addListener("registration", async (token) => {
|
|
75
|
-
try {
|
|
76
|
-
const deviceInfo = await device.getInfo();
|
|
77
|
-
const deviceId = await device.getId();
|
|
78
|
-
const deviceData = {
|
|
79
|
-
deviceId: deviceId.uuid,
|
|
80
|
-
deviceType: deviceInfo.platform.toLowerCase(),
|
|
81
|
-
deviceToken: token.value
|
|
82
|
-
};
|
|
83
|
-
await store.notifications.actions.registerDevice(deviceData);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error("Error handling push registration:", error);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
pushNotifications.addListener("pushNotificationReceived", (notification) => {
|
|
89
|
-
store.notifications.actions.addLocalNotification({
|
|
90
|
-
title: notification.title,
|
|
91
|
-
body: notification.body,
|
|
92
|
-
data: notification.data || {}
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
pushNotifications.addListener("pushNotificationActionPerformed", (actionData) => {
|
|
96
|
-
if (actionData.notification && actionData.notification.data) {
|
|
97
|
-
store.notifications.actions.handleNotificationAction(actionData.notification.data);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
setupListeners();
|
|
102
|
-
await pushNotifications.register();
|
|
103
|
-
return true;
|
|
104
|
-
},
|
|
105
|
-
removeListeners: (pushNotifications) => {
|
|
106
|
-
if (typeof window === "undefined" || !pushNotifications) return;
|
|
107
|
-
pushNotifications.removeAllListeners();
|
|
108
127
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Setup push notification event listeners
|
|
130
|
+
*/
|
|
131
|
+
_setupListeners() {
|
|
132
|
+
this.pushNotifications.addListener(
|
|
133
|
+
"registration",
|
|
134
|
+
this._handleRegistration.bind(this)
|
|
135
|
+
);
|
|
136
|
+
this.pushNotifications.addListener(
|
|
137
|
+
"pushNotificationReceived",
|
|
138
|
+
this._handleNotificationReceived.bind(this)
|
|
139
|
+
);
|
|
140
|
+
this.pushNotifications.addListener(
|
|
141
|
+
"pushNotificationActionPerformed",
|
|
142
|
+
this._handleNotificationAction.bind(this)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Handle registration token received
|
|
147
|
+
*/
|
|
148
|
+
async _handleRegistration(token) {
|
|
149
|
+
try {
|
|
150
|
+
const deviceInfo = await this.device.getInfo();
|
|
151
|
+
const deviceId = await this.device.getId();
|
|
152
|
+
const deviceData = {
|
|
153
|
+
deviceId: deviceId.uuid,
|
|
154
|
+
deviceType: deviceInfo.platform.toLowerCase(),
|
|
155
|
+
deviceToken: token.value
|
|
156
|
+
};
|
|
157
|
+
await this.store.notifications.actions.registerDevice(deviceData);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error("Error handling push registration:", error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Handle received notification
|
|
164
|
+
*/
|
|
165
|
+
_handleNotificationReceived(notification) {
|
|
166
|
+
this.store.notifications.actions.addLocalNotification({
|
|
167
|
+
title: notification.title,
|
|
168
|
+
body: notification.body,
|
|
169
|
+
data: notification.data || {}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Handle notification action (when user taps on notification)
|
|
174
|
+
*/
|
|
175
|
+
_handleNotificationAction(actionData) {
|
|
176
|
+
if (actionData.notification && actionData.notification.data) {
|
|
177
|
+
this.store.notifications.actions.handleNotificationAction(
|
|
178
|
+
actionData.notification.data
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Remove push notification listeners
|
|
184
|
+
*/
|
|
185
|
+
removeListeners() {
|
|
186
|
+
if (typeof window === "undefined") {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (this.pushNotifications) {
|
|
190
|
+
this.pushNotifications.removeAllListeners();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
class NotificationManager {
|
|
195
|
+
constructor(store, options = {}) {
|
|
196
|
+
this.store = store;
|
|
197
|
+
this.options = options;
|
|
198
|
+
this.wsHandler = new WebSocketNotificationHandler(store, options);
|
|
199
|
+
this.pushHandler = new CapacitorPushHandler(store);
|
|
200
|
+
this.initialized = false;
|
|
201
|
+
this.isServer = typeof window === "undefined";
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Initialize notifications
|
|
205
|
+
*/
|
|
206
|
+
async initialize() {
|
|
112
207
|
var _a;
|
|
113
|
-
if (
|
|
114
|
-
const userId = (_a = store.auth.state.user) == null ? void 0 : _a._id;
|
|
208
|
+
if (this.initialized || this.isServer) return;
|
|
209
|
+
const userId = (_a = this.store.auth.state.user) == null ? void 0 : _a._id;
|
|
115
210
|
if (!userId) {
|
|
116
211
|
console.warn("Cannot initialize notifications: No user ID found in auth store");
|
|
117
212
|
return;
|
|
118
213
|
}
|
|
119
|
-
|
|
120
|
-
if (options.enablePush !== false) {
|
|
121
|
-
await
|
|
214
|
+
await this.wsHandler.connect(userId);
|
|
215
|
+
if (this.options.enablePush !== false) {
|
|
216
|
+
await this.pushHandler.requestPermissions();
|
|
122
217
|
}
|
|
123
|
-
|
|
124
|
-
await store.notifications.actions.getNotifications(userId);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
218
|
+
this.initialized = true;
|
|
219
|
+
await this.store.notifications.actions.getNotifications(userId);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Disconnect and clean up
|
|
223
|
+
*/
|
|
224
|
+
disconnect() {
|
|
225
|
+
if (this.isServer) return;
|
|
226
|
+
this.wsHandler.disconnect();
|
|
227
|
+
this.pushHandler.removeListeners();
|
|
228
|
+
this.initialized = false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const SSRUtils = {
|
|
232
|
+
/**
|
|
233
|
+
* Pre-fetch notifications for SSR
|
|
234
|
+
* @param {Object} store - Store instance
|
|
235
|
+
* @param {Object} context - SSR context
|
|
236
|
+
*/
|
|
237
|
+
async prefetchNotifications(store, context) {
|
|
133
238
|
var _a;
|
|
134
239
|
try {
|
|
135
240
|
const userId = (_a = store.auth.state.user) == null ? void 0 : _a._id;
|
|
@@ -141,64 +246,72 @@ const notificationUtils = {
|
|
|
141
246
|
}
|
|
142
247
|
}
|
|
143
248
|
};
|
|
144
|
-
|
|
249
|
+
function initializeNotifications(app, store, router, options = {}) {
|
|
250
|
+
var _a;
|
|
145
251
|
const route = options.route || "User Profile Root";
|
|
146
252
|
router.addRoute(route, notifications_router.default);
|
|
147
253
|
store.addStore("notifications", notifications_store);
|
|
148
254
|
if (options.wsUrl) {
|
|
149
255
|
globals_websocket.default.initialize({ wsUrl: options.wsUrl });
|
|
150
256
|
}
|
|
257
|
+
const notificationManager = new NotificationManager(store, {
|
|
258
|
+
enablePush: options.enablePush !== false,
|
|
259
|
+
maxReconnectAttempts: options.maxReconnectAttempts || 5,
|
|
260
|
+
reconnectDelay: options.reconnectDelay || 3e3,
|
|
261
|
+
pingInterval: options.pingInterval || 3e4
|
|
262
|
+
});
|
|
263
|
+
store.notificationManager = notificationManager;
|
|
151
264
|
const isServer = typeof window === "undefined";
|
|
152
265
|
const autoInit = !isServer && options.autoInit !== false;
|
|
153
|
-
let notificationManager = null;
|
|
154
266
|
if (autoInit) {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
vue.watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {
|
|
167
|
-
if (isAuthenticated) {
|
|
168
|
-
initNotifications();
|
|
169
|
-
} else if (notificationManager) {
|
|
267
|
+
const isAuthenticated = store.auth.state.isAuthenticated;
|
|
268
|
+
const userId = (_a = store.auth.state.user) == null ? void 0 : _a._id;
|
|
269
|
+
if (isAuthenticated && userId) {
|
|
270
|
+
notificationManager.initialize();
|
|
271
|
+
}
|
|
272
|
+
vue.watch(() => store.auth.state.isAuthenticated, (isAuthenticated2) => {
|
|
273
|
+
if (isAuthenticated2) {
|
|
274
|
+
notificationManager.initialize();
|
|
275
|
+
} else {
|
|
170
276
|
notificationManager.disconnect();
|
|
171
277
|
store.notifications.mutations.resetNotifications();
|
|
172
|
-
notificationManager = null;
|
|
173
278
|
}
|
|
174
279
|
});
|
|
175
|
-
if (store.auth.state.isAuthenticated) {
|
|
176
|
-
initNotifications();
|
|
177
|
-
}
|
|
178
280
|
}
|
|
179
|
-
app.provide("useNotifications", () =>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
281
|
+
app.provide("useNotifications", () => {
|
|
282
|
+
return {
|
|
283
|
+
...vue.toRefs(store.notifications.state),
|
|
284
|
+
...store.notifications.actions,
|
|
285
|
+
...store.notifications.mutations,
|
|
286
|
+
init: notificationManager.initialize.bind(notificationManager),
|
|
287
|
+
disconnect: notificationManager.disconnect.bind(notificationManager),
|
|
288
|
+
isServer
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
return notificationManager;
|
|
292
|
+
}
|
|
191
293
|
const ModuleNotifications = {
|
|
192
294
|
initialize: initializeNotifications,
|
|
295
|
+
SSR: SSRUtils,
|
|
296
|
+
// Export SSR utilities
|
|
193
297
|
views: {
|
|
194
|
-
store: {
|
|
195
|
-
|
|
298
|
+
store: {
|
|
299
|
+
storeNotifications: notifications_store
|
|
300
|
+
},
|
|
301
|
+
router: {
|
|
302
|
+
routerNotifications: notifications_router.default
|
|
303
|
+
},
|
|
196
304
|
components: {
|
|
305
|
+
// Elements
|
|
197
306
|
NotificationBadge: NotificationBadge.default,
|
|
307
|
+
// Blocks
|
|
198
308
|
NotificationItem: NotificationItem.default,
|
|
309
|
+
// Sections
|
|
199
310
|
NotificationsList: NotificationsList.default,
|
|
200
311
|
NotificationPreferences: NotificationPreferences.default,
|
|
312
|
+
// Pages
|
|
201
313
|
Notifications: Notifications.default,
|
|
314
|
+
// Layouts
|
|
202
315
|
NotificationsLayout: NotificationsLayout.default
|
|
203
316
|
}
|
|
204
317
|
}
|
|
@@ -209,6 +322,6 @@ exports.NotificationPreferences = NotificationPreferences.default;
|
|
|
209
322
|
exports.Notifications = Notifications.default;
|
|
210
323
|
exports.NotificationBadge = NotificationBadge.default;
|
|
211
324
|
exports.NotificationItem = NotificationItem.default;
|
|
212
|
-
exports.SSRUtils =
|
|
325
|
+
exports.SSRUtils = SSRUtils;
|
|
213
326
|
exports.default = ModuleNotifications;
|
|
214
327
|
//# sourceMappingURL=notifications.client.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.client.cjs","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { watch, toRefs } from \"vue\";\nimport routerNotifications from './router/notifications.router.js';\nimport * as storeNotifications from './store/notifications.store.js';\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue';\nimport NotificationsList from './components/sections/NotificationsList.vue';\nimport NotificationPreferences from './components/sections/NotificationPreferences.vue';\nimport Notifications from './components/pages/Notifications.vue';\nimport NotificationBadge from './components/elements/NotificationBadge.vue';\nimport NotificationItem from './components/blocks/NotificationItem.vue';\n\n// WebSocket notification handlers\nconst wsNotificationHandlers = {\n connect: (store, userId, options = {}) => {\n if (typeof window === 'undefined' || !userId) return Promise.resolve(false);\n \n return globalWebSocket.connect(userId).then(() => {\n const moduleName = 'notifications';\n const listeners = [];\n\n const addListener = (event, handler) => {\n listeners.push(globalWebSocket.addEventListener(event, handler, { module: moduleName }));\n };\n\n addListener('notification', (data) => {\n if (!data || !data.data) return;\n const notification = data.data;\n \n store.notifications.actions.addLocalNotification({\n _id: notification._id,\n title: notification.title,\n body: notification.body,\n type: notification.type || 'info',\n metadata: notification.metadata || {},\n status: 'unread',\n createdAt: notification.createdAt || new Date().toISOString(),\n updatedAt: notification.updatedAt || new Date().toISOString()\n });\n });\n\n addListener('notification_read', (data) => {\n store.notifications.actions.syncNotificationStatus(data.notificationId, 'read');\n });\n\n return { listeners, moduleName };\n });\n },\n\n disconnect: (moduleName, listeners) => {\n if (listeners) {\n globalWebSocket.removeModuleListeners(moduleName);\n }\n }\n};\n\n// Capacitor Push Notification handlers\nconst pushNotificationHandlers = {\n initialize: async () => {\n if (typeof window === 'undefined') return false;\n\n try {\n const { Capacitor } = await import('@capacitor/core');\n const { PushNotifications } = await import('@capacitor/push-notifications');\n const { Device } = await import('@capacitor/device');\n\n if (!Capacitor.isNativePlatform()) return false;\n\n return { pushNotifications: PushNotifications, device: Device };\n } catch (error) {\n console.error('Error importing Capacitor plugins:', error);\n return false;\n }\n },\n\n requestPermissions: async (store) => {\n if (typeof window === 'undefined') return false;\n\n const plugins = await pushNotificationHandlers.initialize();\n if (!plugins) return false;\n\n const { pushNotifications, device } = plugins;\n\n const permissionResult = await pushNotifications.requestPermissions();\n if (permissionResult.receive !== 'granted') {\n console.log('Push notification permission denied');\n return false;\n }\n\n const setupListeners = () => {\n pushNotifications.addListener('registration', async (token) => {\n try {\n const deviceInfo = await device.getInfo();\n const deviceId = await device.getId();\n\n const deviceData = {\n deviceId: deviceId.uuid,\n deviceType: deviceInfo.platform.toLowerCase(),\n deviceToken: token.value\n };\n\n await store.notifications.actions.registerDevice(deviceData);\n } catch (error) {\n console.error('Error handling push registration:', error);\n }\n });\n\n pushNotifications.addListener('pushNotificationReceived', (notification) => {\n store.notifications.actions.addLocalNotification({\n title: notification.title,\n body: notification.body,\n data: notification.data || {}\n });\n });\n\n pushNotifications.addListener('pushNotificationActionPerformed', (actionData) => {\n if (actionData.notification && actionData.notification.data) {\n store.notifications.actions.handleNotificationAction(actionData.notification.data);\n }\n });\n };\n\n setupListeners();\n await pushNotifications.register();\n return true;\n },\n\n removeListeners: (pushNotifications) => {\n if (typeof window === 'undefined' || !pushNotifications) return;\n pushNotifications.removeAllListeners();\n }\n};\n\n// Notification utilities\nconst notificationUtils = {\n initialize: async (store, options = {}) => {\n if (typeof window === 'undefined') return;\n\n const userId = store.auth.state.user?._id;\n if (!userId) {\n console.warn('Cannot initialize notifications: No user ID found in auth store');\n return;\n }\n\n let wsListeners = null;\n if (options.enablePush !== false) {\n await pushNotificationHandlers.requestPermissions(store);\n }\n\n wsListeners = await wsNotificationHandlers.connect(store, userId, options);\n\n await store.notifications.actions.getNotifications(userId);\n\n return {\n disconnect: () => {\n wsNotificationHandlers.disconnect(wsListeners?.moduleName, wsListeners?.listeners);\n pushNotificationHandlers.removeListeners(globalThis.pushNotifications);\n }\n };\n },\n\n prefetchForSSR: async (store, context) => {\n try {\n const userId = store.auth.state.user?._id;\n if (userId) {\n await store.notifications.actions.getNotifications(userId);\n }\n } catch (error) {\n console.error('Error pre-fetching notifications for SSR:', error);\n }\n }\n};\n\n// Main initialization function\nconst initializeNotifications = (app, store, router, options = {}) => {\n const route = options.route || 'User Profile Root';\n router.addRoute(route, routerNotifications);\n store.addStore('notifications', storeNotifications);\n\n if (options.wsUrl) {\n globalWebSocket.initialize({ wsUrl: options.wsUrl });\n }\n\n const isServer = typeof window === 'undefined';\n const autoInit = !isServer && options.autoInit !== false;\n\n let notificationManager = null;\n\n if (autoInit) {\n const initNotifications = async () => {\n if (store.auth.state.isAuthenticated && store.auth.state.user?._id) {\n notificationManager = await notificationUtils.initialize(store, {\n enablePush: options.enablePush !== false,\n maxReconnectAttempts: options.maxReconnectAttempts || 5,\n reconnectDelay: options.reconnectDelay || 3000,\n pingInterval: options.pingInterval || 30000\n });\n }\n };\n\n watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {\n if (isAuthenticated) {\n initNotifications();\n } else if (notificationManager) {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n notificationManager = null;\n }\n });\n\n if (store.auth.state.isAuthenticated) {\n initNotifications();\n }\n }\n\n app.provide('useNotifications', () => ({\n ...toRefs(store.notifications.state),\n ...store.notifications.actions,\n ...store.notifications.mutations,\n init: () => notificationUtils.initialize(store, options),\n disconnect: () => notificationManager?.disconnect(),\n isServer\n }));\n\n return {\n SSR: { prefetchNotifications: notificationUtils.prefetchForSSR }\n };\n};\n\nconst ModuleNotifications = {\n initialize: initializeNotifications,\n views: {\n store: { storeNotifications },\n router: { routerNotifications },\n components: {\n NotificationBadge,\n NotificationItem,\n NotificationsList,\n NotificationPreferences,\n Notifications,\n NotificationsLayout\n }\n }\n};\n\nexport {\n NotificationBadge,\n NotificationItem,\n NotificationsList,\n NotificationPreferences,\n Notifications,\n NotificationsLayout,\n notificationUtils as SSRUtils\n};\n\nexport default ModuleNotifications;"],"names":["globalWebSocket","routerNotifications","storeNotifications","watch","toRefs","NotificationBadge","NotificationItem","NotificationsList","NotificationPreferences","Notifications","NotificationsLayout"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,yBAAyB;AAAA,EAC7B,SAAS,CAAC,OAAO,QAAQ,UAAU,CAAA,MAAO;AACxC,QAAI,OAAO,WAAW,eAAe,CAAC,OAAQ,QAAO,QA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eAAc;AAAA,EAC/D;AACH;AAEK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,OAAO;AAAA,IACL,OAAO,EAAEF,oBAAAA,oBAAoB;AAAA,IAC7B,QAAQ,EAAED,qBAAAA,qBAAAA,QAAqB;AAAA,IAC/B,YAAY;AAAA,MAChB,mBAAMI,kBAAiB;AAAA,MACvB,kBAAMC,iBAAgB;AAAA,MACtB,mBAAMC,kBAAiB;AAAA,MACvB,yBAAMC,wBAAuB;AAAA,MAC7B,eAAMC,cAAa;AAAA,MACbC,qBAAAA,oBAAAA;AAAAA,IACN;AAAA,EACA;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"notifications.client.cjs","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { watch, toRefs } from \"vue\";\n// Router import \nimport routerNotifications from './router/notifications.router.js'; \n// Store \nimport * as storeNotifications from './store/notifications.store.js'; \n// Auth store import\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\n// Global WebSocket import\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\n// Layouts \nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue'; \n// Sections \nimport NotificationsList from './components/sections/NotificationsList.vue'; \nimport NotificationPreferences from './components/sections/NotificationPreferences.vue'; \n// Pages \nimport Notifications from './components/pages/Notifications.vue'; \n// Components \nimport NotificationBadge from './components/elements/NotificationBadge.vue'; \nimport NotificationItem from './components/blocks/NotificationItem.vue'; \n\n/**\n * WebSocket notification handler that uses the global WebSocket connection\n */\nclass WebSocketNotificationHandler {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.moduleName = 'notifications';\n this.listeners = [];\n }\n\n /**\n * Connect to notifications channel\n */\n connect(userId) {\n // Skip if running in SSR\n if (typeof window === 'undefined' || !userId) {\n return Promise.resolve(false);\n }\n\n // First ensure the global WebSocket is connected\n return globalWebSocket.connect(userId).then(() => {\n // Register event listeners\n this._registerListeners();\n return true;\n });\n }\n\n /**\n * Disconnect notification listeners\n */\n disconnect() {\n globalWebSocket.removeModuleListeners(this.moduleName);\n }\n\n /**\n * Register notification event listeners\n */\n _registerListeners() {\n // Listen for notification events\n this.listeners.push(\n globalWebSocket.addEventListener('notification', this._processNotification.bind(this), {\n module: this.moduleName\n })\n );\n \n // Listen for notification read status changes\n this.listeners.push(\n globalWebSocket.addEventListener('notification_read', (data) => {\n this.store.notifications.actions.syncNotificationStatus(data.notificationId, 'read');\n }, { module: this.moduleName })\n );\n }\n\n /**\n * Process incoming notification\n */\n _processNotification(data) {\n if (!data || !data.data) return;\n \n const notification = data.data;\n \n // Add notification to store\n this.store.notifications.actions.addLocalNotification({\n _id: notification._id,\n title: notification.title,\n body: notification.body,\n type: notification.type || 'info',\n metadata: notification.metadata || {},\n status: 'unread',\n createdAt: notification.createdAt || new Date().toISOString(),\n updatedAt: notification.updatedAt || new Date().toISOString()\n });\n }\n}\n\n/**\n * Capacitor Push Notification handler\n */\nclass CapacitorPushHandler {\n constructor(store) {\n this.store = store;\n this.pushNotifications = null;\n this.device = null;\n this.isInitialized = false;\n }\n\n /**\n * Initialize Capacitor plugins\n */\n async initialize() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n try {\n // Dynamic imports to prevent errors in web environment\n const { Capacitor } = await import('@capacitor/core');\n const { PushNotifications } = await import('@capacitor/push-notifications');\n const { Device } = await import('@capacitor/device');\n \n this.capacitor = Capacitor;\n this.pushNotifications = PushNotifications;\n this.device = Device;\n \n // Only proceed if running on a native platform\n if (!this.capacitor.isNativePlatform()) {\n return false;\n }\n \n this.isInitialized = true;\n return true;\n } catch (error) {\n console.error('Error importing Capacitor plugins:', error);\n return false;\n }\n }\n\n /**\n * Request permission and register for push notifications\n */\n async requestPermissions() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n if (!this.isInitialized) {\n const initialized = await this.initialize();\n if (!initialized) return false;\n }\n\n try {\n // Request permission\n const permissionResult = await this.pushNotifications.requestPermissions();\n if (permissionResult.receive !== 'granted') {\n console.log('Push notification permission denied');\n return false;\n }\n \n // Set up event listeners\n this._setupListeners();\n \n // Register with Apple/Google\n await this.pushNotifications.register();\n return true;\n } catch (error) {\n console.error('Error requesting push notification permissions:', error);\n return false;\n }\n }\n\n /**\n * Setup push notification event listeners\n */\n _setupListeners() {\n // Registration event\n this.pushNotifications.addListener('registration', \n this._handleRegistration.bind(this)\n );\n \n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived',\n this._handleNotificationReceived.bind(this)\n );\n \n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed',\n this._handleNotificationAction.bind(this)\n );\n }\n\n /**\n * Handle registration token received\n */\n async _handleRegistration(token) {\n try {\n // Get device info\n const deviceInfo = await this.device.getInfo();\n const deviceId = await this.device.getId();\n \n // Prepare device data\n const deviceData = {\n deviceId: deviceId.uuid,\n deviceType: deviceInfo.platform.toLowerCase(),\n deviceToken: token.value\n };\n \n // Register device with backend\n await this.store.notifications.actions.registerDevice(deviceData);\n } catch (error) {\n console.error('Error handling push registration:', error);\n }\n }\n\n /**\n * Handle received notification\n */\n _handleNotificationReceived(notification) {\n // Add notification to store\n this.store.notifications.actions.addLocalNotification({\n title: notification.title,\n body: notification.body,\n data: notification.data || {}\n });\n }\n\n /**\n * Handle notification action (when user taps on notification)\n */\n _handleNotificationAction(actionData) {\n if (actionData.notification && actionData.notification.data) {\n this.store.notifications.actions.handleNotificationAction(\n actionData.notification.data\n );\n }\n }\n\n /**\n * Remove push notification listeners\n */\n removeListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n \n if (this.pushNotifications) {\n this.pushNotifications.removeAllListeners();\n }\n }\n}\n\n/**\n * Notification Manager for coordinating WebSocket and Push notifications\n */\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.wsHandler = new WebSocketNotificationHandler(store, options);\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n /**\n * Initialize notifications\n */\n async initialize() {\n if (this.initialized || this.isServer) return;\n \n // Get current user ID from auth store instead of localStorage\n const userId = this.store.auth.state.user?._id;\n if (!userId) {\n console.warn('Cannot initialize notifications: No user ID found in auth store');\n return;\n }\n \n // Initialize WebSocket for realtime notifications\n await this.wsHandler.connect(userId);\n \n // Initialize push notifications for mobile if enabled\n if (this.options.enablePush !== false) {\n await this.pushHandler.requestPermissions();\n }\n \n this.initialized = true;\n \n // Fetch existing notifications\n await this.store.notifications.actions.getNotifications(userId);\n }\n\n /**\n * Disconnect and clean up\n */\n disconnect() {\n if (this.isServer) return;\n \n this.wsHandler.disconnect();\n this.pushHandler.removeListeners();\n this.initialized = false;\n }\n}\n\n/**\n * Server-side utility for pre-fetching notification data\n */\nconst SSRUtils = {\n /**\n * Pre-fetch notifications for SSR\n * @param {Object} store - Store instance\n * @param {Object} context - SSR context\n */\n async prefetchNotifications(store, context) {\n try {\n const userId = store.auth.state.user?._id;\n if (userId) {\n // Fetch notifications without WebSocket or push setup\n await store.notifications.actions.getNotifications(userId);\n }\n } catch (error) {\n console.error('Error pre-fetching notifications for SSR:', error);\n }\n }\n};\n\n/**\n * Function to initialize the notifications module\n * @param {Object} app - Vue app instance\n * @param {Object} store - Vuex/Pinia store\n * @param {Object} router - Vue Router instance\n * @param {Object} options - Configuration options\n */\nfunction initializeNotifications(app, store, router, options = {}) {\n // Add routes and store\n const route = options.route || 'User Profile Root';\n router.addRoute(route, routerNotifications);\n store.addStore('notifications', storeNotifications);\n \n // Initialize global WebSocket if needed\n if (options.wsUrl) {\n globalWebSocket.initialize({ wsUrl: options.wsUrl });\n }\n \n // Create notification manager\n const notificationManager = new NotificationManager(store, {\n enablePush: options.enablePush !== false,\n maxReconnectAttempts: options.maxReconnectAttempts || 5,\n reconnectDelay: options.reconnectDelay || 3000,\n pingInterval: options.pingInterval || 30000\n });\n \n // Attach notification manager to store for access in components\n store.notificationManager = notificationManager;\n \n // Don't auto-initialize on server\n const isServer = typeof window === 'undefined';\n const autoInit = !isServer && options.autoInit !== false;\n \n if (autoInit) {\n // Initialize after auth is confirmed\n const isAuthenticated = store.auth.state.isAuthenticated;\n const userId = store.auth.state.user?._id;\n \n if (isAuthenticated && userId) {\n notificationManager.initialize();\n }\n \n // Watch for user login/logout using auth store\n watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {\n if (isAuthenticated) {\n notificationManager.initialize();\n } else {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n }\n });\n }\n \n // Provide composable for components to access notification functionality\n app.provide('useNotifications', () => {\n return {\n ...toRefs(store.notifications.state),\n ...store.notifications.actions,\n ...store.notifications.mutations,\n init: notificationManager.initialize.bind(notificationManager),\n disconnect: notificationManager.disconnect.bind(notificationManager),\n isServer\n };\n });\n \n return notificationManager;\n}\n\n// Module export\nconst ModuleNotifications = {\n initialize: initializeNotifications,\n SSR: SSRUtils, // Export SSR utilities\n views: {\n store: {\n storeNotifications,\n },\n router: {\n routerNotifications\n },\n components: {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout\n }\n }\n};\n\n// Component exports\nexport {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // SSR Utilities\n SSRUtils\n};\n\nexport default ModuleNotifications;\n"],"names":["globalWebSocket","routerNotifications","storeNotifications","watch","isAuthenticated","toRefs","NotificationBadge","NotificationItem","NotificationsList","NotificationPreferences","Notifications","NotificationsLayout"],"mappings":";;;;;;;;;;;;;AAuBA,MAAM,6BAA6B;AAAA,EACjC,YAAY,OAAO,UAAU,IAAI;AAC/B,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,YAAY,CAAE;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAK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