@ozdao/martyrs 0.2.519 → 0.2.520

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 (341) hide show
  1. package/dist/chats.server.cjs +198 -1
  2. package/dist/chats.server.js +198 -1
  3. package/dist/{main-Wr1_4rwl.cjs → main-BM3GslOO.cjs} +6 -6
  4. package/dist/{main-DgGUrhjT.js → main-Qcn7YlTx.js} +1832 -1828
  5. package/dist/martyrs/src/components/Address/{Address.vue2.cjs → Address.vue.cjs} +2 -2
  6. package/dist/martyrs/src/components/Address/{Address.vue2.js.map → Address.vue.cjs.map} +1 -1
  7. package/dist/martyrs/src/components/Address/{Address.vue2.js → Address.vue.js} +2 -2
  8. package/dist/martyrs/src/components/Address/Address.vue.js.map +1 -0
  9. package/dist/martyrs/src/components/Feed/Feed.vue.cjs +0 -1
  10. package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
  11. package/dist/martyrs/src/components/Feed/Feed.vue.js +0 -1
  12. package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
  13. package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.cjs → LocationMarker.vue.cjs} +2 -2
  14. package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js.map → LocationMarker.vue.cjs.map} +1 -1
  15. package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js → LocationMarker.vue.js} +2 -2
  16. package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue.js.map +1 -0
  17. package/dist/martyrs/src/components/Select/{Select.vue2.cjs → Select.vue.cjs} +2 -2
  18. package/dist/martyrs/src/components/Select/{Select.vue2.js.map → Select.vue.cjs.map} +1 -1
  19. package/dist/martyrs/src/components/Select/{Select.vue2.js → Select.vue.js} +2 -2
  20. package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -0
  21. package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.cjs +2 -2
  22. package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.js +2 -2
  23. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
  24. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs.map +1 -1
  25. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
  26. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js.map +1 -1
  27. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
  28. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs.map +1 -1
  29. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +4 -4
  30. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js.map +1 -1
  31. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +40 -50
  32. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -1
  33. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +59 -69
  34. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
  35. package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs +11 -13
  36. package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs.map +1 -1
  37. package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js +11 -13
  38. package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js.map +1 -1
  39. package/dist/martyrs/src/modules/auth/views/store/auth.cjs +9 -0
  40. package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
  41. package/dist/martyrs/src/modules/auth/views/store/auth.js +9 -0
  42. package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
  43. package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs +27 -11
  44. package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs.map +1 -1
  45. package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js +28 -12
  46. package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js.map +1 -1
  47. package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +62 -0
  48. package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs.map +1 -1
  49. package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js +63 -1
  50. package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
  51. package/dist/martyrs/src/modules/chats/store/chat.store.cjs +60 -1
  52. package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
  53. package/dist/martyrs/src/modules/chats/store/chat.store.js +60 -1
  54. package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
  55. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs +3 -3
  56. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
  57. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +3 -3
  58. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js.map +1 -1
  59. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
  60. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
  61. package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs +50 -368
  62. package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs.map +1 -1
  63. package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js +53 -371
  64. package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js.map +1 -1
  65. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  66. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs.map +1 -1
  67. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
  68. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js.map +1 -1
  69. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +0 -1
  70. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
  71. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +0 -1
  72. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
  73. package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +2 -2
  74. package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs.map +1 -1
  75. package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +2 -2
  76. package/dist/martyrs/src/modules/events/components/pages/Events.vue.js.map +1 -1
  77. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  78. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  79. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
  80. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
  81. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
  82. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +1 -1
  83. package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.cjs +2 -2
  84. package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.js +2 -2
  85. package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs +1 -1
  86. package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs +7 -0
  87. package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs.map +1 -1
  88. package/dist/martyrs/src/modules/globals/views/mixins/mixins.js +7 -0
  89. package/dist/martyrs/src/modules/globals/views/mixins/mixins.js.map +1 -1
  90. package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs +1 -1
  91. package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +1 -1
  92. package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +1 -1
  93. package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs +1 -1
  94. package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +1 -1
  95. package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +1 -1
  96. package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +1 -1
  97. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs +180 -19
  98. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs.map +1 -1
  99. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js +181 -20
  100. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js.map +1 -1
  101. package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs +1 -1
  102. package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +1 -1
  103. package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +1 -1
  104. package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +1 -1
  105. package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs +1 -1
  106. package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +1 -1
  107. package/dist/martyrs/src/modules/music/router/music.cjs +0 -1
  108. package/dist/martyrs/src/modules/music/router/music.cjs.map +1 -1
  109. package/dist/martyrs/src/modules/music/router/music.js +0 -1
  110. package/dist/martyrs/src/modules/music/router/music.js.map +1 -1
  111. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs +2 -2
  112. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs.map +1 -1
  113. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js +2 -2
  114. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js.map +1 -1
  115. package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.cjs +1 -1
  116. package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +1 -1
  117. package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.cjs +1 -1
  118. package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +1 -1
  119. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  120. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
  121. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +2 -3
  122. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs.map +1 -1
  123. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +2 -3
  124. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js.map +1 -1
  125. package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  126. package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  127. package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +2 -24
  128. package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
  129. package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +5 -27
  130. package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
  131. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs +4 -1
  132. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs.map +1 -1
  133. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js +4 -1
  134. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js.map +1 -1
  135. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +3 -3
  136. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs.map +1 -1
  137. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +3 -3
  138. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js.map +1 -1
  139. package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs +195 -0
  140. package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs.map +1 -0
  141. package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js +195 -0
  142. package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js.map +1 -0
  143. package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs +402 -0
  144. package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs.map +1 -0
  145. package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +402 -0
  146. package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js.map +1 -0
  147. package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs +86 -0
  148. package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs.map +1 -0
  149. package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js +86 -0
  150. package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js.map +1 -0
  151. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs +10 -10
  152. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
  153. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +11 -11
  154. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
  155. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +279 -191
  156. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
  157. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +285 -197
  158. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
  159. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +5 -5
  160. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
  161. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +5 -5
  162. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
  163. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
  164. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs.map +1 -1
  165. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
  166. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js.map +1 -1
  167. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  168. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs.map +1 -1
  169. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  170. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js.map +1 -1
  171. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  172. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  173. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +3 -3
  174. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs.map +1 -1
  175. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  176. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js.map +1 -1
  177. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs +4 -4
  178. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs.map +1 -1
  179. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js +4 -4
  180. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js.map +1 -1
  181. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs +42 -41
  182. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs.map +1 -1
  183. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js +53 -52
  184. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js.map +1 -1
  185. package/dist/martyrs/src/modules/organizations/organizations.client.cjs +23 -16
  186. package/dist/martyrs/src/modules/organizations/organizations.client.cjs.map +1 -1
  187. package/dist/martyrs/src/modules/organizations/organizations.client.js +35 -28
  188. package/dist/martyrs/src/modules/organizations/organizations.client.js.map +1 -1
  189. package/dist/martyrs/src/modules/organizations/router/departments.router.cjs +0 -18
  190. package/dist/martyrs/src/modules/organizations/router/departments.router.cjs.map +1 -1
  191. package/dist/martyrs/src/modules/organizations/router/departments.router.js +0 -18
  192. package/dist/martyrs/src/modules/organizations/router/departments.router.js.map +1 -1
  193. package/dist/martyrs/src/modules/organizations/store/departments.store.cjs +6 -0
  194. package/dist/martyrs/src/modules/organizations/store/departments.store.cjs.map +1 -0
  195. package/dist/martyrs/src/modules/organizations/store/departments.store.js +6 -0
  196. package/dist/martyrs/src/modules/organizations/store/departments.store.js.map +1 -0
  197. package/dist/martyrs/src/modules/organizations/store/invites.store.cjs +6 -0
  198. package/dist/martyrs/src/modules/organizations/store/invites.store.cjs.map +1 -0
  199. package/dist/martyrs/src/modules/organizations/store/invites.store.js +6 -0
  200. package/dist/martyrs/src/modules/organizations/store/invites.store.js.map +1 -0
  201. package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs +20 -0
  202. package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs.map +1 -0
  203. package/dist/martyrs/src/modules/organizations/store/memberships.store.js +20 -0
  204. package/dist/martyrs/src/modules/organizations/store/memberships.store.js.map +1 -0
  205. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +2 -3
  206. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
  207. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +2 -3
  208. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
  209. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  210. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
  211. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
  212. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
  213. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
  214. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js.map +1 -1
  215. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +1 -1
  216. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +1 -1
  217. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +1 -1
  218. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +1 -1
  219. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  220. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  221. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +2 -2
  222. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs.map +1 -1
  223. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +2 -2
  224. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js.map +1 -1
  225. package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
  226. package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
  227. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +3 -3
  228. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +3 -3
  229. package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs +60 -272
  230. package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs.map +1 -1
  231. package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js +62 -274
  232. package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js.map +1 -1
  233. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +1 -1
  234. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +1 -1
  235. package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
  236. package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
  237. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +2 -2
  238. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
  239. package/dist/martyrs.cjs.js +1 -1
  240. package/dist/martyrs.css +1 -1
  241. package/dist/martyrs.es.js +1 -1
  242. package/dist/notifications.server.cjs +0 -24
  243. package/dist/notifications.server.js +0 -24
  244. package/dist/orders.server.cjs +1 -4
  245. package/dist/orders.server.js +1 -4
  246. package/dist/organizations.server.cjs +115 -39
  247. package/dist/organizations.server.js +115 -39
  248. package/dist/style.css +9 -9
  249. package/dist/{web-42I-Howt.cjs → web-B0cfxzgu.cjs} +1 -1
  250. package/dist/{web-ByhZ_fIu.js → web-DVR8m2fm.js} +1 -1
  251. package/package.json +1 -1
  252. package/src/components/Feed/Feed.old.vue +0 -1
  253. package/src/components/Feed/Feed.vue +0 -30
  254. package/src/modules/auth/FIXES.md +2 -26
  255. package/src/modules/auth/views/components/blocks/CardUser.vue +2 -2
  256. package/src/modules/auth/views/components/layouts/Auth.vue +1 -1
  257. package/src/modules/auth/views/components/pages/Invite.vue +2 -2
  258. package/src/modules/auth/views/components/pages/Profile.vue +33 -48
  259. package/src/modules/auth/views/components/sections/SliderFeatures.vue +5 -7
  260. package/src/modules/auth/views/store/auth.js +15 -0
  261. package/src/modules/chats/CLAUDE.md +137 -0
  262. package/src/modules/chats/components/blocks/ChatMessage.vue +12 -0
  263. package/src/modules/chats/components/sections/ChatWindow.vue +84 -2
  264. package/src/modules/chats/controllers/chats.controller.js +187 -0
  265. package/src/modules/chats/models/chat.model.js +21 -0
  266. package/src/modules/chats/routes/chats.routes.js +46 -0
  267. package/src/modules/chats/store/chat.store.js +67 -0
  268. package/src/modules/community/components/layouts/Community.vue +2 -2
  269. package/src/modules/community/components/pages/Posts.vue +3 -328
  270. package/src/modules/events/components/pages/EditEventTickets.vue +1 -1
  271. package/src/modules/events/components/pages/Events.vue +2 -2
  272. package/src/modules/globals/views/mixins/mixins.js +7 -0
  273. package/src/modules/marketplace/views/components/layouts/Marketplace.vue +160 -8
  274. package/src/modules/notifications/controllers/notifications.controller.js +0 -6
  275. package/src/modules/notifications/services/notification.service.js +1 -17
  276. package/src/modules/notifications/services/web-push.service.js +0 -2
  277. package/src/modules/orders/components/blocks/CardOrderBackoffice.vue +2 -2
  278. package/src/modules/orders/components/blocks/CardOrderVar1.vue +1 -1
  279. package/src/modules/orders/controllers/orders.controller.js +2 -4
  280. package/src/modules/organizations/CLAUDE.md +259 -0
  281. package/src/modules/organizations/components/blocks/CardDepartment.vue +1 -22
  282. package/src/modules/organizations/components/blocks/Socials.vue +1 -1
  283. package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +3 -3
  284. package/src/modules/organizations/components/forms/AddExistingMembersForm.vue +191 -0
  285. package/src/modules/organizations/components/forms/DepartmentForm.vue +390 -0
  286. package/src/modules/organizations/components/forms/InviteForm.vue +81 -0
  287. package/src/modules/organizations/components/pages/Department.vue +10 -10
  288. package/src/modules/organizations/components/pages/DepartmentEdit.vue +8 -8
  289. package/src/modules/organizations/components/pages/Members.vue +265 -171
  290. package/src/modules/organizations/components/pages/Organization.new.vue +172 -183
  291. package/src/modules/organizations/components/pages/Organization.vue +6 -6
  292. package/src/modules/organizations/components/pages/OrganizationEdit.vue +1 -1
  293. package/src/modules/organizations/components/pages/Organizations.vue +1 -1
  294. package/src/modules/organizations/components/sections/Organizations.vue +2 -2
  295. package/src/modules/organizations/components/sections/Publics.vue +4 -4
  296. package/src/modules/organizations/configs/navigation.organization.config.js +40 -39
  297. package/src/modules/organizations/controllers/departments.controller.js +53 -34
  298. package/src/modules/organizations/controllers/invites.controller.js +44 -5
  299. package/src/modules/organizations/controllers/memberships.controller.js +43 -4
  300. package/src/modules/organizations/organizations.client.js +24 -15
  301. package/src/modules/organizations/router/departments.router.js +0 -18
  302. package/src/modules/organizations/routes/departments.routes.js +6 -8
  303. package/src/modules/organizations/routes/invites.routes.js +6 -4
  304. package/src/modules/organizations/routes/memberships.routes.js +6 -5
  305. package/src/modules/organizations/store/departments.store.js +5 -0
  306. package/src/modules/organizations/store/invites.store.js +5 -0
  307. package/src/modules/organizations/store/memberships.store.js +23 -0
  308. package/src/modules/products/components/pages/Products.vue +0 -1
  309. package/src/modules/spots/components/blocks/CardSpot.vue +1 -1
  310. package/src/modules/spots/components/pages/Spots.vue +3 -203
  311. package/src/styles/base/all.scss +0 -15
  312. package/src/styles/typography.scss +20 -5
  313. package/dist/martyrs/src/components/Address/Address.vue2.cjs.map +0 -1
  314. package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs.map +0 -1
  315. package/dist/martyrs/src/components/Select/Select.vue2.cjs.map +0 -1
  316. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs +0 -76
  317. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs.map +0 -1
  318. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js +0 -76
  319. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js.map +0 -1
  320. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +0 -280
  321. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +0 -1
  322. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +0 -280
  323. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +0 -1
  324. package/dist/martyrs/src/modules/organizations/store/departments.cjs +0 -121
  325. package/dist/martyrs/src/modules/organizations/store/departments.cjs.map +0 -1
  326. package/dist/martyrs/src/modules/organizations/store/departments.js +0 -121
  327. package/dist/martyrs/src/modules/organizations/store/departments.js.map +0 -1
  328. package/dist/martyrs/src/modules/organizations/store/invites.cjs +0 -64
  329. package/dist/martyrs/src/modules/organizations/store/invites.cjs.map +0 -1
  330. package/dist/martyrs/src/modules/organizations/store/invites.js +0 -64
  331. package/dist/martyrs/src/modules/organizations/store/invites.js.map +0 -1
  332. package/dist/martyrs/src/modules/organizations/store/memberships.cjs +0 -87
  333. package/dist/martyrs/src/modules/organizations/store/memberships.cjs.map +0 -1
  334. package/dist/martyrs/src/modules/organizations/store/memberships.js +0 -87
  335. package/dist/martyrs/src/modules/organizations/store/memberships.js.map +0 -1
  336. package/src/CLAUDE.MD +0 -15
  337. package/src/modules/globals/controllers/classes/globals.websocket.ws.js +0 -102
  338. package/src/modules/globals/views/components/blocks/BlockFilter.vue +0 -60
  339. package/src/modules/organizations/store/departments.js +0 -137
  340. package/src/modules/organizations/store/invites.js +0 -76
  341. package/src/modules/organizations/store/memberships.js +0 -110
@@ -4,10 +4,15 @@ require("./mailing-Bs9ThyVZ.cjs");
4
4
  const index = require("./index-BFxqqmgh.cjs");
5
5
  const controllerFactory = (db) => {
6
6
  const ChatMessage = db.chat;
7
+ const Department = db.department;
8
+ const Order = db.order;
9
+ const notificationTimers = /* @__PURE__ */ new Map();
10
+ const NOTIFICATION_DELAY = 3e3;
7
11
  const saveMessage = async (msg) => {
8
12
  try {
9
13
  const message = new ChatMessage(msg);
10
14
  await message.save();
15
+ console.log("[CHAT CONTROLLER] Saved message with userId:", msg.userId);
11
16
  return message;
12
17
  } catch (error) {
13
18
  console.error("Error saving message to database:", error);
@@ -21,9 +26,149 @@ const controllerFactory = (db) => {
21
26
  console.error("Error retrieving messages from database:", error);
22
27
  }
23
28
  };
29
+ const markMessagesAsRead = async (messageIds, userId) => {
30
+ try {
31
+ console.log("[CHAT CONTROLLER] markMessagesAsRead called:", { messageIds, userId });
32
+ const messages = await ChatMessage.find({ _id: { $in: messageIds } });
33
+ console.log("[CHAT CONTROLLER] Found messages to mark:", messages.map((m) => ({
34
+ id: m._id,
35
+ userId: m.userId,
36
+ isOwnMessage: m.userId?.toString() === userId.toString(),
37
+ alreadyRead: m.readBy?.some((r) => r.userId.toString() === userId.toString())
38
+ })));
39
+ const result = await ChatMessage.updateMany(
40
+ {
41
+ _id: { $in: messageIds },
42
+ userId: { $ne: userId },
43
+ // НЕ свои сообщения
44
+ "readBy.userId": { $ne: userId }
45
+ // еще не прочитанные
46
+ },
47
+ {
48
+ $push: {
49
+ readBy: {
50
+ userId,
51
+ readAt: /* @__PURE__ */ new Date()
52
+ }
53
+ }
54
+ }
55
+ );
56
+ console.log("[CHAT CONTROLLER] Mark as read result:", result);
57
+ return result;
58
+ } catch (error) {
59
+ console.error("Error marking messages as read:", error);
60
+ }
61
+ };
62
+ const getUsersWithOrdersConfirmAccess = async (organizationId) => {
63
+ const pipeline = [
64
+ { $match: {
65
+ organization: new db.mongoose.Types.ObjectId(organizationId),
66
+ "accesses.orders.confirm": true
67
+ } },
68
+ { $unwind: "$members" },
69
+ { $group: {
70
+ _id: "$members.user"
71
+ } },
72
+ { $project: { userId: "$_id" } }
73
+ ];
74
+ const result = await Department.aggregate(pipeline);
75
+ return result.map((item) => item.userId);
76
+ };
77
+ const sendChatNotifications = async (message, recipientIds) => {
78
+ if (!recipientIds || recipientIds.length === 0) return;
79
+ const notifications = recipientIds.map((userId) => ({
80
+ title: "New Message",
81
+ body: `${message.username}: ${message.text.substring(0, 100)}`,
82
+ type: "chat_message",
83
+ metadata: {
84
+ type: "chat_message",
85
+ chatId: message.chatId,
86
+ messageId: message._id,
87
+ context: "chat"
88
+ },
89
+ userId
90
+ }));
91
+ try {
92
+ const response = await fetch(`${process.env.API_URL || ""}/api/notifications/batch`, {
93
+ method: "POST",
94
+ headers: {
95
+ "Content-Type": "application/json",
96
+ "X-Service-Key": process.env.SERVICE_KEY
97
+ },
98
+ body: JSON.stringify({ notifications })
99
+ });
100
+ if (!response.ok) {
101
+ const errorData = await response.text();
102
+ throw new Error(`Notification API failed: ${response.status} - ${errorData}`);
103
+ }
104
+ const result = await response.json();
105
+ console.log("Chat notifications sent:", result);
106
+ return result;
107
+ } catch (error) {
108
+ console.error("Failed to send chat notifications:", error);
109
+ }
110
+ };
111
+ const scheduleNotifications = async (message, wss, senderUserId) => {
112
+ console.log("[CHAT CONTROLLER] scheduleNotifications called for message:", message);
113
+ console.log("[CHAT CONTROLLER] Sender userId:", senderUserId);
114
+ console.log("[CHAT CONTROLLER] Chat type:", message.chatType);
115
+ console.log("[CHAT CONTROLLER] Chat ID:", message.chatId);
116
+ let recipientIds = [];
117
+ if (message.chatType === "order") {
118
+ try {
119
+ const order = await Order.findById(message.chatId);
120
+ console.log("[CHAT CONTROLLER] Found order:", order?._id, "Owner:", order?.owner);
121
+ const organizationId = order?.owner?.target?._id || order?.owner?.target;
122
+ if (order && organizationId) {
123
+ console.log("[CHAT CONTROLLER] Looking for users with orders.confirm access in org:", organizationId);
124
+ recipientIds = await getUsersWithOrdersConfirmAccess(organizationId);
125
+ console.log("[CHAT CONTROLLER] Found recipient IDs:", recipientIds);
126
+ } else {
127
+ console.log("[CHAT CONTROLLER] Order not found or has no organization");
128
+ }
129
+ } catch (error) {
130
+ console.error("[CHAT CONTROLLER] Error fetching order:", error);
131
+ }
132
+ } else if (message.chatType === "group") {
133
+ console.log("[CHAT CONTROLLER] Group notifications are mocked for now");
134
+ return;
135
+ } else {
136
+ console.log("[CHAT CONTROLLER] Unknown chat type:", message.chatType);
137
+ return;
138
+ }
139
+ const filteredRecipientIds = recipientIds.filter(
140
+ (userId) => userId.toString() !== senderUserId?.toString()
141
+ );
142
+ console.log("[CHAT CONTROLLER] Recipients after filtering out sender:", filteredRecipientIds);
143
+ if (filteredRecipientIds.length === 0) {
144
+ console.log("[CHAT CONTROLLER] No recipients after filtering, skipping notifications");
145
+ return;
146
+ }
147
+ filteredRecipientIds.forEach((userId) => {
148
+ const timerKey = `${message._id}_${userId}`;
149
+ console.log(`[CHAT CONTROLLER] Setting timer for user ${userId}, key: ${timerKey}`);
150
+ const timer = setTimeout(async () => {
151
+ console.log(`[CHAT CONTROLLER] Timer fired for user ${userId}, checking if message is read`);
152
+ const currentMessage = await ChatMessage.findById(message._id);
153
+ const isRead = currentMessage.readBy.some((r) => r.userId.toString() === userId.toString());
154
+ console.log(`[CHAT CONTROLLER] Message read status for user ${userId}:`, isRead);
155
+ if (!isRead) {
156
+ console.log(`[CHAT CONTROLLER] Sending notification to user ${userId}`);
157
+ await sendChatNotifications(message, [userId]);
158
+ } else {
159
+ console.log(`[CHAT CONTROLLER] Message already read by user ${userId}, skipping notification`);
160
+ }
161
+ notificationTimers.delete(timerKey);
162
+ }, NOTIFICATION_DELAY);
163
+ notificationTimers.set(timerKey, timer);
164
+ });
165
+ };
24
166
  return {
25
167
  saveMessage,
26
- getMessages
168
+ getMessages,
169
+ markMessagesAsRead,
170
+ scheduleNotifications,
171
+ notificationTimers
27
172
  };
28
173
  };
29
174
  const ChatModel = (db) => {
@@ -32,14 +177,35 @@ const ChatModel = (db) => {
32
177
  type: String,
33
178
  required: true
34
179
  },
180
+ userId: {
181
+ type: db.mongoose.Schema.Types.ObjectId,
182
+ ref: "User",
183
+ required: true
184
+ },
35
185
  chatId: {
36
186
  type: String,
37
187
  required: true
38
188
  },
189
+ chatType: {
190
+ type: String,
191
+ required: true,
192
+ enum: ["order", "group", "support", "private"],
193
+ default: "private"
194
+ },
39
195
  text: {
40
196
  type: String,
41
197
  required: true
42
198
  },
199
+ readBy: [{
200
+ userId: {
201
+ type: db.mongoose.Schema.Types.ObjectId,
202
+ ref: "User"
203
+ },
204
+ readAt: {
205
+ type: Date,
206
+ default: Date.now
207
+ }
208
+ }],
43
209
  createdAt: {
44
210
  type: Date,
45
211
  default: Date.now
@@ -58,7 +224,9 @@ const chatsRoutes = function(app, db, wss) {
58
224
  ws.activeChats.add(msg.chatId);
59
225
  }
60
226
  if (msg.type === "message") {
227
+ console.log("[CHAT] Received message:", msg);
61
228
  const savedMessage = await controller.saveMessage(msg);
229
+ console.log("[CHAT] Saved message:", savedMessage);
62
230
  wss.broadcastToModuleWithFilter(
63
231
  "chat",
64
232
  (client) => {
@@ -66,6 +234,35 @@ const chatsRoutes = function(app, db, wss) {
66
234
  },
67
235
  savedMessage
68
236
  );
237
+ console.log("[CHAT] Scheduling notifications for message:", savedMessage._id, "from user:", ws.userId);
238
+ controller.scheduleNotifications(savedMessage, wss, ws.userId);
239
+ }
240
+ if (msg.type === "markAsRead") {
241
+ console.log("[CHAT] markAsRead request:", { messageIds: msg.messageIds, userId: ws.userId });
242
+ if (!msg.messageIds || !msg.chatId || !ws.userId) {
243
+ console.log("[CHAT] markAsRead missing params:", { hasMessageIds: !!msg.messageIds, hasChatId: !!msg.chatId, hasUserId: !!ws.userId });
244
+ return;
245
+ }
246
+ await controller.markMessagesAsRead(msg.messageIds, ws.userId);
247
+ msg.messageIds.forEach((messageId) => {
248
+ const timerKey = `${messageId}_${ws.userId}`;
249
+ if (controller.notificationTimers.has(timerKey)) {
250
+ clearTimeout(controller.notificationTimers.get(timerKey));
251
+ controller.notificationTimers.delete(timerKey);
252
+ }
253
+ });
254
+ wss.broadcastToModuleWithFilter(
255
+ "chat",
256
+ (client) => {
257
+ return client.activeChats?.has(msg.chatId) && client.userId !== ws.userId;
258
+ },
259
+ {
260
+ type: "readReceipt",
261
+ messageIds: msg.messageIds,
262
+ userId: ws.userId,
263
+ readAt: /* @__PURE__ */ new Date()
264
+ }
265
+ );
69
266
  }
70
267
  });
71
268
  app.get("/messages/:chatId", async (req, res) => {
@@ -2,10 +2,15 @@ import "./mailing-DzlhsxCC.js";
2
2
  import { m as middlewareIndexFactory } from "./index-_Edcmck_.js";
3
3
  const controllerFactory = (db) => {
4
4
  const ChatMessage = db.chat;
5
+ const Department = db.department;
6
+ const Order = db.order;
7
+ const notificationTimers = /* @__PURE__ */ new Map();
8
+ const NOTIFICATION_DELAY = 3e3;
5
9
  const saveMessage = async (msg) => {
6
10
  try {
7
11
  const message = new ChatMessage(msg);
8
12
  await message.save();
13
+ console.log("[CHAT CONTROLLER] Saved message with userId:", msg.userId);
9
14
  return message;
10
15
  } catch (error) {
11
16
  console.error("Error saving message to database:", error);
@@ -19,9 +24,149 @@ const controllerFactory = (db) => {
19
24
  console.error("Error retrieving messages from database:", error);
20
25
  }
21
26
  };
27
+ const markMessagesAsRead = async (messageIds, userId) => {
28
+ try {
29
+ console.log("[CHAT CONTROLLER] markMessagesAsRead called:", { messageIds, userId });
30
+ const messages = await ChatMessage.find({ _id: { $in: messageIds } });
31
+ console.log("[CHAT CONTROLLER] Found messages to mark:", messages.map((m) => ({
32
+ id: m._id,
33
+ userId: m.userId,
34
+ isOwnMessage: m.userId?.toString() === userId.toString(),
35
+ alreadyRead: m.readBy?.some((r) => r.userId.toString() === userId.toString())
36
+ })));
37
+ const result = await ChatMessage.updateMany(
38
+ {
39
+ _id: { $in: messageIds },
40
+ userId: { $ne: userId },
41
+ // НЕ свои сообщения
42
+ "readBy.userId": { $ne: userId }
43
+ // еще не прочитанные
44
+ },
45
+ {
46
+ $push: {
47
+ readBy: {
48
+ userId,
49
+ readAt: /* @__PURE__ */ new Date()
50
+ }
51
+ }
52
+ }
53
+ );
54
+ console.log("[CHAT CONTROLLER] Mark as read result:", result);
55
+ return result;
56
+ } catch (error) {
57
+ console.error("Error marking messages as read:", error);
58
+ }
59
+ };
60
+ const getUsersWithOrdersConfirmAccess = async (organizationId) => {
61
+ const pipeline = [
62
+ { $match: {
63
+ organization: new db.mongoose.Types.ObjectId(organizationId),
64
+ "accesses.orders.confirm": true
65
+ } },
66
+ { $unwind: "$members" },
67
+ { $group: {
68
+ _id: "$members.user"
69
+ } },
70
+ { $project: { userId: "$_id" } }
71
+ ];
72
+ const result = await Department.aggregate(pipeline);
73
+ return result.map((item) => item.userId);
74
+ };
75
+ const sendChatNotifications = async (message, recipientIds) => {
76
+ if (!recipientIds || recipientIds.length === 0) return;
77
+ const notifications = recipientIds.map((userId) => ({
78
+ title: "New Message",
79
+ body: `${message.username}: ${message.text.substring(0, 100)}`,
80
+ type: "chat_message",
81
+ metadata: {
82
+ type: "chat_message",
83
+ chatId: message.chatId,
84
+ messageId: message._id,
85
+ context: "chat"
86
+ },
87
+ userId
88
+ }));
89
+ try {
90
+ const response = await fetch(`${process.env.API_URL || ""}/api/notifications/batch`, {
91
+ method: "POST",
92
+ headers: {
93
+ "Content-Type": "application/json",
94
+ "X-Service-Key": process.env.SERVICE_KEY
95
+ },
96
+ body: JSON.stringify({ notifications })
97
+ });
98
+ if (!response.ok) {
99
+ const errorData = await response.text();
100
+ throw new Error(`Notification API failed: ${response.status} - ${errorData}`);
101
+ }
102
+ const result = await response.json();
103
+ console.log("Chat notifications sent:", result);
104
+ return result;
105
+ } catch (error) {
106
+ console.error("Failed to send chat notifications:", error);
107
+ }
108
+ };
109
+ const scheduleNotifications = async (message, wss, senderUserId) => {
110
+ console.log("[CHAT CONTROLLER] scheduleNotifications called for message:", message);
111
+ console.log("[CHAT CONTROLLER] Sender userId:", senderUserId);
112
+ console.log("[CHAT CONTROLLER] Chat type:", message.chatType);
113
+ console.log("[CHAT CONTROLLER] Chat ID:", message.chatId);
114
+ let recipientIds = [];
115
+ if (message.chatType === "order") {
116
+ try {
117
+ const order = await Order.findById(message.chatId);
118
+ console.log("[CHAT CONTROLLER] Found order:", order?._id, "Owner:", order?.owner);
119
+ const organizationId = order?.owner?.target?._id || order?.owner?.target;
120
+ if (order && organizationId) {
121
+ console.log("[CHAT CONTROLLER] Looking for users with orders.confirm access in org:", organizationId);
122
+ recipientIds = await getUsersWithOrdersConfirmAccess(organizationId);
123
+ console.log("[CHAT CONTROLLER] Found recipient IDs:", recipientIds);
124
+ } else {
125
+ console.log("[CHAT CONTROLLER] Order not found or has no organization");
126
+ }
127
+ } catch (error) {
128
+ console.error("[CHAT CONTROLLER] Error fetching order:", error);
129
+ }
130
+ } else if (message.chatType === "group") {
131
+ console.log("[CHAT CONTROLLER] Group notifications are mocked for now");
132
+ return;
133
+ } else {
134
+ console.log("[CHAT CONTROLLER] Unknown chat type:", message.chatType);
135
+ return;
136
+ }
137
+ const filteredRecipientIds = recipientIds.filter(
138
+ (userId) => userId.toString() !== senderUserId?.toString()
139
+ );
140
+ console.log("[CHAT CONTROLLER] Recipients after filtering out sender:", filteredRecipientIds);
141
+ if (filteredRecipientIds.length === 0) {
142
+ console.log("[CHAT CONTROLLER] No recipients after filtering, skipping notifications");
143
+ return;
144
+ }
145
+ filteredRecipientIds.forEach((userId) => {
146
+ const timerKey = `${message._id}_${userId}`;
147
+ console.log(`[CHAT CONTROLLER] Setting timer for user ${userId}, key: ${timerKey}`);
148
+ const timer = setTimeout(async () => {
149
+ console.log(`[CHAT CONTROLLER] Timer fired for user ${userId}, checking if message is read`);
150
+ const currentMessage = await ChatMessage.findById(message._id);
151
+ const isRead = currentMessage.readBy.some((r) => r.userId.toString() === userId.toString());
152
+ console.log(`[CHAT CONTROLLER] Message read status for user ${userId}:`, isRead);
153
+ if (!isRead) {
154
+ console.log(`[CHAT CONTROLLER] Sending notification to user ${userId}`);
155
+ await sendChatNotifications(message, [userId]);
156
+ } else {
157
+ console.log(`[CHAT CONTROLLER] Message already read by user ${userId}, skipping notification`);
158
+ }
159
+ notificationTimers.delete(timerKey);
160
+ }, NOTIFICATION_DELAY);
161
+ notificationTimers.set(timerKey, timer);
162
+ });
163
+ };
22
164
  return {
23
165
  saveMessage,
24
- getMessages
166
+ getMessages,
167
+ markMessagesAsRead,
168
+ scheduleNotifications,
169
+ notificationTimers
25
170
  };
26
171
  };
27
172
  const ChatModel = (db) => {
@@ -30,14 +175,35 @@ const ChatModel = (db) => {
30
175
  type: String,
31
176
  required: true
32
177
  },
178
+ userId: {
179
+ type: db.mongoose.Schema.Types.ObjectId,
180
+ ref: "User",
181
+ required: true
182
+ },
33
183
  chatId: {
34
184
  type: String,
35
185
  required: true
36
186
  },
187
+ chatType: {
188
+ type: String,
189
+ required: true,
190
+ enum: ["order", "group", "support", "private"],
191
+ default: "private"
192
+ },
37
193
  text: {
38
194
  type: String,
39
195
  required: true
40
196
  },
197
+ readBy: [{
198
+ userId: {
199
+ type: db.mongoose.Schema.Types.ObjectId,
200
+ ref: "User"
201
+ },
202
+ readAt: {
203
+ type: Date,
204
+ default: Date.now
205
+ }
206
+ }],
41
207
  createdAt: {
42
208
  type: Date,
43
209
  default: Date.now
@@ -56,7 +222,9 @@ const chatsRoutes = function(app, db, wss) {
56
222
  ws.activeChats.add(msg.chatId);
57
223
  }
58
224
  if (msg.type === "message") {
225
+ console.log("[CHAT] Received message:", msg);
59
226
  const savedMessage = await controller.saveMessage(msg);
227
+ console.log("[CHAT] Saved message:", savedMessage);
60
228
  wss.broadcastToModuleWithFilter(
61
229
  "chat",
62
230
  (client) => {
@@ -64,6 +232,35 @@ const chatsRoutes = function(app, db, wss) {
64
232
  },
65
233
  savedMessage
66
234
  );
235
+ console.log("[CHAT] Scheduling notifications for message:", savedMessage._id, "from user:", ws.userId);
236
+ controller.scheduleNotifications(savedMessage, wss, ws.userId);
237
+ }
238
+ if (msg.type === "markAsRead") {
239
+ console.log("[CHAT] markAsRead request:", { messageIds: msg.messageIds, userId: ws.userId });
240
+ if (!msg.messageIds || !msg.chatId || !ws.userId) {
241
+ console.log("[CHAT] markAsRead missing params:", { hasMessageIds: !!msg.messageIds, hasChatId: !!msg.chatId, hasUserId: !!ws.userId });
242
+ return;
243
+ }
244
+ await controller.markMessagesAsRead(msg.messageIds, ws.userId);
245
+ msg.messageIds.forEach((messageId) => {
246
+ const timerKey = `${messageId}_${ws.userId}`;
247
+ if (controller.notificationTimers.has(timerKey)) {
248
+ clearTimeout(controller.notificationTimers.get(timerKey));
249
+ controller.notificationTimers.delete(timerKey);
250
+ }
251
+ });
252
+ wss.broadcastToModuleWithFilter(
253
+ "chat",
254
+ (client) => {
255
+ return client.activeChats?.has(msg.chatId) && client.userId !== ws.userId;
256
+ },
257
+ {
258
+ type: "readReceipt",
259
+ messageIds: msg.messageIds,
260
+ userId: ws.userId,
261
+ readAt: /* @__PURE__ */ new Date()
262
+ }
263
+ );
67
264
  }
68
265
  });
69
266
  app.get("/messages/:chatId", async (req, res) => {