@ozdao/martyrs 0.2.430 → 0.2.431

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 (213) hide show
  1. package/dist/chats.server.js +0 -19
  2. package/dist/chats.server.mjs +0 -19
  3. package/dist/martyrs/src/components/Button/{Button.vue.cjs → Button.vue2.cjs} +2 -2
  4. package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +1 -0
  5. package/dist/martyrs/src/components/Button/{Button.vue.js → Button.vue2.js} +2 -2
  6. package/dist/martyrs/src/components/Button/{Button.vue.cjs.map → Button.vue2.js.map} +1 -1
  7. package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +2 -2
  8. package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
  9. package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +2 -2
  10. package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
  11. package/dist/martyrs/src/components/Menu/{Menu.vue2.cjs → Menu.vue.cjs} +2 -2
  12. package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +1 -0
  13. package/dist/martyrs/src/components/Menu/{Menu.vue2.js → Menu.vue.js} +2 -2
  14. package/dist/martyrs/src/components/Menu/Menu.vue.js.map +1 -0
  15. package/dist/martyrs/src/components/Popup/{Popup.vue2.cjs → Popup.vue.cjs} +2 -2
  16. package/dist/martyrs/src/components/Popup/{Popup.vue2.js.map → Popup.vue.cjs.map} +1 -1
  17. package/dist/martyrs/src/components/Popup/{Popup.vue2.js → Popup.vue.js} +2 -2
  18. package/dist/martyrs/src/components/Popup/Popup.vue.js.map +1 -0
  19. package/dist/martyrs/src/components/Tab/{Tab.vue.cjs → Tab.vue2.cjs} +2 -2
  20. package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +1 -0
  21. package/dist/martyrs/src/components/Tab/{Tab.vue.js → Tab.vue2.js} +2 -2
  22. package/dist/martyrs/src/components/Tab/{Tab.vue.cjs.map → Tab.vue2.js.map} +1 -1
  23. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +2 -2
  24. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +2 -2
  25. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +2 -2
  26. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +2 -2
  27. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
  28. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +2 -2
  29. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
  30. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
  31. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
  32. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
  33. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +2 -2
  34. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +2 -2
  35. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +2 -2
  36. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +2 -2
  37. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +2 -2
  38. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +2 -2
  39. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +2 -2
  40. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +2 -2
  41. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs +1 -1
  42. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
  43. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
  44. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
  45. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +3 -3
  46. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +3 -3
  47. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +2 -2
  48. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
  49. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  50. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  51. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  52. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
  53. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  54. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  55. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +2 -2
  56. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +2 -2
  57. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +2 -2
  58. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
  59. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +1 -1
  60. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +1 -1
  61. package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +1 -1
  62. package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +1 -1
  63. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
  64. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
  65. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
  66. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
  67. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +3 -3
  68. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
  69. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
  70. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
  71. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +2 -2
  72. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +2 -2
  73. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +5 -4
  74. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
  75. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +5 -4
  76. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
  77. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
  78. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +1 -1
  79. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
  80. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
  81. package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
  82. package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
  83. package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.cjs +101 -0
  84. package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.cjs.map +1 -0
  85. package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.js +101 -0
  86. package/dist/martyrs/src/modules/landing/components/sections/SectionFeaturesImages.vue.js.map +1 -0
  87. package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.cjs +85 -0
  88. package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.cjs.map +1 -0
  89. package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.js +85 -0
  90. package/dist/martyrs/src/modules/landing/components/sections/SectionHeroToken.vue.js.map +1 -0
  91. package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.cjs +97 -0
  92. package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.cjs.map +1 -0
  93. package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.js +97 -0
  94. package/dist/martyrs/src/modules/landing/components/sections/SectionRoadmap.vue.js.map +1 -0
  95. package/dist/martyrs/src/modules/landing/landing.client.cjs +6 -0
  96. package/dist/martyrs/src/modules/landing/landing.client.cjs.map +1 -1
  97. package/dist/martyrs/src/modules/landing/landing.client.js +6 -0
  98. package/dist/martyrs/src/modules/landing/landing.client.js.map +1 -1
  99. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs +4 -12
  100. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs.map +1 -1
  101. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js +4 -12
  102. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js.map +1 -1
  103. package/dist/martyrs/src/modules/notifications/notifications.client.cjs +135 -248
  104. package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
  105. package/dist/martyrs/src/modules/notifications/notifications.client.js +135 -248
  106. package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
  107. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +2 -2
  108. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +2 -2
  109. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
  110. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
  111. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
  112. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
  113. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +3 -3
  114. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +3 -3
  115. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  116. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
  117. package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  118. package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
  119. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  120. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  121. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  122. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  123. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +3 -3
  124. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
  125. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +3 -3
  126. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +3 -3
  127. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +5 -5
  128. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
  129. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +5 -5
  130. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
  131. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
  132. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  133. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +3 -3
  134. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  135. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  136. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  137. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +1 -1
  138. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +1 -1
  139. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +2 -2
  140. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  141. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  142. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  143. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -2
  144. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
  145. package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -1
  146. package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
  147. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
  148. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
  149. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +2 -2
  150. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +2 -2
  151. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  152. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  153. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  154. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +1 -1
  155. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  156. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  157. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  158. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  159. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  160. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  161. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +12 -10
  162. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
  163. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +12 -10
  164. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
  165. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +3 -3
  166. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
  167. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
  168. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
  169. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  170. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
  171. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +2 -2
  172. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +2 -2
  173. package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.cjs +1 -1
  174. package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.js +1 -1
  175. package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
  176. package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
  177. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +1 -1
  178. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +1 -1
  179. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +2 -2
  180. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  181. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  182. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  183. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs +1 -1
  184. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
  185. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +3 -3
  186. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +3 -3
  187. package/dist/notifications.server.js +85 -1
  188. package/dist/notifications.server.mjs +85 -1
  189. package/dist/orders.server.js +0 -27
  190. package/dist/orders.server.mjs +0 -27
  191. package/dist/style.css +101 -18
  192. package/package.json +1 -1
  193. package/src/builder/modes/ssr.dev.js +0 -20
  194. package/src/modules/chats/routes/chats.routes.js +19 -19
  195. package/src/modules/globals/controllers/utils/queryProcessor.js +1 -1
  196. package/src/modules/globals/views/components/layouts/Client.vue +6 -6
  197. package/src/modules/landing/components/sections/SectionHeroToken.vue +1 -1
  198. package/src/modules/landing/landing.client.js +7 -0
  199. package/src/modules/notifications/components/elements/NotificationBadge.vue +4 -13
  200. package/src/modules/notifications/notifications.client.js +166 -350
  201. package/src/modules/notifications/services/notification.service.js +4 -3
  202. package/src/modules/notifications/services/websocket.service.js +54 -56
  203. package/src/modules/orders/components/pages/OrderCreate.vue +1 -1
  204. package/src/modules/orders/controllers/orders.controller.js +1 -2
  205. package/src/modules/organizations/components/pages/Organization.vue +3 -3
  206. package/src/modules/products/components/pages/Product.vue +10 -9
  207. package/dist/martyrs/src/components/Button/Button.vue.js.map +0 -1
  208. package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
  209. package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
  210. package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +0 -1
  211. package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +0 -1
  212. package/dist/martyrs/src/components/Popup/Popup.vue2.cjs.map +0 -1
  213. package/dist/martyrs/src/components/Tab/Tab.vue.js.map +0 -1
@@ -11,230 +11,125 @@ 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
- 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
- }
14
+ const wsNotificationHandlers = {
15
+ connect: (store, userId, options = {}) => {
16
+ if (typeof window === "undefined" || !userId) return Promise.resolve(false);
28
17
  return globals_websocket.default.connect(userId).then(() => {
29
- this._registerListeners();
30
- return true;
31
- });
32
- }
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()
18
+ const moduleName = "notifications";
19
+ const listeners = [];
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 };
69
41
  });
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;
42
+ },
43
+ disconnect: (moduleName, listeners) => {
44
+ if (listeners) {
45
+ globals_websocket.default.removeModuleListeners(moduleName);
85
46
  }
47
+ }
48
+ };
49
+ const pushNotificationHandlers = {
50
+ initialize: async () => {
51
+ if (typeof window === "undefined") return false;
86
52
  try {
87
53
  const { Capacitor } = await Promise.resolve().then(() => require("../../../node_modules/@capacitor/core/dist/index.cjs"));
88
54
  const { PushNotifications } = await Promise.resolve().then(() => require("../../../../node_modules/@capacitor/push-notifications/dist/esm/index.cjs"));
89
55
  const { Device } = await Promise.resolve().then(() => require("../../../../node_modules/@capacitor/device/dist/esm/index.cjs"));
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;
56
+ if (!Capacitor.isNativePlatform()) return false;
57
+ return { pushNotifications: PushNotifications, device: Device };
98
58
  } catch (error) {
99
59
  console.error("Error importing Capacitor plugins:", error);
100
60
  return false;
101
61
  }
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);
62
+ },
63
+ requestPermissions: async (store) => {
64
+ if (typeof window === "undefined") return false;
65
+ const plugins = await pushNotificationHandlers.initialize();
66
+ if (!plugins) return false;
67
+ const { pushNotifications, device } = plugins;
68
+ const permissionResult = await pushNotifications.requestPermissions();
69
+ if (permissionResult.receive !== "granted") {
70
+ console.log("Push notification permission denied");
125
71
  return false;
126
72
  }
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();
127
108
  }
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() {
109
+ };
110
+ const notificationUtils = {
111
+ initialize: async (store, options = {}) => {
207
112
  var _a;
208
- if (this.initialized || this.isServer) return;
209
- const userId = (_a = this.store.auth.state.user) == null ? void 0 : _a._id;
113
+ if (typeof window === "undefined") return;
114
+ const userId = (_a = store.auth.state.user) == null ? void 0 : _a._id;
210
115
  if (!userId) {
211
116
  console.warn("Cannot initialize notifications: No user ID found in auth store");
212
117
  return;
213
118
  }
214
- await this.wsHandler.connect(userId);
215
- if (this.options.enablePush !== false) {
216
- await this.pushHandler.requestPermissions();
119
+ let wsListeners = null;
120
+ if (options.enablePush !== false) {
121
+ await pushNotificationHandlers.requestPermissions(store);
217
122
  }
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) {
123
+ wsListeners = await wsNotificationHandlers.connect(store, userId, options);
124
+ await store.notifications.actions.getNotifications(userId);
125
+ return {
126
+ disconnect: () => {
127
+ wsNotificationHandlers.disconnect(wsListeners == null ? void 0 : wsListeners.moduleName, wsListeners == null ? void 0 : wsListeners.listeners);
128
+ pushNotificationHandlers.removeListeners(globalThis.pushNotifications);
129
+ }
130
+ };
131
+ },
132
+ prefetchForSSR: async (store, context) => {
238
133
  var _a;
239
134
  try {
240
135
  const userId = (_a = store.auth.state.user) == null ? void 0 : _a._id;
@@ -246,72 +141,64 @@ const SSRUtils = {
246
141
  }
247
142
  }
248
143
  };
249
- function initializeNotifications(app, store, router, options = {}) {
250
- var _a;
144
+ const initializeNotifications = (app, store, router, options = {}) => {
251
145
  const route = options.route || "User Profile Root";
252
146
  router.addRoute(route, notifications_router.default);
253
147
  store.addStore("notifications", notifications_store);
254
148
  if (options.wsUrl) {
255
149
  globals_websocket.default.initialize({ wsUrl: options.wsUrl });
256
150
  }
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;
264
151
  const isServer = typeof window === "undefined";
265
152
  const autoInit = !isServer && options.autoInit !== false;
153
+ let notificationManager = null;
266
154
  if (autoInit) {
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 {
155
+ const initNotifications = async () => {
156
+ var _a;
157
+ if (store.auth.state.isAuthenticated && ((_a = store.auth.state.user) == null ? void 0 : _a._id)) {
158
+ notificationManager = await notificationUtils.initialize(store, {
159
+ enablePush: options.enablePush !== false,
160
+ maxReconnectAttempts: options.maxReconnectAttempts || 5,
161
+ reconnectDelay: options.reconnectDelay || 3e3,
162
+ pingInterval: options.pingInterval || 3e4
163
+ });
164
+ }
165
+ };
166
+ vue.watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {
167
+ if (isAuthenticated) {
168
+ initNotifications();
169
+ } else if (notificationManager) {
276
170
  notificationManager.disconnect();
277
171
  store.notifications.mutations.resetNotifications();
172
+ notificationManager = null;
278
173
  }
279
174
  });
175
+ if (store.auth.state.isAuthenticated) {
176
+ initNotifications();
177
+ }
280
178
  }
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
- }
179
+ app.provide("useNotifications", () => ({
180
+ ...vue.toRefs(store.notifications.state),
181
+ ...store.notifications.actions,
182
+ ...store.notifications.mutations,
183
+ init: () => notificationUtils.initialize(store, options),
184
+ disconnect: () => notificationManager == null ? void 0 : notificationManager.disconnect(),
185
+ isServer
186
+ }));
187
+ return {
188
+ SSR: { prefetchNotifications: notificationUtils.prefetchForSSR }
189
+ };
190
+ };
293
191
  const ModuleNotifications = {
294
192
  initialize: initializeNotifications,
295
- SSR: SSRUtils,
296
- // Export SSR utilities
297
193
  views: {
298
- store: {
299
- storeNotifications: notifications_store
300
- },
301
- router: {
302
- routerNotifications: notifications_router.default
303
- },
194
+ store: { storeNotifications: notifications_store },
195
+ router: { routerNotifications: notifications_router.default },
304
196
  components: {
305
- // Elements
306
197
  NotificationBadge: NotificationBadge.default,
307
- // Blocks
308
198
  NotificationItem: NotificationItem.default,
309
- // Sections
310
199
  NotificationsList: NotificationsList.default,
311
200
  NotificationPreferences: NotificationPreferences.default,
312
- // Pages
313
201
  Notifications: Notifications.default,
314
- // Layouts
315
202
  NotificationsLayout: NotificationsLayout.default
316
203
  }
317
204
  }
@@ -322,6 +209,6 @@ exports.NotificationPreferences = NotificationPreferences.default;
322
209
  exports.Notifications = Notifications.default;
323
210
  exports.NotificationBadge = NotificationBadge.default;
324
211
  exports.NotificationItem = NotificationItem.default;
325
- exports.SSRUtils = SSRUtils;
212
+ exports.SSRUtils = notificationUtils;
326
213
  exports.default = ModuleNotifications;
327
214
  //# 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\";\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;"],"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,EAKE,QAAQ,QAAQ;AAEd,QAAI,OAAO,WAAW,eAAe,CAAC,QAAQ;AAC5C,aAAO,QAAQ,QAAQ,KAAK;AAAA,IAClC;AAGI,WAAOA,kBAAe,QAAC,QAAQ,MAAM,EAAE,KAAK,MAAM;AAEhD,WAAK,mBAAoB;AACzB,aAAO;AAAA,IACb,CAAK;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKE,aAAa;AACXA,8BAAgB,sBAAsB,KAAK,UAAU;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA,EAKE,qBAAqB;AAEnB,SAAK,UAAU;AAAA,MACbA,kBAAe,QAAC,iBAAiB,gBAAgB,KAAK,qBAAqB,KAAK,IAAI,GAAG;AAAA,QACrF,QAAQ,KAAK;AAAA,MACd,CAAA;AAAA,IACF;AAGD,SAAK,UAAU;AAAA,MACbA,kBAAAA,QAAgB,iBAAiB,qBAAqB,CAAC,SAAS;AAC9D,aAAK,MAAM,cAAc,QAAQ,uBAAuB,KAAK,gBAAgB,MAAM;AAAA,MAC3F,GAAS,EAAE,QAAQ,KAAK,WAAY,CAAA;AAAA,IAC/B;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKE,qBAAqB,MAAM;AACzB,QAAI,CAAC,QAAQ,CAAC,KAAK,KAAM;AAEzB,UAAM,eAAe,KAAK;AAG1B,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MAAM;AACpC,WAAO;AAAA,MACL,GAAGC,WAAO,MAAM,cAAc,KAAK;AAAA,MACnC,GAAG,MAAM,cAAc;AAAA,MACvB,GAAG,MAAM,cAAc;AAAA,MACvB,MAAM,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MAC7D,YAAY,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MACnE;AAAA,IACD;AAAA,EACL,CAAG;AAED,SAAO;AACT;AAGK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMH;AAAAA,IACD;AAAA,IACD,QAAQ;AAAA,MACND,qBAAAA,qBAAAA;AAAAA,IACD;AAAA,IACD,YAAY;AAAA;AAAA,MAEhB,mBAAMK,kBAAiB;AAAA;AAAA,MAEvB,kBAAMC,iBAAgB;AAAA;AAAA,MAEtB,mBAAMC,kBAAiB;AAAA,MACvB,yBAAMC,wBAAuB;AAAA;AAAA,MAE7B,eAAMC,cAAa;AAAA;AAAA,MAEbC,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\";\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,QAAQ,QAAQ,KAAK;AAE1E,WAAOA,kBAAe,QAAC,QAAQ,MAAM,EAAE,KAAK,MAAM;AAChD,YAAM,aAAa;AACnB,YAAM,YAAY,CAAE;AAEpB,YAAM,cAAc,CAAC,OAAO,YAAY;AACtC,kBAAU,KAAKA,kBAAe,QAAC,iBAAiB,OAAO,SAAS,EAAE,QAAQ,WAAU,CAAE,CAAC;AA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