@ozdao/martyrs 0.2.489 → 0.2.491
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +4 -4
- package/dist/_virtual/index2.js +4 -4
- package/dist/auth.server.cjs +2 -51
- package/dist/auth.server.js +1 -50
- package/dist/builder.cjs +90 -4
- package/dist/builder.js +90 -4
- package/dist/main-BhCqlPMQ.cjs +11 -0
- package/dist/{main-IVRL6IjM.js → main-YBlKbx0g.js} +1308 -1285
- package/dist/martyrs/src/components/Block/Block.vue.cjs +1 -1
- package/dist/martyrs/src/components/Block/Block.vue.js +1 -1
- package/dist/martyrs/src/components/Button/Button.vue2.cjs +48 -21
- package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/Button/Button.vue2.js +49 -22
- package/dist/martyrs/src/components/Button/Button.vue2.js.map +1 -1
- package/dist/martyrs/src/components/Chips/{Chips.vue2.cjs → Chips.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue2.js → Chips.vue.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/Feed/Carousel.vue.cjs +1 -1
- package/dist/martyrs/src/components/Feed/Carousel.vue.js +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +1 -1
- package/dist/martyrs/src/components/Loader/{Loader.vue2.cjs → Loader.vue.cjs} +3 -3
- package/dist/martyrs/src/components/Loader/Loader.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Loader/{Loader.vue2.js → Loader.vue.js} +3 -3
- package/dist/martyrs/src/components/Loader/Loader.vue.js.map +1 -0
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.js +1 -1
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.cjs → Tooltip.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.js.map → Tooltip.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.js → Tooltip.vue.js} +2 -2
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue.js.map +1 -0
- package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
- package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +2 -2
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +3 -3
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +3 -3
- package/dist/martyrs/src/modules/events/components/sections/Feed.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/Feed.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/sections/List.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/List.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/globals.client.cjs +1 -2
- package/dist/martyrs/src/modules/globals/globals.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/globals.client.js +1 -2
- package/dist/martyrs/src/modules/globals/globals.client.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +10 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +10 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.cjs +2 -2
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.js +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.cjs +22 -8
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js +23 -9
- package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.cjs +13 -15
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.js +14 -16
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.cjs +2 -2
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.js +2 -2
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.cjs +2 -2
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js +2 -2
- package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.js +7 -7
- package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/router/notifications.router.js +4 -4
- package/dist/martyrs/src/modules/notifications/router/notifications.router.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/store/notifications.store.cjs +7 -10
- package/dist/martyrs/src/modules/notifications/store/notifications.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/store/notifications.store.js +7 -10
- package/dist/martyrs/src/modules/notifications/store/notifications.store.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs +0 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js +0 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/elements/Image360.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/elements/Image360.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +3 -3
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +3 -3
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.cjs +142 -44
- package/dist/notifications.server.js +142 -44
- package/dist/orders.server.cjs +155 -102
- package/dist/orders.server.js +155 -102
- package/dist/products.server.cjs +4 -0
- package/dist/products.server.js +4 -0
- package/dist/profile.schema-BGAe5VN5.js +92 -0
- package/dist/profile.schema-pidHrksV.cjs +91 -0
- package/dist/style.css +65 -247
- package/dist/{web-BXhlxo6M.cjs → web-BBmMBRv-.cjs} +1 -1
- package/dist/{web-Czi05iGG.js → web-Dqu-aCL5.js} +1 -1
- package/package.json +1 -1
- package/src/builder/rspack/rspack.config.spa.client.js +46 -1
- package/src/builder/rspack/rspack.config.ssr.client.js +43 -0
- package/src/builder/templates/page.js +1 -1
- package/src/components/Button/Button.vue +230 -196
- package/src/components/Loader/Loader.vue +1 -1
- package/src/modules/auth/controllers/middlewares/visitor.logger.js +22 -0
- package/src/modules/globals/globals.client.js +1 -1
- package/src/modules/globals/views/components/layouts/Client.vue +10 -9
- package/src/modules/notifications/FIXES.md +4 -0
- package/src/modules/notifications/components/layouts/NotificationsLayout.vue +33 -32
- package/src/modules/notifications/components/pages/Notifications.vue +10 -51
- package/src/modules/notifications/components/sections/NotificationPreferences.vue +1 -11
- package/src/modules/notifications/components/sections/NotificationsList.vue +1 -1
- package/src/modules/notifications/controllers/notifications.controller.js +50 -4
- package/src/modules/notifications/notifications.client.js +1 -1
- package/src/modules/notifications/notifications.server.js +18 -7
- package/src/modules/notifications/routes/notifications.routes.js +4 -2
- package/src/modules/notifications/services/notification.service.js +109 -38
- package/src/modules/notifications/services/telegram.service.js +1 -0
- package/src/modules/notifications/services/whatsapp.service.js +1 -0
- package/src/modules/notifications/store/notifications.store.js +25 -16
- package/src/modules/orders/components/partials/ShopCart.vue +0 -1
- package/src/modules/orders/controllers/orders.controller.js +195 -85
- package/src/modules/products/controllers/products.controller.js +4 -0
- package/dist/main-CmuUC0tl.cjs +0 -11
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue2.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.cjs +0 -200
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.js +0 -200
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.js.map +0 -1
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.cjs +0 -21
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.js +0 -21
- package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs +0 -9
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -9
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/defaultOptions.cjs +0 -8
- package/dist/node_modules/date-fns/_lib/defaultOptions.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -8
- package/dist/node_modules/date-fns/_lib/defaultOptions.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/formatters.cjs +0 -653
- package/dist/node_modules/date-fns/_lib/format/formatters.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -653
- package/dist/node_modules/date-fns/_lib/format/formatters.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs +0 -63
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -63
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs +0 -59
- package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -59
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +0 -21
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -21
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/normalizeDates.cjs +0 -12
- package/dist/node_modules/date-fns/_lib/normalizeDates.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -12
- package/dist/node_modules/date-fns/_lib/normalizeDates.js.map +0 -1
- package/dist/node_modules/date-fns/_lib/protectedTokens.cjs +0 -24
- package/dist/node_modules/date-fns/_lib/protectedTokens.cjs.map +0 -1
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -24
- package/dist/node_modules/date-fns/_lib/protectedTokens.js.map +0 -1
- package/dist/node_modules/date-fns/constants.cjs +0 -9
- package/dist/node_modules/date-fns/constants.cjs.map +0 -1
- package/dist/node_modules/date-fns/constants.js +0 -9
- package/dist/node_modules/date-fns/constants.js.map +0 -1
- package/dist/node_modules/date-fns/constructFrom.cjs +0 -13
- package/dist/node_modules/date-fns/constructFrom.cjs.map +0 -1
- package/dist/node_modules/date-fns/constructFrom.js +0 -13
- package/dist/node_modules/date-fns/constructFrom.js.map +0 -1
- package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +0 -21
- package/dist/node_modules/date-fns/differenceInCalendarDays.cjs.map +0 -1
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -21
- package/dist/node_modules/date-fns/differenceInCalendarDays.js.map +0 -1
- package/dist/node_modules/date-fns/format.cjs +0 -80
- package/dist/node_modules/date-fns/format.cjs.map +0 -1
- package/dist/node_modules/date-fns/format.js +0 -80
- package/dist/node_modules/date-fns/format.js.map +0 -1
- package/dist/node_modules/date-fns/getDayOfYear.cjs +0 -14
- package/dist/node_modules/date-fns/getDayOfYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -14
- package/dist/node_modules/date-fns/getDayOfYear.js.map +0 -1
- package/dist/node_modules/date-fns/getISOWeek.cjs +0 -14
- package/dist/node_modules/date-fns/getISOWeek.cjs.map +0 -1
- package/dist/node_modules/date-fns/getISOWeek.js +0 -14
- package/dist/node_modules/date-fns/getISOWeek.js.map +0 -1
- package/dist/node_modules/date-fns/getISOWeekYear.cjs +0 -27
- package/dist/node_modules/date-fns/getISOWeekYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -27
- package/dist/node_modules/date-fns/getISOWeekYear.js.map +0 -1
- package/dist/node_modules/date-fns/getWeek.cjs +0 -14
- package/dist/node_modules/date-fns/getWeek.cjs.map +0 -1
- package/dist/node_modules/date-fns/getWeek.js +0 -14
- package/dist/node_modules/date-fns/getWeek.js.map +0 -1
- package/dist/node_modules/date-fns/getWeekYear.cjs +0 -31
- package/dist/node_modules/date-fns/getWeekYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/getWeekYear.js +0 -31
- package/dist/node_modules/date-fns/getWeekYear.js.map +0 -1
- package/dist/node_modules/date-fns/isDate.cjs +0 -8
- package/dist/node_modules/date-fns/isDate.cjs.map +0 -1
- package/dist/node_modules/date-fns/isDate.js +0 -8
- package/dist/node_modules/date-fns/isDate.js.map +0 -1
- package/dist/node_modules/date-fns/isValid.cjs +0 -10
- package/dist/node_modules/date-fns/isValid.cjs.map +0 -1
- package/dist/node_modules/date-fns/isValid.js +0 -10
- package/dist/node_modules/date-fns/isValid.js.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs +0 -11
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -11
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs +0 -21
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -21
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs +0 -44
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -44
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs +0 -17
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -17
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs +0 -86
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -86
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs +0 -37
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -37
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs +0 -165
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -165
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs +0 -123
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -123
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US.cjs +0 -22
- package/dist/node_modules/date-fns/locale/en-US.cjs.map +0 -1
- package/dist/node_modules/date-fns/locale/en-US.js +0 -22
- package/dist/node_modules/date-fns/locale/en-US.js.map +0 -1
- package/dist/node_modules/date-fns/startOfDay.cjs +0 -11
- package/dist/node_modules/date-fns/startOfDay.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfDay.js +0 -11
- package/dist/node_modules/date-fns/startOfDay.js.map +0 -1
- package/dist/node_modules/date-fns/startOfISOWeek.cjs +0 -9
- package/dist/node_modules/date-fns/startOfISOWeek.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -9
- package/dist/node_modules/date-fns/startOfISOWeek.js.map +0 -1
- package/dist/node_modules/date-fns/startOfISOWeekYear.cjs +0 -15
- package/dist/node_modules/date-fns/startOfISOWeekYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -15
- package/dist/node_modules/date-fns/startOfISOWeekYear.js.map +0 -1
- package/dist/node_modules/date-fns/startOfWeek.cjs +0 -18
- package/dist/node_modules/date-fns/startOfWeek.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfWeek.js +0 -18
- package/dist/node_modules/date-fns/startOfWeek.js.map +0 -1
- package/dist/node_modules/date-fns/startOfWeekYear.cjs +0 -20
- package/dist/node_modules/date-fns/startOfWeekYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -20
- package/dist/node_modules/date-fns/startOfWeekYear.js.map +0 -1
- package/dist/node_modules/date-fns/startOfYear.cjs +0 -12
- package/dist/node_modules/date-fns/startOfYear.cjs.map +0 -1
- package/dist/node_modules/date-fns/startOfYear.js +0 -12
- package/dist/node_modules/date-fns/startOfYear.js.map +0 -1
- package/dist/node_modules/date-fns/toDate.cjs +0 -9
- package/dist/node_modules/date-fns/toDate.cjs.map +0 -1
- package/dist/node_modules/date-fns/toDate.js +0 -9
- package/dist/node_modules/date-fns/toDate.js.map +0 -1
- package/dist/profile.schema-DchVS-Jr.js +0 -21
- package/dist/profile.schema-yQuIzngl.cjs +0 -20
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="notifications-layout">
|
|
3
|
-
<div >
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
3
|
<div class="">
|
|
7
4
|
<router-view></router-view>
|
|
8
5
|
</div>
|
|
9
6
|
|
|
10
|
-
<div v-if="
|
|
7
|
+
<div v-if="!wsConnected" class="connection-status">
|
|
11
8
|
<div class="connection-warning">
|
|
12
9
|
<span class="warning-icon">⚠️</span>
|
|
13
10
|
<span class="warning-text">
|
|
@@ -20,17 +17,46 @@
|
|
|
20
17
|
</template>
|
|
21
18
|
|
|
22
19
|
<script setup>
|
|
23
|
-
import { computed, inject } from 'vue';
|
|
20
|
+
import { computed, inject, ref, onMounted, onUnmounted } from 'vue';
|
|
21
|
+
import globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';
|
|
24
22
|
|
|
25
23
|
// Get notification manager from store
|
|
26
24
|
const store = inject('store');
|
|
27
25
|
|
|
28
26
|
const notificationManager = computed(() => store.notificationManager || null);
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// Реактивное состояние WebSocket
|
|
29
|
+
const wsConnected = ref(globalWebSocket.isConnected);
|
|
30
|
+
|
|
31
|
+
// ID слушателей для очистки
|
|
32
|
+
const openListenerId = ref(null);
|
|
33
|
+
const closeListenerId = ref(null);
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
// Подписываемся на события WebSocket
|
|
37
|
+
openListenerId.value = globalWebSocket.addEventListener('open', () => {
|
|
38
|
+
wsConnected.value = true;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
closeListenerId.value = globalWebSocket.addEventListener('close', () => {
|
|
42
|
+
wsConnected.value = false;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Устанавливаем начальное состояние
|
|
46
|
+
wsConnected.value = globalWebSocket.isConnected;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
onUnmounted(() => {
|
|
50
|
+
// Очищаем слушатели
|
|
51
|
+
if (openListenerId.value) {
|
|
52
|
+
globalWebSocket.removeEventListener('open', openListenerId.value);
|
|
53
|
+
}
|
|
54
|
+
if (closeListenerId.value) {
|
|
55
|
+
globalWebSocket.removeEventListener('close', closeListenerId.value);
|
|
56
|
+
}
|
|
32
57
|
});
|
|
33
58
|
|
|
59
|
+
|
|
34
60
|
// Methods
|
|
35
61
|
const reconnect = () => {
|
|
36
62
|
if (notificationManager.value) {
|
|
@@ -40,29 +66,4 @@ const reconnect = () => {
|
|
|
40
66
|
</script>
|
|
41
67
|
|
|
42
68
|
<style scoped>
|
|
43
|
-
.notifications-layout {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
height: 100%;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.tabs {
|
|
50
|
-
display: flex;
|
|
51
|
-
gap: 1rem;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.tab-button {
|
|
55
|
-
padding: 0.5rem 1rem;
|
|
56
|
-
border: none;
|
|
57
|
-
background: none;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
font-weight: 500;
|
|
60
|
-
border-bottom: 2px solid transparent;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.tab-button.active {
|
|
64
|
-
border-bottom: 2px solid var(--primary-color, #0066cc);
|
|
65
|
-
color: var(--primary-color, #0066cc);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
69
|
</style>
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="notifications-page pd-small">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@click="activeTab = 'preferences'"
|
|
13
|
-
>
|
|
14
|
-
Notification Settings
|
|
15
|
-
</button>
|
|
16
|
-
</div>
|
|
3
|
+
<Tab
|
|
4
|
+
v-model:selected="activeTab"
|
|
5
|
+
:tabs="[
|
|
6
|
+
{ label: `All Notifications${unreadCount > 0 ? ` (${unreadCount})` : ''}`, value: 'all' },
|
|
7
|
+
{ label: 'Notification Settings', value: 'preferences' }
|
|
8
|
+
]"
|
|
9
|
+
class="flex-child-default gap-micro scroll-hide bg-light radius-medium h-max pd-thin mn-b-thin o-x-scroll"
|
|
10
|
+
classTab="bg-white"
|
|
11
|
+
/>
|
|
17
12
|
|
|
18
13
|
<div class="tab-content">
|
|
19
14
|
<notifications-list v-if="activeTab === 'all'" />
|
|
@@ -25,6 +20,7 @@
|
|
|
25
20
|
<script setup>
|
|
26
21
|
import { ref, inject } from 'vue';
|
|
27
22
|
import { useRoute } from 'vue-router';
|
|
23
|
+
import Tab from "@martyrs/src/components/Tab/Tab.vue";
|
|
28
24
|
import NotificationsList from '../sections/NotificationsList.vue';
|
|
29
25
|
import NotificationPreferences from '../sections/NotificationPreferences.vue';
|
|
30
26
|
|
|
@@ -37,41 +33,4 @@ const activeTab = ref(route.query.tab || 'all');
|
|
|
37
33
|
</script>
|
|
38
34
|
|
|
39
35
|
<style scoped>
|
|
40
|
-
.notifications-page {
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.tabs {
|
|
44
|
-
display: flex;
|
|
45
|
-
margin-bottom: 24px;
|
|
46
|
-
border-bottom: 1px solid #e0e0e0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.tabs button {
|
|
50
|
-
background: none;
|
|
51
|
-
border: none;
|
|
52
|
-
padding: 12px 24px;
|
|
53
|
-
font-size: 1rem;
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
position: relative;
|
|
56
|
-
color: #666;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.tabs button.active {
|
|
60
|
-
color: #2196F3;
|
|
61
|
-
font-weight: 500;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.tabs button.active::after {
|
|
65
|
-
content: '';
|
|
66
|
-
position: absolute;
|
|
67
|
-
bottom: -1px;
|
|
68
|
-
left: 0;
|
|
69
|
-
width: 100%;
|
|
70
|
-
height: 2px;
|
|
71
|
-
background-color: #2196F3;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.tab-content {
|
|
75
|
-
padding: 16px 0;
|
|
76
|
-
}
|
|
77
36
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="notification-preferences">
|
|
3
|
-
<h2>Notification Preferences</h2>
|
|
3
|
+
<h2 class="mn-b-small">Notification Preferences</h2>
|
|
4
4
|
<p class="description">Choose how you want to receive notifications</p>
|
|
5
5
|
|
|
6
6
|
<div v-if="loading" class="preferences-loading">
|
|
@@ -155,16 +155,6 @@ onMounted(async () => {
|
|
|
155
155
|
</script>
|
|
156
156
|
|
|
157
157
|
<style scoped>
|
|
158
|
-
.notification-preferences {
|
|
159
|
-
max-width: 800px;
|
|
160
|
-
margin: 0 auto;
|
|
161
|
-
padding: 24px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
h2 {
|
|
165
|
-
margin-top: 0;
|
|
166
|
-
margin-bottom: 8px;
|
|
167
|
-
}
|
|
168
158
|
|
|
169
159
|
.description {
|
|
170
160
|
color: #666;
|
|
@@ -154,7 +154,7 @@ const formatTime = (timestamp) => {
|
|
|
154
154
|
// Lifecycle
|
|
155
155
|
onMounted(() => {
|
|
156
156
|
const userId = auth.state.user._id;
|
|
157
|
-
if (userId && notifications.value.length === 0) {
|
|
157
|
+
if (userId && notifications.value.length === 0 && !loading.value) {
|
|
158
158
|
getNotifications(userId);
|
|
159
159
|
}
|
|
160
160
|
});
|
|
@@ -1,17 +1,61 @@
|
|
|
1
1
|
// controllers/notifications.controller.js
|
|
2
|
-
const NotificationsController = (db, wss) => {
|
|
2
|
+
const NotificationsController = (db, wss, notificationService) => {
|
|
3
3
|
// Create a new notification
|
|
4
4
|
const create = async (req, res) => {
|
|
5
5
|
try {
|
|
6
6
|
const notification = await db.notification.create(req.body);
|
|
7
7
|
// Trigger notification sending process
|
|
8
|
-
|
|
9
|
-
notificationService.processNotification(notification);
|
|
8
|
+
await notificationService.processNotification(notification);
|
|
10
9
|
return res.status(201).json(notification);
|
|
11
10
|
} catch (err) {
|
|
12
11
|
return res.status(500).json({ message: err.message });
|
|
13
12
|
}
|
|
14
13
|
};
|
|
14
|
+
|
|
15
|
+
// Create multiple notifications at once
|
|
16
|
+
const createBatch = async (req, res) => {
|
|
17
|
+
console.log('=== Batch notifications endpoint ===');
|
|
18
|
+
console.log('Request body:', JSON.stringify(req.body, null, 2));
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const { notifications } = req.body;
|
|
22
|
+
|
|
23
|
+
if (!notifications || !Array.isArray(notifications)) {
|
|
24
|
+
console.error('Invalid request: notifications array is required');
|
|
25
|
+
return res.status(400).json({ message: 'notifications array is required' });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log('Creating notifications count:', notifications.length);
|
|
29
|
+
|
|
30
|
+
// Create all notifications
|
|
31
|
+
const createdNotifications = await db.notification.insertMany(notifications);
|
|
32
|
+
console.log('Created notifications:', createdNotifications.map(n => n._id));
|
|
33
|
+
|
|
34
|
+
// Fire and forget with error tracking
|
|
35
|
+
setImmediate(() => {
|
|
36
|
+
Promise.allSettled(createdNotifications.map(notif =>
|
|
37
|
+
notificationService.processNotification(notif)
|
|
38
|
+
)).then(results => {
|
|
39
|
+
const failures = results.filter(r => r.status === 'rejected');
|
|
40
|
+
if (failures.length > 0) {
|
|
41
|
+
console.error('Batch notification processing errors:',
|
|
42
|
+
failures.map(f => f.reason?.message || f.reason));
|
|
43
|
+
}
|
|
44
|
+
console.log(`Batch processing complete: ${results.length - failures.length}/${results.length} successful`);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return res.status(201).json({
|
|
49
|
+
message: 'Batch notifications created',
|
|
50
|
+
count: createdNotifications.length
|
|
51
|
+
});
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error('=== Batch notifications error ===');
|
|
54
|
+
console.error('Error:', err.message);
|
|
55
|
+
console.error('Stack:', err.stack);
|
|
56
|
+
return res.status(500).json({ message: err.message });
|
|
57
|
+
}
|
|
58
|
+
};
|
|
15
59
|
// Get all notifications for a user
|
|
16
60
|
const getUserNotifications = async (req, res) => {
|
|
17
61
|
try {
|
|
@@ -53,7 +97,7 @@ const NotificationsController = (db, wss) => {
|
|
|
53
97
|
try {
|
|
54
98
|
const userId = req.params.userId;
|
|
55
99
|
// Update all unread notifications for this user
|
|
56
|
-
const result = await db.notification.updateMany({ userId: userId, status: 'unread' }, { status: 'read', updatedAt: Date.now() });
|
|
100
|
+
const result = await db.notification.updateMany({ userId: userId, status: { $in: ['sent', 'unread'] } }, { status: 'read', updatedAt: Date.now() });
|
|
57
101
|
// Get all updated notifications for logging
|
|
58
102
|
const updatedNotifications = await db.notification.find({
|
|
59
103
|
userId: userId,
|
|
@@ -139,8 +183,10 @@ const NotificationsController = (db, wss) => {
|
|
|
139
183
|
return res.status(500).json({ message: err.message });
|
|
140
184
|
}
|
|
141
185
|
};
|
|
186
|
+
|
|
142
187
|
return {
|
|
143
188
|
create,
|
|
189
|
+
createBatch,
|
|
144
190
|
getUserNotifications,
|
|
145
191
|
markAsRead,
|
|
146
192
|
registerDevice,
|
|
@@ -191,7 +191,7 @@ class NotificationManager {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
const registration = await navigator.serviceWorker.
|
|
194
|
+
const registration = await navigator.serviceWorker.ready;
|
|
195
195
|
const subscription = await registration.pushManager.subscribe({
|
|
196
196
|
userVisibleOnly: true,
|
|
197
197
|
applicationServerKey: 'BJtNnRrx05VQS0abnkHC-8gHJWpnmoqC_iQveENCmZOZIs-adWzqAiqFCdGVVd7CbiaLW-Q5iuIBDRgM9G-VnKg',
|
|
@@ -15,17 +15,28 @@ function initializeNotifications(app, db, wss, origins, publicPath) {
|
|
|
15
15
|
db.notificationLog = NotificationLogModel(db);
|
|
16
16
|
const abac = getInstance(db);
|
|
17
17
|
// const notificationPolicies = initNotificationPolicies(abac, db);
|
|
18
|
+
// Initialize notification service and related background tasks
|
|
19
|
+
const notificationService = NotificationService(db, wss);
|
|
18
20
|
// Set up routes if app is provided
|
|
19
21
|
if (app) {
|
|
20
|
-
notificationsRoutes(app, db, wss, origins, publicPath);
|
|
22
|
+
notificationsRoutes(app, db, wss, origins, publicPath, notificationService);
|
|
21
23
|
}
|
|
22
|
-
// Initialize notification service and related background tasks
|
|
23
|
-
const notificationService = NotificationService(db, wss);
|
|
24
24
|
console.log('[DEBUG] WSS in notification init:', wss);
|
|
25
|
-
// Set up a scheduler to process pending notifications
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
// Set up a scheduler to process pending notifications with overlap protection
|
|
26
|
+
let isProcessing = false;
|
|
27
|
+
|
|
28
|
+
setInterval(async () => {
|
|
29
|
+
if (isProcessing) return;
|
|
30
|
+
isProcessing = true;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await notificationService.processPendingNotifications();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('Error in processPendingNotifications:', error);
|
|
36
|
+
} finally {
|
|
37
|
+
isProcessing = false;
|
|
38
|
+
}
|
|
39
|
+
}, 10000); // Every 10 seconds
|
|
29
40
|
}
|
|
30
41
|
export const models = {
|
|
31
42
|
NotificationModel,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import notifications from '../controllers/notifications.controller.js';
|
|
2
2
|
// routes/notifications.routes.js
|
|
3
|
-
const notificationsRoutes = (app, db, wss, origins, publicPath) => {
|
|
4
|
-
const controller = notifications(db, wss);
|
|
3
|
+
const notificationsRoutes = (app, db, wss, origins, publicPath, notificationService) => {
|
|
4
|
+
const controller = notifications(db, wss, notificationService);
|
|
5
5
|
// Get notifications for a user
|
|
6
6
|
app.get('/api/notifications/user/:userId', controller.getUserNotifications);
|
|
7
7
|
// Create a new notification
|
|
8
8
|
app.post('/api/notifications', controller.create);
|
|
9
|
+
// Create multiple notifications at once
|
|
10
|
+
app.post('/api/notifications/batch', controller.createBatch);
|
|
9
11
|
// Mark notification as read
|
|
10
12
|
app.put('/api/notifications/:id/read', controller.markAsRead);
|
|
11
13
|
// Mark all notifications as read for a user
|
|
@@ -17,7 +17,7 @@ export default (function (db, wss) {
|
|
|
17
17
|
const userId = notification.userId.toString();
|
|
18
18
|
// Get user preferences
|
|
19
19
|
const preferences = await db.notificationPreference.find({
|
|
20
|
-
userId: userId,
|
|
20
|
+
userId: new ObjectId(userId),
|
|
21
21
|
// notificationType: notification.type
|
|
22
22
|
});
|
|
23
23
|
console.log('userId', userId);
|
|
@@ -40,64 +40,135 @@ export default (function (db, wss) {
|
|
|
40
40
|
};
|
|
41
41
|
// Get all active devices for push notifications
|
|
42
42
|
const userDevices = await db.userDevice.find({
|
|
43
|
-
userId,
|
|
43
|
+
userId: new ObjectId(userId),
|
|
44
44
|
isActive: true,
|
|
45
45
|
});
|
|
46
|
+
console.log('=== CHANNEL SELECTION DEBUG ===');
|
|
47
|
+
console.log('userDevices found:', userDevices.length);
|
|
48
|
+
console.log('userDevices:', userDevices);
|
|
49
|
+
console.log('user.email:', user.email);
|
|
50
|
+
console.log('user.phoneNumber:', user.phoneNumber);
|
|
51
|
+
console.log('preferences.length:', preferences.length);
|
|
52
|
+
|
|
46
53
|
// Default channels if no preferences set
|
|
47
54
|
let channels = ['web']; // Web is always on by default
|
|
55
|
+
|
|
56
|
+
// If user has devices, add push to default channels
|
|
57
|
+
if (userDevices.length > 0) {
|
|
58
|
+
channels.push('push');
|
|
59
|
+
console.log('Added push channel - devices found');
|
|
60
|
+
} else {
|
|
61
|
+
console.log('No push channel - no devices found');
|
|
62
|
+
}
|
|
63
|
+
|
|
48
64
|
// If user has email, add it to default channels
|
|
49
65
|
if (user.email) {
|
|
50
66
|
channels.push('email');
|
|
67
|
+
console.log('Added email channel');
|
|
51
68
|
}
|
|
52
69
|
// If user has phone, add SMS to default channels
|
|
53
70
|
if (user.phoneNumber) {
|
|
54
71
|
channels.push('sms');
|
|
72
|
+
console.log('Added SMS channel');
|
|
55
73
|
}
|
|
56
74
|
// Override with user preferences if they exist
|
|
57
75
|
if (preferences.length > 0) {
|
|
58
76
|
channels = preferences.filter(pref => pref.isEnabled).map(pref => pref.channelType);
|
|
77
|
+
console.log('Overridden with user preferences:', channels);
|
|
59
78
|
}
|
|
60
|
-
console.log('
|
|
61
|
-
// Send to each enabled channel
|
|
79
|
+
console.log('=== FINAL CHANNELS ===', channels);
|
|
80
|
+
// Send to each enabled channel - parallel processing
|
|
81
|
+
const channelPromises = [];
|
|
82
|
+
|
|
62
83
|
for (const channel of channels) {
|
|
84
|
+
console.log(`=== PREPARING CHANNEL: ${channel} ===`);
|
|
63
85
|
const sendFunc = channelRouters[channel];
|
|
64
|
-
if (sendFunc) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
if (!sendFunc) {
|
|
87
|
+
channelPromises.push(Promise.resolve({
|
|
88
|
+
channel,
|
|
89
|
+
success: false,
|
|
90
|
+
error: 'No send function'
|
|
91
|
+
}));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (channel === 'push') {
|
|
96
|
+
console.log(`Preparing push to ${userDevices.length} devices`);
|
|
97
|
+
// Each device as separate promise for true parallelism
|
|
98
|
+
for (const device of userDevices) {
|
|
99
|
+
channelPromises.push(
|
|
100
|
+
sendFunc(notification, user, device)
|
|
101
|
+
.then(() => {
|
|
102
|
+
console.log(`Push sent successfully to device ${device.deviceId}`);
|
|
103
|
+
return { channel: 'push', deviceId: device.deviceId, success: true };
|
|
104
|
+
})
|
|
105
|
+
.catch(err => {
|
|
106
|
+
console.error(`Push failed for device ${device.deviceId}:`, err);
|
|
107
|
+
return { channel: 'push', deviceId: device.deviceId, success: false, error: err.message };
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
channelPromises.push(
|
|
113
|
+
sendFunc(notification, user)
|
|
114
|
+
.then(() => {
|
|
115
|
+
console.log(`${channel} notification sent successfully`);
|
|
116
|
+
return { channel, success: true };
|
|
117
|
+
})
|
|
118
|
+
.catch(err => {
|
|
119
|
+
console.error(`${channel} notification failed:`, err);
|
|
120
|
+
return { channel, success: false, error: err.message };
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log(`=== PROCESSING ${channelPromises.length} PARALLEL OPERATIONS ===`);
|
|
127
|
+
const results = await Promise.allSettled(channelPromises);
|
|
128
|
+
|
|
129
|
+
// Process results and create batch logs
|
|
130
|
+
const logs = [];
|
|
131
|
+
const channelSuccessMap = new Map();
|
|
132
|
+
|
|
133
|
+
results.forEach(({ status, value }) => {
|
|
134
|
+
if (status === 'fulfilled' && value) {
|
|
135
|
+
const logEntry = {
|
|
136
|
+
notificationId: notification._id,
|
|
137
|
+
userId: notification.userId,
|
|
138
|
+
channelType: value.channel,
|
|
139
|
+
status: value.success ? 'sent' : 'failed',
|
|
140
|
+
sentAt: Date.now()
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
if (!value.success) {
|
|
144
|
+
logEntry.error = value.error;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
logs.push(logEntry);
|
|
148
|
+
|
|
149
|
+
// Mark channel success
|
|
150
|
+
if (value.success) {
|
|
151
|
+
channelSuccessMap.set(value.channel, true);
|
|
98
152
|
}
|
|
99
153
|
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Fire and forget batch log insertion
|
|
157
|
+
if (logs.length > 0) {
|
|
158
|
+
setImmediate(() => db.notificationLog.insertMany(logs).catch(console.error));
|
|
159
|
+
console.log(`Scheduled ${logs.length} logs for batch insertion`);
|
|
100
160
|
}
|
|
161
|
+
|
|
162
|
+
const hasSuccessfulSend = channelSuccessMap.size > 0;
|
|
163
|
+
console.log(`=== PROCESSING COMPLETE - Success: ${hasSuccessfulSend} ===`);
|
|
164
|
+
|
|
165
|
+
// Fire and forget status update
|
|
166
|
+
setImmediate(() => {
|
|
167
|
+
db.notification.findByIdAndUpdate(notification._id, {
|
|
168
|
+
status: hasSuccessfulSend ? 'sent' : 'failed',
|
|
169
|
+
updatedAt: Date.now(),
|
|
170
|
+
}).catch(console.error);
|
|
171
|
+
});
|
|
101
172
|
} catch (error) {
|
|
102
173
|
console.error('Error processing notification:', error);
|
|
103
174
|
// Update notification status to failed
|
|
@@ -237,24 +237,26 @@ const actions = {
|
|
|
237
237
|
handleNotificationAction(data) {
|
|
238
238
|
// Mark notification as read if ID is provided
|
|
239
239
|
if (data.notificationId) {
|
|
240
|
-
|
|
240
|
+
actions.markAsRead(data.notificationId);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
243
|
+
return true
|
|
244
|
+
|
|
245
|
+
// // Navigate based on notification type and metadata
|
|
246
|
+
// if (data.route) {
|
|
247
|
+
// // router.push(data.route);
|
|
248
|
+
// alert('1');
|
|
249
|
+
// } else if (data.type === 'order') {
|
|
250
|
+
// // router.push(`/orders/${data.orderId}`);
|
|
251
|
+
// alert('2');
|
|
252
|
+
// } else if (data.type === 'message') {
|
|
253
|
+
// // router.push('/messages');
|
|
254
|
+
// alert('3');
|
|
255
|
+
// } else {
|
|
256
|
+
// // Default to notifications page
|
|
257
|
+
// // router.push('/notifications');
|
|
258
|
+
// alert('4');
|
|
259
|
+
// }
|
|
258
260
|
},
|
|
259
261
|
|
|
260
262
|
/**
|
|
@@ -268,7 +270,13 @@ const actions = {
|
|
|
268
270
|
return;
|
|
269
271
|
}
|
|
270
272
|
|
|
273
|
+
console.log('=== markAllAsRead API call ===');
|
|
274
|
+
console.log('URL:', `/api/notifications/user/${userId}/read-all`);
|
|
275
|
+
|
|
271
276
|
const response = await $axios.put(`/api/notifications/user/${userId}/read-all`);
|
|
277
|
+
|
|
278
|
+
console.log('markAllAsRead response status:', response.status);
|
|
279
|
+
console.log('markAllAsRead response data:', response.data);
|
|
272
280
|
|
|
273
281
|
// Update all notifications in local state
|
|
274
282
|
state.notifications.forEach(notification => {
|
|
@@ -277,6 +285,7 @@ const actions = {
|
|
|
277
285
|
});
|
|
278
286
|
|
|
279
287
|
updateUnreadCount();
|
|
288
|
+
console.log('Local state updated, unread count:', state.unreadCount);
|
|
280
289
|
return response.data;
|
|
281
290
|
} catch (error) {
|
|
282
291
|
setError(error);
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
<!-- Empty State -->
|
|
18
18
|
<p v-if="!(shopcart.state.positions.length > 0)" class="mn-t-medium"><i>{{t('emptystate')}}</i></p>
|
|
19
19
|
<!-- Shopcart positions -->
|
|
20
|
-
<pre>{{shopcart.state.positions}}</pre>
|
|
21
20
|
<CardOrderItem
|
|
22
21
|
v-for="(product, index) in shopcart.state.positions"
|
|
23
22
|
:key="`${product._id}_${product.variant || 'no-variant'}_${index}`"
|