@ozdao/martyrs 0.2.511 → 0.2.512

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 (307) hide show
  1. package/dist/martyrs/src/components/Button/{Button.vue2.cjs → Button.vue.cjs} +3 -3
  2. package/dist/martyrs/src/components/Button/{Button.vue2.js.map → Button.vue.cjs.map} +1 -1
  3. package/dist/martyrs/src/components/Button/{Button.vue2.js → Button.vue.js} +3 -3
  4. package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -0
  5. package/dist/martyrs/src/components/Chips/{Chips.vue2.cjs → Chips.vue.cjs} +2 -2
  6. package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +1 -0
  7. package/dist/martyrs/src/components/Chips/{Chips.vue2.js → Chips.vue.js} +2 -2
  8. package/dist/martyrs/src/components/Chips/Chips.vue.js.map +1 -0
  9. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.cjs → Dropdown.vue.cjs} +2 -2
  10. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.js.map → Dropdown.vue.cjs.map} +1 -1
  11. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.js → Dropdown.vue.js} +2 -2
  12. package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +1 -0
  13. package/dist/martyrs/src/components/Feed/Carousel.vue.cjs +1 -1
  14. package/dist/martyrs/src/components/Feed/Carousel.vue.js +1 -1
  15. package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
  16. package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
  17. package/dist/martyrs/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  18. package/dist/martyrs/src/components/FieldBig/FieldBig.vue.js +1 -1
  19. package/dist/martyrs/src/components/Loader/{Loader.vue.cjs → Loader.vue2.cjs} +2 -2
  20. package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +1 -0
  21. package/dist/martyrs/src/components/Loader/{Loader.vue.js → Loader.vue2.js} +2 -2
  22. package/dist/martyrs/src/components/Loader/{Loader.vue.cjs.map → Loader.vue2.js.map} +1 -1
  23. package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
  24. package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.js +1 -1
  25. package/dist/martyrs/src/components/Menu/{Menu.vue.cjs → Menu.vue2.cjs} +2 -2
  26. package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +1 -0
  27. package/dist/martyrs/src/components/Menu/{Menu.vue.js → Menu.vue2.js} +2 -2
  28. package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +1 -0
  29. package/dist/martyrs/src/components/Select/{Select.vue.cjs → Select.vue2.cjs} +2 -2
  30. package/dist/martyrs/src/components/Select/Select.vue2.cjs.map +1 -0
  31. package/dist/martyrs/src/components/Select/{Select.vue.js → Select.vue2.js} +2 -2
  32. package/dist/martyrs/src/components/Select/{Select.vue.cjs.map → Select.vue2.js.map} +1 -1
  33. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
  34. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
  35. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
  36. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
  37. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
  38. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
  39. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +3 -3
  40. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +3 -3
  41. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
  42. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
  43. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.cjs +1 -1
  44. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.js +1 -1
  45. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.cjs +1 -1
  46. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.js +1 -1
  47. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
  48. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
  49. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
  50. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
  51. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
  52. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
  53. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs +1 -1
  54. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
  55. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
  56. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
  57. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  58. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +1 -1
  59. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +3 -3
  60. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +3 -3
  61. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  62. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
  63. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  64. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  65. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  66. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
  67. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  68. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  69. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +2 -2
  70. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +2 -2
  71. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  72. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
  73. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +3 -3
  74. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +3 -3
  75. package/dist/martyrs/src/modules/events/components/sections/Feed.vue.cjs +1 -1
  76. package/dist/martyrs/src/modules/events/components/sections/Feed.vue.js +1 -1
  77. package/dist/martyrs/src/modules/events/components/sections/List.vue.cjs +1 -1
  78. package/dist/martyrs/src/modules/events/components/sections/List.vue.js +1 -1
  79. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +3 -3
  80. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
  81. package/dist/martyrs/src/modules/globals/globals.client.cjs +4 -1
  82. package/dist/martyrs/src/modules/globals/globals.client.cjs.map +1 -1
  83. package/dist/martyrs/src/modules/globals/globals.client.js +23 -20
  84. package/dist/martyrs/src/modules/globals/globals.client.js.map +1 -1
  85. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +2 -2
  86. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +2 -2
  87. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.cjs +1 -1
  88. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.js +1 -1
  89. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +2 -2
  90. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +2 -2
  91. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +2 -2
  92. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
  93. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +2 -2
  94. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
  95. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +2 -2
  96. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +2 -2
  97. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
  98. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
  99. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
  100. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
  101. package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs +308 -0
  102. package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs.map +1 -0
  103. package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.js +308 -0
  104. package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.js.map +1 -0
  105. package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +1 -1
  106. package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +1 -1
  107. package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs +1 -1
  108. package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +1 -1
  109. package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs +3 -3
  110. package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js +2 -2
  111. package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +3 -3
  112. package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +3 -3
  113. package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs +1 -1
  114. package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js +1 -1
  115. package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.cjs +1 -1
  116. package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.js +1 -1
  117. package/dist/martyrs/src/modules/music/components/cards/ArtistCardSmall.vue.cjs +1 -1
  118. package/dist/martyrs/src/modules/music/components/cards/ArtistCardSmall.vue.js +1 -1
  119. package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.cjs +1 -1
  120. package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.js +1 -1
  121. package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.cjs +1 -1
  122. package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.js +1 -1
  123. package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs +2 -2
  124. package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +2 -2
  125. package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +3 -3
  126. package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +3 -3
  127. package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.cjs +1 -1
  128. package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js +1 -1
  129. package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.cjs +1 -1
  130. package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.js +1 -1
  131. package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs +2 -2
  132. package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +2 -2
  133. package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +3 -3
  134. package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +3 -3
  135. package/dist/martyrs/src/modules/music/components/pages/Artist.vue.cjs +2 -2
  136. package/dist/martyrs/src/modules/music/components/pages/Artist.vue.js +2 -2
  137. package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.cjs +1 -1
  138. package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.js +1 -1
  139. package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +3 -3
  140. package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +3 -3
  141. package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.cjs +2 -2
  142. package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.js +2 -2
  143. package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +3 -3
  144. package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +3 -3
  145. package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.cjs +1 -1
  146. package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.js +1 -1
  147. package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.cjs +1 -1
  148. package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.js +1 -1
  149. package/dist/martyrs/src/modules/music/router/music.cjs +2 -2
  150. package/dist/martyrs/src/modules/music/router/music.js +2 -2
  151. package/dist/martyrs/src/modules/notifications/notifications.client.cjs +101 -32
  152. package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
  153. package/dist/martyrs/src/modules/notifications/notifications.client.js +101 -32
  154. package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
  155. package/dist/martyrs/src/modules/notifications/store/notifications.store.cjs +45 -12
  156. package/dist/martyrs/src/modules/notifications/store/notifications.store.cjs.map +1 -1
  157. package/dist/martyrs/src/modules/notifications/store/notifications.store.js +38 -5
  158. package/dist/martyrs/src/modules/notifications/store/notifications.store.js.map +1 -1
  159. package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.cjs +2 -2
  160. package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +2 -2
  161. package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.cjs +2 -2
  162. package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +2 -2
  163. package/dist/martyrs/src/modules/orders/components/forms/FormSelectCustomer.vue.cjs +2 -2
  164. package/dist/martyrs/src/modules/orders/components/forms/FormSelectCustomer.vue.js +2 -2
  165. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +2 -2
  166. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +2 -2
  167. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
  168. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
  169. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  170. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
  171. package/dist/martyrs/src/modules/orders/components/sections/ApplicationDetails.vue.cjs +1 -1
  172. package/dist/martyrs/src/modules/orders/components/sections/ApplicationDetails.vue.js +1 -1
  173. package/dist/martyrs/src/modules/orders/components/sections/CustomerDetails.vue.cjs +1 -1
  174. package/dist/martyrs/src/modules/orders/components/sections/CustomerDetails.vue.js +1 -1
  175. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +2 -2
  176. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +2 -2
  177. package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  178. package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  179. package/dist/martyrs/src/modules/orders/store/shopcart.cjs +33 -23
  180. package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
  181. package/dist/martyrs/src/modules/orders/store/shopcart.js +31 -21
  182. package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
  183. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  184. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  185. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  186. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  187. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +3 -3
  188. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
  189. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  190. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +1 -1
  191. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +3 -3
  192. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +3 -3
  193. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
  194. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  195. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
  196. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
  197. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +2 -2
  198. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  199. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +2 -2
  200. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  201. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -2
  202. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
  203. package/dist/martyrs/src/modules/organizations/router/organizations.cjs +1 -1
  204. package/dist/martyrs/src/modules/organizations/router/organizations.js +1 -1
  205. package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -1
  206. package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
  207. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
  208. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
  209. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
  210. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
  211. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +1 -1
  212. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +1 -1
  213. package/dist/martyrs/src/modules/products/components/elements/Image360.vue.cjs +1 -1
  214. package/dist/martyrs/src/modules/products/components/elements/Image360.vue.js +1 -1
  215. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  216. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +1 -1
  217. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +4 -4
  218. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +4 -4
  219. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -1
  220. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
  221. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
  222. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
  223. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
  224. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
  225. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.cjs +1 -1
  226. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.js +1 -1
  227. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +2 -2
  228. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +2 -2
  229. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +2 -2
  230. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +2 -2
  231. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.cjs +1 -1
  232. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.js +1 -1
  233. package/dist/martyrs/src/modules/products/components/sections/ProductsRecommended.vue.cjs +1 -1
  234. package/dist/martyrs/src/modules/products/components/sections/ProductsRecommended.vue.js +1 -1
  235. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  236. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  237. package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +2 -2
  238. package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +2 -2
  239. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +2 -2
  240. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  241. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  242. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  243. package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
  244. package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
  245. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  246. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
  247. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs +1 -1
  248. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
  249. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +2 -2
  250. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +2 -2
  251. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +2 -2
  252. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +2 -2
  253. package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
  254. package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
  255. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +4 -4
  256. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +4 -4
  257. package/dist/martyrs.css +1 -1
  258. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/index.cjs +8 -0
  259. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/index.cjs.map +1 -0
  260. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/index.js +8 -0
  261. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/index.js.map +1 -0
  262. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/web.cjs +13 -0
  263. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/web.cjs.map +1 -0
  264. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/web.js +13 -0
  265. package/dist/node_modules/.pnpm/capacitor-plugin-app-tracking-transparency@2.0.5_@capacitor_core@7.2.0/node_modules/capacitor-plugin-app-tracking-transparency/dist/esm/web.js.map +1 -0
  266. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.cjs +43 -0
  267. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.cjs.map +1 -0
  268. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +43 -0
  269. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
  270. package/dist/node_modules/.pnpm/embla-carousel-vue@8.6.0_vue@3.5.13_typescript@5.8.3_/node_modules/embla-carousel-vue/esm/embla-carousel-vue.esm.cjs +43 -0
  271. package/dist/node_modules/.pnpm/embla-carousel-vue@8.6.0_vue@3.5.13_typescript@5.8.3_/node_modules/embla-carousel-vue/esm/embla-carousel-vue.esm.cjs.map +1 -0
  272. package/dist/node_modules/.pnpm/embla-carousel-vue@8.6.0_vue@3.5.13_typescript@5.8.3_/node_modules/embla-carousel-vue/esm/embla-carousel-vue.esm.js +43 -0
  273. package/dist/node_modules/.pnpm/embla-carousel-vue@8.6.0_vue@3.5.13_typescript@5.8.3_/node_modules/embla-carousel-vue/esm/embla-carousel-vue.esm.js.map +1 -0
  274. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.cjs +1630 -0
  275. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.cjs.map +1 -0
  276. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1630 -0
  277. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
  278. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.cjs +1 -1
  279. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
  280. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.cjs +1 -1
  281. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
  282. package/dist/notifications.server.cjs +205 -11
  283. package/dist/notifications.server.js +205 -11
  284. package/dist/style.css +198 -189
  285. package/package.json +1 -1
  286. package/src/components/Button/Button.vue +2 -2
  287. package/src/modules/globals/globals.client.js +4 -0
  288. package/src/modules/globals/views/components/layouts/Client.vue +1 -0
  289. package/src/modules/globals/views/components/sections/Walkthrough.vue +245 -57
  290. package/src/modules/notifications/FIXES.md +1 -0
  291. package/src/modules/notifications/controllers/notifications.controller.js +147 -7
  292. package/src/modules/notifications/models/user-device.model.js +10 -2
  293. package/src/modules/notifications/notifications.client.js +127 -41
  294. package/src/modules/notifications/routes/notifications.routes.js +4 -0
  295. package/src/modules/notifications/services/notification.service.js +93 -0
  296. package/src/modules/notifications/store/notifications.store.js +47 -7
  297. package/src/modules/orders/store/shopcart.js +34 -23
  298. package/src/modules/products/migrations/categories-to-materialized-path.js +0 -3
  299. package/src/styles/base/backgrounds.scss +1 -0
  300. package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +0 -1
  301. package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +0 -1
  302. package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +0 -1
  303. package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +0 -1
  304. package/dist/martyrs/src/components/Loader/Loader.vue.js.map +0 -1
  305. package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +0 -1
  306. package/dist/martyrs/src/components/Menu/Menu.vue.js.map +0 -1
  307. package/dist/martyrs/src/components/Select/Select.vue.js.map +0 -1
@@ -4,11 +4,11 @@ require("vue");
4
4
  require("vue-router");
5
5
  require("../../globals/views/store/globals.cjs");
6
6
  ;/* empty css */
7
- ;/* empty css */
8
7
  ;/* empty css */
8
+ ;/* empty css */
9
9
  ;/* empty css */
10
10
  ;/* empty css */
11
- ;/* empty css */
11
+ ;/* empty css */
12
12
  ;/* empty css */
13
13
  ;/* empty css */
14
14
  ;/* empty css */
@@ -2,11 +2,11 @@ import "vue";
2
2
  import "vue-router";
3
3
  import "../../globals/views/store/globals.js";
4
4
  /* empty css */
5
- /* empty css */
6
5
  /* empty css */
6
+ /* empty css */
7
7
  /* empty css */
8
8
  /* empty css */
9
- /* empty css */
9
+ /* empty css */
10
10
  /* empty css */
11
11
  /* empty css */
12
12
  /* empty css */
@@ -4,6 +4,7 @@ const vue = require("vue");
4
4
  const notifications_router = require("./router/notifications.router.cjs");
5
5
  const notifications_store = require("./store/notifications.store.cjs");
6
6
  const globals_websocket = require("../globals/views/classes/globals.websocket.cjs");
7
+ const index = require("../../../node_modules/.pnpm/@capacitor_preferences@7.0.1_@capacitor_core@7.2.0/node_modules/@capacitor/preferences/dist/esm/index.cjs");
7
8
  const NotificationsLayout = require("./components/layouts/NotificationsLayout.vue.cjs");
8
9
  const NotificationPreferences = require("./components/sections/NotificationPreferences.vue.cjs");
9
10
  const NotificationsList = require("./components/sections/NotificationsList.vue.cjs");
@@ -86,6 +87,27 @@ class CapacitorPushHandler {
86
87
  deviceType: deviceInfo.platform.toLowerCase(),
87
88
  deviceToken: token.value
88
89
  };
90
+ if (!this.store.auth.state.user?._id) {
91
+ let anonymousId = null;
92
+ try {
93
+ const result = await index.Preferences.get({ key: "notifications_anonymous_id" });
94
+ anonymousId = result.value;
95
+ } catch (error) {
96
+ console.warn("Could not get anonymous ID from preferences:", error);
97
+ }
98
+ if (!anonymousId) {
99
+ anonymousId = "anon_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
100
+ try {
101
+ await index.Preferences.set({
102
+ key: "notifications_anonymous_id",
103
+ value: anonymousId
104
+ });
105
+ } catch (error) {
106
+ console.warn("Could not save anonymous ID to preferences:", error);
107
+ }
108
+ }
109
+ deviceData.anonymousId = anonymousId;
110
+ }
89
111
  await this.store.notifications.actions.registerDevice(deviceData);
90
112
  } catch (error) {
91
113
  console.error("Error handling push registration:", error);
@@ -145,39 +167,89 @@ class NotificationManager {
145
167
  applicationServerKey: "BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg"
146
168
  });
147
169
  console.log("New subscription:", JSON.stringify(subscription));
148
- await store.notifications.actions.registerDevice({
149
- deviceToken: JSON.stringify(subscription),
150
- deviceType: "web"
151
- });
170
+ const deviceToken = JSON.stringify(subscription);
171
+ const deviceId = await this.generateDeviceId();
172
+ try {
173
+ await index.Preferences.set({
174
+ key: "notifications_device_token",
175
+ value: deviceToken
176
+ });
177
+ } catch (error) {
178
+ console.warn("Could not save device token to preferences:", error);
179
+ }
180
+ const deviceData = {
181
+ deviceToken,
182
+ deviceType: "web",
183
+ deviceId
184
+ };
185
+ if (!store.auth.state.user?._id) {
186
+ let anonymousId = null;
187
+ try {
188
+ const result = await index.Preferences.get({ key: "notifications_anonymous_id" });
189
+ anonymousId = result.value;
190
+ } catch (error) {
191
+ console.warn("Could not get anonymous ID from preferences:", error);
192
+ }
193
+ if (!anonymousId) {
194
+ anonymousId = "anon_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
195
+ try {
196
+ await index.Preferences.set({
197
+ key: "notifications_anonymous_id",
198
+ value: anonymousId
199
+ });
200
+ } catch (error) {
201
+ console.warn("Could not save anonymous ID to preferences:", error);
202
+ }
203
+ }
204
+ deviceData.anonymousId = anonymousId;
205
+ }
206
+ await store.notifications.actions.registerDevice(deviceData);
207
+ }
208
+ async generateDeviceId() {
209
+ try {
210
+ const result = await index.Preferences.get({ key: "notifications_device_id" });
211
+ let deviceId = result.value;
212
+ if (!deviceId) {
213
+ deviceId = "web_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
214
+ await index.Preferences.set({
215
+ key: "notifications_device_id",
216
+ value: deviceId
217
+ });
218
+ }
219
+ return deviceId;
220
+ } catch (error) {
221
+ console.warn("Could not access preferences for device ID:", error);
222
+ return "web_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
223
+ }
152
224
  }
153
225
  async initialize() {
154
226
  if (this.initialized || this.isServer) return;
155
227
  const userId = this.store.auth.state.user?._id;
156
- if (!userId) {
157
- console.warn("Cannot initialize notifications: No user ID found in auth store");
158
- return;
228
+ if (userId) {
229
+ console.log("Connecting to websockets via notifications");
230
+ globals_websocket.default.initialize({
231
+ maxReconnectAttempts: 10,
232
+ reconnectDelay: 2e3
233
+ });
234
+ await globals_websocket.default.connect(userId);
235
+ globals_websocket.default.removeModuleListeners("notification");
236
+ await globals_websocket.default.subscribeModule("notification");
237
+ globals_websocket.default.addEventListener(
238
+ "notification",
239
+ (data) => {
240
+ this.store.notifications.actions.addLocalNotification(data.data);
241
+ },
242
+ { module: "notification" }
243
+ );
244
+ await this.store.notifications.actions.getNotifications(userId);
245
+ } else {
246
+ console.log("Initializing notifications for anonymous user");
159
247
  }
160
- console.log("Connecting to websockets via notifications");
161
- globals_websocket.default.initialize({
162
- maxReconnectAttempts: 10,
163
- reconnectDelay: 2e3
164
- });
165
- await globals_websocket.default.connect(userId);
166
- globals_websocket.default.removeModuleListeners("notification");
167
- await globals_websocket.default.subscribeModule("notification");
168
- globals_websocket.default.addEventListener(
169
- "notification",
170
- (data) => {
171
- this.store.notifications.actions.addLocalNotification(data.data);
172
- },
173
- { module: "notification" }
174
- );
175
- if (this.options.enablePush !== false) {
248
+ if (this.options.enablePush !== false && !process.env.MOBILE_APP) {
176
249
  await this.pushHandler.requestPermissions();
177
250
  await this.registerWebPush(this.store);
178
251
  }
179
252
  this.initialized = true;
180
- await this.store.notifications.actions.getNotifications(userId);
181
253
  }
182
254
  disconnect() {
183
255
  if (this.isServer) return;
@@ -220,18 +292,15 @@ function initializeNotifications(app, store, router, options = {}) {
220
292
  const isServer = typeof window === "undefined";
221
293
  const autoInit = !isServer && options.autoInit !== false;
222
294
  if (autoInit) {
223
- const isAuthenticated = store.auth.state.access.status;
224
- const userId = store.auth.state.user?._id;
225
- if (isAuthenticated && userId) {
226
- notificationManager.initialize();
227
- }
295
+ notificationManager.initialize();
228
296
  vue.watch(
229
297
  () => store.auth.state.access.status,
230
- (isAuthenticated2) => {
231
- if (isAuthenticated2) {
298
+ (isAuthenticated) => {
299
+ if (isAuthenticated) {
300
+ store.notifications.actions.reregisterDeviceAfterLogin();
301
+ notificationManager.disconnect();
232
302
  notificationManager.initialize();
233
303
  } else {
234
- notificationManager.disconnect();
235
304
  store.notifications.mutations.resetNotifications();
236
305
  }
237
306
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.client.cjs","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { toRefs, watch } 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\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 NotificationPreferences from './components/sections/NotificationPreferences.vue';\nimport NotificationsList from './components/sections/NotificationsList.vue';\n// Pages\nimport Notifications from './components/pages/Notifications.vue';\n// Components\nimport NotificationItem from './components/blocks/NotificationItem.vue';\nimport NotificationBadge from './components/elements/NotificationBadge.vue';\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', this._handleRegistration.bind(this));\n\n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived', this._handleNotificationReceived.bind(this));\n\n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed', this._handleNotificationAction.bind(this));\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(actionData.notification.data);\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 */\n\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n async registerWebPush(store) {\n if (!('Notification' in window) || !('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('Web Push не поддерживается в браузере');\n return;\n }\n\n const permission = await Notification.requestPermission();\n if (permission !== 'granted') {\n console.warn('Разрешение на уведомления не получено');\n return;\n }\n\n const registration = await navigator.serviceWorker.ready;\n const subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: 'BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg',\n });\n\n console.log('New subscription:', JSON.stringify(subscription));\n\n // Отправь подписку на сервер\n await store.notifications.actions.registerDevice({\n deviceToken: JSON.stringify(subscription),\n deviceType: 'web',\n });\n }\n\n async initialize() {\n if (this.initialized || this.isServer) return;\n\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 \n console.log('Connecting to websockets via notifications');\n globalWebSocket.initialize({\n maxReconnectAttempts: 10,\n reconnectDelay: 2000,\n });\n\n await globalWebSocket.connect(userId);\n\n globalWebSocket.removeModuleListeners('notification');\n\n await globalWebSocket.subscribeModule('notification');\n\n globalWebSocket.addEventListener(\n 'notification',\n data => {\n this.store.notifications.actions.addLocalNotification(data.data);\n },\n { module: 'notification' }\n );\n\n // 🎯 Опционально включаем push\n if (this.options.enablePush !== false) {\n await this.pushHandler.requestPermissions();\n await this.registerWebPush(this.store);\n }\n\n this.initialized = true;\n\n // ✅ Загружаем список уведомлений из API\n await this.store.notifications.actions.getNotifications(userId);\n }\n\n disconnect() {\n if (this.isServer) return;\n\n globalWebSocket.removeModuleListeners('notification');\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: app.config.globalProperties.WSS_URL });\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.access.status;\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(\n () => store.auth.state.access.status,\n isAuthenticated => {\n if (isAuthenticated) {\n notificationManager.initialize();\n } else {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n }\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 NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // Sections\n NotificationsList,\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":";;;;;;;;;;;;AAsBA,MAAM,qBAAqB;AAAA,EACzB,YAAY,OAAO;AACjB,SAAK,QAAQ;AACb,SAAK,oBAAoB;AACzB,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa;AAEjB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AAEF,YAAM,EAAE,UAAS,IAAK,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,+FAAiB,CAAA;AACpD,YAAM,EAAE,kBAAiB,IAAK,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,wJAA+B,CAAA;AAC1E,YAAM,EAAE,OAAM,IAAK,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,gIAAmB,CAAA;AAEnD,WAAK,YAAY;AACjB,WAAK,oBAAoB;AACzB,WAAK,SAAS;AAGd,UAAI,CA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A,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,IACN;AAAA,EACE,CAAC;AAED,SAAO;AACT;AAGK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMH;AAAAA,IACN;AAAA,IACI,QAAQ;AAAA,MACZ,qBAAMD,qBAAAA;AAAAA,IACN;AAAA,IACI,YAAY;AAAA;AAAA,MAEhB,mBAAMK,kBAAAA;AAAAA;AAAAA,MAEN,kBAAMC,iBAAAA;AAAAA;AAAAA,MAEN,mBAAMC,kBAAAA;AAAAA,MACN,yBAAMC,wBAAAA;AAAAA;AAAAA,MAEN,eAAMC,cAAAA;AAAAA;AAAAA,MAEN,qBAAMC,oBAAAA;AAAAA,IACN;AAAA,EACA;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"notifications.client.cjs","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { toRefs, watch } 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\n// Global WebSocket import\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\n// Capacitor Preferences\nimport { Preferences } from '@capacitor/preferences';\n// Layouts\nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue';\n// Sections\nimport NotificationPreferences from './components/sections/NotificationPreferences.vue';\nimport NotificationsList from './components/sections/NotificationsList.vue';\n// Pages\nimport Notifications from './components/pages/Notifications.vue';\n// Components\nimport NotificationItem from './components/blocks/NotificationItem.vue';\nimport NotificationBadge from './components/elements/NotificationBadge.vue';\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', this._handleRegistration.bind(this));\n\n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived', this._handleNotificationReceived.bind(this));\n\n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed', this._handleNotificationAction.bind(this));\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 // For anonymous users, add anonymousId\n if (!this.store.auth.state.user?._id) {\n let anonymousId = null;\n try {\n const result = await Preferences.get({ key: 'notifications_anonymous_id' });\n anonymousId = result.value;\n } catch (error) {\n console.warn('Could not get anonymous ID from preferences:', error);\n }\n \n if (!anonymousId) {\n anonymousId = 'anon_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n try {\n await Preferences.set({\n key: 'notifications_anonymous_id',\n value: anonymousId\n });\n } catch (error) {\n console.warn('Could not save anonymous ID to preferences:', error);\n }\n }\n deviceData.anonymousId = anonymousId;\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(actionData.notification.data);\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 */\n\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n async registerWebPush(store) {\n if (!('Notification' in window) || !('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('Web Push не поддерживается в браузере');\n return;\n }\n\n const permission = await Notification.requestPermission();\n if (permission !== 'granted') {\n console.warn('Разрешение на уведомления не получено');\n return;\n }\n\n const registration = await navigator.serviceWorker.ready;\n const subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: 'BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg',\n });\n\n console.log('New subscription:', JSON.stringify(subscription));\n\n const deviceToken = JSON.stringify(subscription);\n const deviceId = await this.generateDeviceId();\n \n // Store device data for re-registration after login\n try {\n await Preferences.set({\n key: 'notifications_device_token',\n value: deviceToken\n });\n } catch (error) {\n console.warn('Could not save device token to preferences:', error);\n }\n\n const deviceData = {\n deviceToken,\n deviceType: 'web',\n deviceId\n };\n\n // For anonymous users, get or generate anonymousId\n if (!store.auth.state.user?._id) {\n let anonymousId = null;\n try {\n const result = await Preferences.get({ key: 'notifications_anonymous_id' });\n anonymousId = result.value;\n } catch (error) {\n console.warn('Could not get anonymous ID from preferences:', error);\n }\n \n if (!anonymousId) {\n anonymousId = 'anon_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n try {\n await Preferences.set({\n key: 'notifications_anonymous_id',\n value: anonymousId\n });\n } catch (error) {\n console.warn('Could not save anonymous ID to preferences:', error);\n }\n }\n deviceData.anonymousId = anonymousId;\n }\n\n // Register device\n await store.notifications.actions.registerDevice(deviceData);\n }\n\n async generateDeviceId() {\n // Try to get or generate a persistent device ID\n try {\n const result = await Preferences.get({ key: 'notifications_device_id' });\n let deviceId = result.value;\n \n if (!deviceId) {\n deviceId = 'web_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n await Preferences.set({\n key: 'notifications_device_id',\n value: deviceId\n });\n }\n return deviceId;\n } catch (error) {\n console.warn('Could not access preferences for device ID:', error);\n return 'web_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n }\n }\n\n async initialize() {\n if (this.initialized || this.isServer) return;\n\n const userId = this.store.auth.state.user?._id;\n \n // Connect WebSocket only for authenticated users\n if (userId) {\n console.log('Connecting to websockets via notifications');\n globalWebSocket.initialize({\n maxReconnectAttempts: 10,\n reconnectDelay: 2000,\n });\n\n await globalWebSocket.connect(userId);\n\n globalWebSocket.removeModuleListeners('notification');\n\n await globalWebSocket.subscribeModule('notification');\n\n globalWebSocket.addEventListener(\n 'notification',\n data => {\n this.store.notifications.actions.addLocalNotification(data.data);\n },\n { module: 'notification' }\n );\n\n // Load notifications from API for authenticated users\n await this.store.notifications.actions.getNotifications(userId);\n } else {\n console.log('Initializing notifications for anonymous user');\n }\n\n // Enable push notifications for both authenticated and anonymous users\n // Skip auto-init for mobile apps - will be triggered manually from Walkthrough\n if (this.options.enablePush !== false && !process.env.MOBILE_APP) {\n await this.pushHandler.requestPermissions();\n await this.registerWebPush(this.store);\n }\n\n this.initialized = true;\n }\n\n disconnect() {\n if (this.isServer) return;\n\n globalWebSocket.removeModuleListeners('notification');\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: app.config.globalProperties.WSS_URL });\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 immediately (supports both authenticated and anonymous users)\n notificationManager.initialize();\n\n // Watch for user login/logout using auth store\n watch(\n () => store.auth.state.access.status,\n isAuthenticated => {\n if (isAuthenticated) {\n // Re-register device for authenticated user\n store.notifications.actions.reregisterDeviceAfterLogin();\n // Reinitialize for authenticated user\n notificationManager.disconnect();\n notificationManager.initialize();\n } else {\n // Keep notifications active for anonymous users, just reset user-specific data\n store.notifications.mutations.resetNotifications();\n }\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 NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // Sections\n NotificationsList,\n // SSR Utilities\n SSRUtils,\n};\n\nexport default ModuleNotifications;\n"],"names":["Preferences","globalWebSocket","routerNotifications","storeNotifications","watch","toRefs","NotificationBadge","NotificationItem","NotificationsList","NotificationPreferences","Notifications","NotificationsLayout"],"mappings":";;;;;;;;;;;;;AAwBA,MAAM,qBAAqB;AAAA,EACzB,YAAY,OAAO;AACjB,SAAK,QAAQ;AACb,SAAK,oBAAoB;AACzB,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM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AAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMF;AAAAA,IACN;AAAA,IACI,QAAQ;AAAA,MACZ,qBAAMD,qBAAAA;AAAAA,IACN;AAAA,IACI,YAAY;AAAA;AAAA,MAEhB,mBAAMI,kBAAAA;AAAAA;AAAAA,MAEN,kBAAMC,iBAAAA;AAAAA;AAAAA,MAEN,mBAAMC,kBAAAA;AAAAA,MACN,yBAAMC,wBAAAA;AAAAA;AAAAA,MAEN,eAAMC,cAAAA;AAAAA;AAAAA,MAEN,qBAAMC,oBAAAA;AAAAA,IACN;AAAA,EACA;AACA;;;;;;;;;"}
@@ -2,6 +2,7 @@ import { watch, toRefs } from "vue";
2
2
  import nofitications from "./router/notifications.router.js";
3
3
  import * as notifications_store from "./store/notifications.store.js";
4
4
  import globalWebSocket from "../globals/views/classes/globals.websocket.js";
5
+ import { Preferences } from "../../../node_modules/.pnpm/@capacitor_preferences@7.0.1_@capacitor_core@7.2.0/node_modules/@capacitor/preferences/dist/esm/index.js";
5
6
  import _sfc_main from "./components/layouts/NotificationsLayout.vue.js";
6
7
  import NotificationPreferences from "./components/sections/NotificationPreferences.vue.js";
7
8
  import NotificationsList from "./components/sections/NotificationsList.vue.js";
@@ -84,6 +85,27 @@ class CapacitorPushHandler {
84
85
  deviceType: deviceInfo.platform.toLowerCase(),
85
86
  deviceToken: token.value
86
87
  };
88
+ if (!this.store.auth.state.user?._id) {
89
+ let anonymousId = null;
90
+ try {
91
+ const result = await Preferences.get({ key: "notifications_anonymous_id" });
92
+ anonymousId = result.value;
93
+ } catch (error) {
94
+ console.warn("Could not get anonymous ID from preferences:", error);
95
+ }
96
+ if (!anonymousId) {
97
+ anonymousId = "anon_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
98
+ try {
99
+ await Preferences.set({
100
+ key: "notifications_anonymous_id",
101
+ value: anonymousId
102
+ });
103
+ } catch (error) {
104
+ console.warn("Could not save anonymous ID to preferences:", error);
105
+ }
106
+ }
107
+ deviceData.anonymousId = anonymousId;
108
+ }
87
109
  await this.store.notifications.actions.registerDevice(deviceData);
88
110
  } catch (error) {
89
111
  console.error("Error handling push registration:", error);
@@ -143,39 +165,89 @@ class NotificationManager {
143
165
  applicationServerKey: "BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg"
144
166
  });
145
167
  console.log("New subscription:", JSON.stringify(subscription));
146
- await store.notifications.actions.registerDevice({
147
- deviceToken: JSON.stringify(subscription),
148
- deviceType: "web"
149
- });
168
+ const deviceToken = JSON.stringify(subscription);
169
+ const deviceId = await this.generateDeviceId();
170
+ try {
171
+ await Preferences.set({
172
+ key: "notifications_device_token",
173
+ value: deviceToken
174
+ });
175
+ } catch (error) {
176
+ console.warn("Could not save device token to preferences:", error);
177
+ }
178
+ const deviceData = {
179
+ deviceToken,
180
+ deviceType: "web",
181
+ deviceId
182
+ };
183
+ if (!store.auth.state.user?._id) {
184
+ let anonymousId = null;
185
+ try {
186
+ const result = await Preferences.get({ key: "notifications_anonymous_id" });
187
+ anonymousId = result.value;
188
+ } catch (error) {
189
+ console.warn("Could not get anonymous ID from preferences:", error);
190
+ }
191
+ if (!anonymousId) {
192
+ anonymousId = "anon_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
193
+ try {
194
+ await Preferences.set({
195
+ key: "notifications_anonymous_id",
196
+ value: anonymousId
197
+ });
198
+ } catch (error) {
199
+ console.warn("Could not save anonymous ID to preferences:", error);
200
+ }
201
+ }
202
+ deviceData.anonymousId = anonymousId;
203
+ }
204
+ await store.notifications.actions.registerDevice(deviceData);
205
+ }
206
+ async generateDeviceId() {
207
+ try {
208
+ const result = await Preferences.get({ key: "notifications_device_id" });
209
+ let deviceId = result.value;
210
+ if (!deviceId) {
211
+ deviceId = "web_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
212
+ await Preferences.set({
213
+ key: "notifications_device_id",
214
+ value: deviceId
215
+ });
216
+ }
217
+ return deviceId;
218
+ } catch (error) {
219
+ console.warn("Could not access preferences for device ID:", error);
220
+ return "web_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
221
+ }
150
222
  }
151
223
  async initialize() {
152
224
  if (this.initialized || this.isServer) return;
153
225
  const userId = this.store.auth.state.user?._id;
154
- if (!userId) {
155
- console.warn("Cannot initialize notifications: No user ID found in auth store");
156
- return;
226
+ if (userId) {
227
+ console.log("Connecting to websockets via notifications");
228
+ globalWebSocket.initialize({
229
+ maxReconnectAttempts: 10,
230
+ reconnectDelay: 2e3
231
+ });
232
+ await globalWebSocket.connect(userId);
233
+ globalWebSocket.removeModuleListeners("notification");
234
+ await globalWebSocket.subscribeModule("notification");
235
+ globalWebSocket.addEventListener(
236
+ "notification",
237
+ (data) => {
238
+ this.store.notifications.actions.addLocalNotification(data.data);
239
+ },
240
+ { module: "notification" }
241
+ );
242
+ await this.store.notifications.actions.getNotifications(userId);
243
+ } else {
244
+ console.log("Initializing notifications for anonymous user");
157
245
  }
158
- console.log("Connecting to websockets via notifications");
159
- globalWebSocket.initialize({
160
- maxReconnectAttempts: 10,
161
- reconnectDelay: 2e3
162
- });
163
- await globalWebSocket.connect(userId);
164
- globalWebSocket.removeModuleListeners("notification");
165
- await globalWebSocket.subscribeModule("notification");
166
- globalWebSocket.addEventListener(
167
- "notification",
168
- (data) => {
169
- this.store.notifications.actions.addLocalNotification(data.data);
170
- },
171
- { module: "notification" }
172
- );
173
- if (this.options.enablePush !== false) {
246
+ if (this.options.enablePush !== false && !process.env.MOBILE_APP) {
174
247
  await this.pushHandler.requestPermissions();
175
248
  await this.registerWebPush(this.store);
176
249
  }
177
250
  this.initialized = true;
178
- await this.store.notifications.actions.getNotifications(userId);
179
251
  }
180
252
  disconnect() {
181
253
  if (this.isServer) return;
@@ -218,18 +290,15 @@ function initializeNotifications(app, store, router, options = {}) {
218
290
  const isServer = typeof window === "undefined";
219
291
  const autoInit = !isServer && options.autoInit !== false;
220
292
  if (autoInit) {
221
- const isAuthenticated = store.auth.state.access.status;
222
- const userId = store.auth.state.user?._id;
223
- if (isAuthenticated && userId) {
224
- notificationManager.initialize();
225
- }
293
+ notificationManager.initialize();
226
294
  watch(
227
295
  () => store.auth.state.access.status,
228
- (isAuthenticated2) => {
229
- if (isAuthenticated2) {
296
+ (isAuthenticated) => {
297
+ if (isAuthenticated) {
298
+ store.notifications.actions.reregisterDeviceAfterLogin();
299
+ notificationManager.disconnect();
230
300
  notificationManager.initialize();
231
301
  } else {
232
- notificationManager.disconnect();
233
302
  store.notifications.mutations.resetNotifications();
234
303
  }
235
304
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.client.js","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { toRefs, watch } 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\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 NotificationPreferences from './components/sections/NotificationPreferences.vue';\nimport NotificationsList from './components/sections/NotificationsList.vue';\n// Pages\nimport Notifications from './components/pages/Notifications.vue';\n// Components\nimport NotificationItem from './components/blocks/NotificationItem.vue';\nimport NotificationBadge from './components/elements/NotificationBadge.vue';\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', this._handleRegistration.bind(this));\n\n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived', this._handleNotificationReceived.bind(this));\n\n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed', this._handleNotificationAction.bind(this));\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(actionData.notification.data);\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 */\n\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n async registerWebPush(store) {\n if (!('Notification' in window) || !('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('Web Push не поддерживается в браузере');\n return;\n }\n\n const permission = await Notification.requestPermission();\n if (permission !== 'granted') {\n console.warn('Разрешение на уведомления не получено');\n return;\n }\n\n const registration = await navigator.serviceWorker.ready;\n const subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: 'BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg',\n });\n\n console.log('New subscription:', JSON.stringify(subscription));\n\n // Отправь подписку на сервер\n await store.notifications.actions.registerDevice({\n deviceToken: JSON.stringify(subscription),\n deviceType: 'web',\n });\n }\n\n async initialize() {\n if (this.initialized || this.isServer) return;\n\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 \n console.log('Connecting to websockets via notifications');\n globalWebSocket.initialize({\n maxReconnectAttempts: 10,\n reconnectDelay: 2000,\n });\n\n await globalWebSocket.connect(userId);\n\n globalWebSocket.removeModuleListeners('notification');\n\n await globalWebSocket.subscribeModule('notification');\n\n globalWebSocket.addEventListener(\n 'notification',\n data => {\n this.store.notifications.actions.addLocalNotification(data.data);\n },\n { module: 'notification' }\n );\n\n // 🎯 Опционально включаем push\n if (this.options.enablePush !== false) {\n await this.pushHandler.requestPermissions();\n await this.registerWebPush(this.store);\n }\n\n this.initialized = true;\n\n // ✅ Загружаем список уведомлений из API\n await this.store.notifications.actions.getNotifications(userId);\n }\n\n disconnect() {\n if (this.isServer) return;\n\n globalWebSocket.removeModuleListeners('notification');\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: app.config.globalProperties.WSS_URL });\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.access.status;\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(\n () => store.auth.state.access.status,\n isAuthenticated => {\n if (isAuthenticated) {\n notificationManager.initialize();\n } else {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n }\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 NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // Sections\n NotificationsList,\n // SSR Utilities\n SSRUtils,\n};\n\nexport default ModuleNotifications;\n"],"names":["routerNotifications","storeNotifications","isAuthenticated","Notifications","NotificationsLayout"],"mappings":";;;;;;;;;;AAsBA,MAAM,qBAAqB;AAAA,EACzB,YAAY,OAAO;AACjB,SAAK,QAAQ;AACb,SAAK,oBAAoB;AACzB,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa;AAEjB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AAEF,YAAM,EAAE,UAAS,IAAK,MAAM,OAAO,8FAAiB;AACpD,YAAM,EAAE,kBAAiB,IAAK,MAAM,OAAO,uJAA+B;AAC1E,YAAM,EAAE,OAAM,IAAK,MAAM,OAAO,+HAAmB;AAEnD,WAAK,YAAY;AACjB,WAAK,oBAAoB;AACzB,WAAK,SAAS;AAGd,UAAI,CAAC,KAAK,UAAU,oBAAoB;AACtC,eAAO;AAAA,M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D,YAAY,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MACnE;AAAA,IACN;AAAA,EACE,CAAC;AAED,SAAO;AACT;AAGK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMD;AAAAA,IACN;AAAA,IACI,QAAQ;AAAA,MACZ,qBAAMD;AAAAA,IACN;AAAA,IACI,YAAY;AAAA;AAAA,MAEV;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA;AAAA,MAEN,eAAMG;AAAAA;AAAAA,MAEN,qBAAMC;AAAAA,IACN;AAAA,EACA;AACA;"}
1
+ {"version":3,"file":"notifications.client.js","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { toRefs, watch } 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\n// Global WebSocket import\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\n// Capacitor Preferences\nimport { Preferences } from '@capacitor/preferences';\n// Layouts\nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue';\n// Sections\nimport NotificationPreferences from './components/sections/NotificationPreferences.vue';\nimport NotificationsList from './components/sections/NotificationsList.vue';\n// Pages\nimport Notifications from './components/pages/Notifications.vue';\n// Components\nimport NotificationItem from './components/blocks/NotificationItem.vue';\nimport NotificationBadge from './components/elements/NotificationBadge.vue';\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', this._handleRegistration.bind(this));\n\n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived', this._handleNotificationReceived.bind(this));\n\n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed', this._handleNotificationAction.bind(this));\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 // For anonymous users, add anonymousId\n if (!this.store.auth.state.user?._id) {\n let anonymousId = null;\n try {\n const result = await Preferences.get({ key: 'notifications_anonymous_id' });\n anonymousId = result.value;\n } catch (error) {\n console.warn('Could not get anonymous ID from preferences:', error);\n }\n \n if (!anonymousId) {\n anonymousId = 'anon_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n try {\n await Preferences.set({\n key: 'notifications_anonymous_id',\n value: anonymousId\n });\n } catch (error) {\n console.warn('Could not save anonymous ID to preferences:', error);\n }\n }\n deviceData.anonymousId = anonymousId;\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(actionData.notification.data);\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 */\n\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n async registerWebPush(store) {\n if (!('Notification' in window) || !('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('Web Push не поддерживается в браузере');\n return;\n }\n\n const permission = await Notification.requestPermission();\n if (permission !== 'granted') {\n console.warn('Разрешение на уведомления не получено');\n return;\n }\n\n const registration = await navigator.serviceWorker.ready;\n const subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: 'BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg',\n });\n\n console.log('New subscription:', JSON.stringify(subscription));\n\n const deviceToken = JSON.stringify(subscription);\n const deviceId = await this.generateDeviceId();\n \n // Store device data for re-registration after login\n try {\n await Preferences.set({\n key: 'notifications_device_token',\n value: deviceToken\n });\n } catch (error) {\n console.warn('Could not save device token to preferences:', error);\n }\n\n const deviceData = {\n deviceToken,\n deviceType: 'web',\n deviceId\n };\n\n // For anonymous users, get or generate anonymousId\n if (!store.auth.state.user?._id) {\n let anonymousId = null;\n try {\n const result = await Preferences.get({ key: 'notifications_anonymous_id' });\n anonymousId = result.value;\n } catch (error) {\n console.warn('Could not get anonymous ID from preferences:', error);\n }\n \n if (!anonymousId) {\n anonymousId = 'anon_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n try {\n await Preferences.set({\n key: 'notifications_anonymous_id',\n value: anonymousId\n });\n } catch (error) {\n console.warn('Could not save anonymous ID to preferences:', error);\n }\n }\n deviceData.anonymousId = anonymousId;\n }\n\n // Register device\n await store.notifications.actions.registerDevice(deviceData);\n }\n\n async generateDeviceId() {\n // Try to get or generate a persistent device ID\n try {\n const result = await Preferences.get({ key: 'notifications_device_id' });\n let deviceId = result.value;\n \n if (!deviceId) {\n deviceId = 'web_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n await Preferences.set({\n key: 'notifications_device_id',\n value: deviceId\n });\n }\n return deviceId;\n } catch (error) {\n console.warn('Could not access preferences for device ID:', error);\n return 'web_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n }\n }\n\n async initialize() {\n if (this.initialized || this.isServer) return;\n\n const userId = this.store.auth.state.user?._id;\n \n // Connect WebSocket only for authenticated users\n if (userId) {\n console.log('Connecting to websockets via notifications');\n globalWebSocket.initialize({\n maxReconnectAttempts: 10,\n reconnectDelay: 2000,\n });\n\n await globalWebSocket.connect(userId);\n\n globalWebSocket.removeModuleListeners('notification');\n\n await globalWebSocket.subscribeModule('notification');\n\n globalWebSocket.addEventListener(\n 'notification',\n data => {\n this.store.notifications.actions.addLocalNotification(data.data);\n },\n { module: 'notification' }\n );\n\n // Load notifications from API for authenticated users\n await this.store.notifications.actions.getNotifications(userId);\n } else {\n console.log('Initializing notifications for anonymous user');\n }\n\n // Enable push notifications for both authenticated and anonymous users\n // Skip auto-init for mobile apps - will be triggered manually from Walkthrough\n if (this.options.enablePush !== false && !process.env.MOBILE_APP) {\n await this.pushHandler.requestPermissions();\n await this.registerWebPush(this.store);\n }\n\n this.initialized = true;\n }\n\n disconnect() {\n if (this.isServer) return;\n\n globalWebSocket.removeModuleListeners('notification');\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: app.config.globalProperties.WSS_URL });\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 immediately (supports both authenticated and anonymous users)\n notificationManager.initialize();\n\n // Watch for user login/logout using auth store\n watch(\n () => store.auth.state.access.status,\n isAuthenticated => {\n if (isAuthenticated) {\n // Re-register device for authenticated user\n store.notifications.actions.reregisterDeviceAfterLogin();\n // Reinitialize for authenticated user\n notificationManager.disconnect();\n notificationManager.initialize();\n } else {\n // Keep notifications active for anonymous users, just reset user-specific data\n store.notifications.mutations.resetNotifications();\n }\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 NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // Sections\n NotificationsList,\n // SSR Utilities\n SSRUtils,\n};\n\nexport default ModuleNotifications;\n"],"names":["routerNotifications","storeNotifications","Notifications","NotificationsLayout"],"mappings":";;;;;;;;;;;AAwBA,MAAM,qBAAqB;AAAA,EACzB,YAAY,OAAO;AACjB,SAAK,QAAQ;AACb,SAAK,oBAAoB;AACzB,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa;AAEjB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AAEF,YAAM,EAAE,UAAS,IAAK,MAAM,OAAO,8FAAiB;AACpD,YAAM,EAAE,kBAAiB,IAAK,MAAM,OAAO,uJAA+B;AAC1E,YAAM,EAAE,OAAM,IAAK,MAAM,OAAO,+HAAmB;AAEnD,WAAK,YAAY;AACjB,WAAK,oBAAoB;AACzB,WAAK,SAAS;AAGd,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