@open-mercato/core 0.4.2-canary-15c0b23a3a → 0.4.2-canary-da2b080494

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 (433) hide show
  1. package/dist/generated/entities.ids.generated.js +1 -5
  2. package/dist/generated/entities.ids.generated.js.map +2 -2
  3. package/dist/generated/entity-fields-registry.js +0 -2
  4. package/dist/generated/entity-fields-registry.js.map +2 -2
  5. package/dist/modules/api_docs/frontend/docs/api/page.js +2 -3
  6. package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
  7. package/dist/modules/api_keys/backend/api-keys/page.js +1 -1
  8. package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
  9. package/dist/modules/attachments/components/AttachmentLibrary.js +0 -4
  10. package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
  11. package/dist/modules/attachments/components/AttachmentPartitionSettings.js +0 -2
  12. package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
  13. package/dist/modules/auth/api/admin/nav.js +3 -4
  14. package/dist/modules/auth/api/admin/nav.js.map +2 -2
  15. package/dist/modules/auth/api/reset/confirm.js +2 -25
  16. package/dist/modules/auth/api/reset/confirm.js.map +2 -2
  17. package/dist/modules/auth/api/reset.js +0 -23
  18. package/dist/modules/auth/api/reset.js.map +2 -2
  19. package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
  20. package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
  21. package/dist/modules/auth/api/users/route.js +2 -4
  22. package/dist/modules/auth/api/users/route.js.map +2 -2
  23. package/dist/modules/auth/backend/roles/[id]/edit/page.js +1 -4
  24. package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
  25. package/dist/modules/auth/backend/roles/page.js +3 -3
  26. package/dist/modules/auth/backend/roles/page.js.map +2 -2
  27. package/dist/modules/auth/backend/users/[id]/edit/page.js +3 -18
  28. package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
  29. package/dist/modules/auth/backend/users/create/page.js +2 -15
  30. package/dist/modules/auth/backend/users/create/page.js.map +2 -2
  31. package/dist/modules/auth/backend/users/page.js +3 -3
  32. package/dist/modules/auth/backend/users/page.js.map +2 -2
  33. package/dist/modules/auth/cli.js +11 -25
  34. package/dist/modules/auth/cli.js.map +2 -2
  35. package/dist/modules/auth/commands/users.js +2 -59
  36. package/dist/modules/auth/commands/users.js.map +2 -2
  37. package/dist/modules/auth/data/validators.js +2 -4
  38. package/dist/modules/auth/data/validators.js.map +2 -2
  39. package/dist/modules/auth/frontend/reset/[token]/page.js +10 -20
  40. package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
  41. package/dist/modules/auth/lib/setup-app.js +0 -1
  42. package/dist/modules/auth/lib/setup-app.js.map +2 -2
  43. package/dist/modules/auth/services/authService.js +3 -3
  44. package/dist/modules/auth/services/authService.js.map +2 -2
  45. package/dist/modules/business_rules/api/execute/route.js +1 -7
  46. package/dist/modules/business_rules/api/execute/route.js.map +2 -2
  47. package/dist/modules/business_rules/backend/rules/page.js +0 -4
  48. package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
  49. package/dist/modules/business_rules/backend/sets/page.js +0 -3
  50. package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
  51. package/dist/modules/business_rules/lib/rule-engine.js +3 -33
  52. package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
  53. package/dist/modules/catalog/components/PriceKindSettings.js +0 -2
  54. package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
  55. package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -2
  56. package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
  57. package/dist/modules/catalog/components/products/ProductsDataTable.js +0 -2
  58. package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
  59. package/dist/modules/configs/cli.js +0 -6
  60. package/dist/modules/configs/cli.js.map +2 -2
  61. package/dist/modules/configs/components/CachePanel.js +4 -4
  62. package/dist/modules/configs/components/CachePanel.js.map +2 -2
  63. package/dist/modules/configs/lib/system-status.js +1 -48
  64. package/dist/modules/configs/lib/system-status.js.map +2 -2
  65. package/dist/modules/configs/lib/upgrade-actions.js +0 -18
  66. package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
  67. package/dist/modules/currencies/backend/currencies/page.js +0 -3
  68. package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
  69. package/dist/modules/currencies/backend/exchange-rates/page.js +0 -2
  70. package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
  71. package/dist/modules/customers/backend/customers/companies/page.js +0 -3
  72. package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
  73. package/dist/modules/customers/backend/customers/deals/page.js +0 -3
  74. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  75. package/dist/modules/customers/backend/customers/people/page.js +0 -3
  76. package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
  77. package/dist/modules/customers/commands/deals.js +0 -31
  78. package/dist/modules/customers/commands/deals.js.map +2 -2
  79. package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
  80. package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
  81. package/dist/modules/dashboards/cli.js +5 -44
  82. package/dist/modules/dashboards/cli.js.map +2 -2
  83. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +11 -16
  84. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +3 -3
  85. package/dist/modules/dashboards/services/widgetDataService.js +3 -132
  86. package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
  87. package/dist/modules/dictionaries/components/DictionaryTable.js +0 -2
  88. package/dist/modules/dictionaries/components/DictionaryTable.js.map +2 -2
  89. package/dist/modules/directory/backend/directory/organizations/page.js +2 -2
  90. package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
  91. package/dist/modules/directory/backend/directory/tenants/page.js +2 -2
  92. package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
  93. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +2 -2
  94. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
  95. package/dist/modules/entities/components/SystemEntitiesTable.js +1 -1
  96. package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
  97. package/dist/modules/entities/components/UserEntitiesTable.js +2 -2
  98. package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
  99. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +3 -3
  100. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
  101. package/dist/modules/feature_toggles/components/OverridesTable.js +1 -1
  102. package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
  103. package/dist/modules/planner/backend/planner/availability-rulesets/page.js +2 -2
  104. package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
  105. package/dist/modules/query_index/components/QueryIndexesTable.js +1 -7
  106. package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
  107. package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
  108. package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
  109. package/dist/modules/resources/backend/resources/resources/page.js +2 -2
  110. package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
  111. package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -2
  112. package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
  113. package/dist/modules/sales/backend/sales/channels/page.js +0 -2
  114. package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
  115. package/dist/modules/sales/commands/documents.js +0 -53
  116. package/dist/modules/sales/commands/documents.js.map +2 -2
  117. package/dist/modules/sales/commands/payments.js +0 -26
  118. package/dist/modules/sales/commands/payments.js.map +2 -2
  119. package/dist/modules/sales/components/AdjustmentKindSettings.js +2 -2
  120. package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
  121. package/dist/modules/sales/components/PaymentMethodsSettings.js +2 -2
  122. package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
  123. package/dist/modules/sales/components/ShippingMethodsSettings.js +2 -2
  124. package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
  125. package/dist/modules/sales/components/TaxRatesSettings.js +2 -2
  126. package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
  127. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -2
  128. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
  129. package/dist/modules/sales/components/documents/AdjustmentsSection.js +0 -2
  130. package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
  131. package/dist/modules/sales/components/documents/PaymentsSection.js +1 -2
  132. package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
  133. package/dist/modules/sales/components/documents/SalesDocumentsTable.js +0 -2
  134. package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
  135. package/dist/modules/staff/backend/staff/team-members/page.js +1 -1
  136. package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
  137. package/dist/modules/staff/backend/staff/team-roles/page.js +2 -2
  138. package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
  139. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +2 -2
  140. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  141. package/dist/modules/staff/backend/staff/teams/page.js +2 -2
  142. package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
  143. package/dist/modules/staff/commands/leave-requests.js +0 -79
  144. package/dist/modules/staff/commands/leave-requests.js.map +2 -2
  145. package/dist/modules/workflows/backend/definitions/page.js +0 -5
  146. package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
  147. package/dist/modules/workflows/backend/instances/page.js +0 -3
  148. package/dist/modules/workflows/backend/instances/page.js.map +2 -2
  149. package/dist/modules/workflows/backend/tasks/page.js +0 -3
  150. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  151. package/dist/modules/workflows/lib/transition-handler.js +6 -14
  152. package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
  153. package/generated/entities.ids.generated.ts +1 -5
  154. package/generated/entity-fields-registry.ts +0 -2
  155. package/package.json +2 -2
  156. package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
  157. package/src/modules/api_keys/backend/api-keys/page.tsx +1 -1
  158. package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -4
  159. package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +0 -2
  160. package/src/modules/auth/README.md +1 -1
  161. package/src/modules/auth/__tests__/cli-setup-acl.test.ts +1 -1
  162. package/src/modules/auth/api/admin/nav.ts +6 -10
  163. package/src/modules/auth/api/reset/confirm.ts +2 -25
  164. package/src/modules/auth/api/reset.ts +0 -23
  165. package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
  166. package/src/modules/auth/api/users/route.ts +2 -5
  167. package/src/modules/auth/backend/roles/[id]/edit/page.tsx +1 -4
  168. package/src/modules/auth/backend/roles/page.tsx +3 -3
  169. package/src/modules/auth/backend/users/[id]/edit/page.tsx +3 -22
  170. package/src/modules/auth/backend/users/create/page.tsx +2 -19
  171. package/src/modules/auth/backend/users/page.tsx +3 -3
  172. package/src/modules/auth/cli.ts +11 -38
  173. package/src/modules/auth/commands/users.ts +2 -73
  174. package/src/modules/auth/data/validators.ts +2 -5
  175. package/src/modules/auth/frontend/reset/[token]/page.tsx +11 -24
  176. package/src/modules/auth/i18n/de.json +1 -43
  177. package/src/modules/auth/i18n/en.json +1 -43
  178. package/src/modules/auth/i18n/es.json +1 -43
  179. package/src/modules/auth/i18n/pl.json +1 -43
  180. package/src/modules/auth/lib/setup-app.ts +0 -1
  181. package/src/modules/auth/services/authService.ts +4 -4
  182. package/src/modules/business_rules/api/execute/route.ts +1 -8
  183. package/src/modules/business_rules/backend/rules/page.tsx +0 -4
  184. package/src/modules/business_rules/backend/sets/page.tsx +0 -3
  185. package/src/modules/business_rules/i18n/en.json +1 -3
  186. package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -51
  187. package/src/modules/business_rules/lib/rule-engine.ts +3 -57
  188. package/src/modules/catalog/components/PriceKindSettings.tsx +0 -2
  189. package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +2 -2
  190. package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -2
  191. package/src/modules/catalog/i18n/en.json +1 -3
  192. package/src/modules/configs/cli.ts +0 -6
  193. package/src/modules/configs/components/CachePanel.tsx +4 -4
  194. package/src/modules/configs/i18n/en.json +2 -12
  195. package/src/modules/configs/i18n/pl.json +2 -12
  196. package/src/modules/configs/lib/system-status.ts +1 -48
  197. package/src/modules/configs/lib/system-status.types.ts +0 -1
  198. package/src/modules/configs/lib/upgrade-actions.ts +0 -18
  199. package/src/modules/currencies/backend/currencies/page.tsx +0 -3
  200. package/src/modules/currencies/backend/exchange-rates/page.tsx +0 -2
  201. package/src/modules/customers/backend/customers/companies/page.tsx +0 -3
  202. package/src/modules/customers/backend/customers/deals/page.tsx +0 -3
  203. package/src/modules/customers/backend/customers/people/page.tsx +0 -3
  204. package/src/modules/customers/commands/deals.ts +0 -39
  205. package/src/modules/customers/components/CustomerTodosTable.tsx +0 -1
  206. package/src/modules/customers/i18n/en.json +1 -5
  207. package/src/modules/dashboards/cli.ts +5 -55
  208. package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +11 -22
  209. package/src/modules/dashboards/services/widgetDataService.ts +4 -157
  210. package/src/modules/dictionaries/components/DictionaryTable.tsx +0 -2
  211. package/src/modules/directory/backend/directory/organizations/page.tsx +2 -2
  212. package/src/modules/directory/backend/directory/tenants/page.tsx +2 -2
  213. package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +2 -2
  214. package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -1
  215. package/src/modules/entities/components/UserEntitiesTable.tsx +2 -2
  216. package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +4 -3
  217. package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -1
  218. package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +2 -2
  219. package/src/modules/query_index/components/QueryIndexesTable.tsx +2 -8
  220. package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -2
  221. package/src/modules/resources/backend/resources/resources/page.tsx +2 -2
  222. package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -2
  223. package/src/modules/sales/backend/sales/channels/page.tsx +0 -2
  224. package/src/modules/sales/commands/documents.ts +0 -65
  225. package/src/modules/sales/commands/payments.ts +0 -33
  226. package/src/modules/sales/components/AdjustmentKindSettings.tsx +2 -2
  227. package/src/modules/sales/components/PaymentMethodsSettings.tsx +2 -2
  228. package/src/modules/sales/components/ShippingMethodsSettings.tsx +2 -2
  229. package/src/modules/sales/components/TaxRatesSettings.tsx +2 -2
  230. package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -2
  231. package/src/modules/sales/components/documents/AdjustmentsSection.tsx +0 -2
  232. package/src/modules/sales/components/documents/PaymentsSection.tsx +1 -2
  233. package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +0 -2
  234. package/src/modules/sales/i18n/de.json +0 -20
  235. package/src/modules/sales/i18n/en.json +1 -25
  236. package/src/modules/sales/i18n/es.json +0 -20
  237. package/src/modules/sales/i18n/pl.json +0 -20
  238. package/src/modules/staff/backend/staff/team-members/page.tsx +1 -1
  239. package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
  240. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +2 -2
  241. package/src/modules/staff/backend/staff/teams/page.tsx +2 -2
  242. package/src/modules/staff/commands/leave-requests.ts +0 -94
  243. package/src/modules/staff/i18n/de.json +0 -4
  244. package/src/modules/staff/i18n/en.json +1 -9
  245. package/src/modules/staff/i18n/es.json +0 -4
  246. package/src/modules/staff/i18n/pl.json +0 -4
  247. package/src/modules/workflows/backend/definitions/page.tsx +0 -5
  248. package/src/modules/workflows/backend/instances/page.tsx +1 -4
  249. package/src/modules/workflows/backend/tasks/page.tsx +1 -4
  250. package/src/modules/workflows/i18n/en.json +1 -3
  251. package/src/modules/workflows/lib/transition-handler.ts +6 -18
  252. package/dist/generated/entities/notification/index.js +0 -57
  253. package/dist/generated/entities/notification/index.js.map +0 -7
  254. package/dist/modules/auth/api/profile/route.js +0 -157
  255. package/dist/modules/auth/api/profile/route.js.map +0 -7
  256. package/dist/modules/auth/backend/auth/profile/page.js +0 -141
  257. package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
  258. package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -13
  259. package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
  260. package/dist/modules/auth/notifications.js +0 -112
  261. package/dist/modules/auth/notifications.js.map +0 -7
  262. package/dist/modules/business_rules/notifications.js +0 -28
  263. package/dist/modules/business_rules/notifications.js.map +0 -7
  264. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
  265. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
  266. package/dist/modules/catalog/notifications.js +0 -28
  267. package/dist/modules/catalog/notifications.js.map +0 -7
  268. package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
  269. package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
  270. package/dist/modules/customers/notifications.js +0 -48
  271. package/dist/modules/customers/notifications.js.map +0 -7
  272. package/dist/modules/dashboards/lib/role-widgets.js +0 -58
  273. package/dist/modules/dashboards/lib/role-widgets.js.map +0 -7
  274. package/dist/modules/notifications/acl.js +0 -11
  275. package/dist/modules/notifications/acl.js.map +0 -7
  276. package/dist/modules/notifications/api/[id]/action/route.js +0 -74
  277. package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
  278. package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
  279. package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
  280. package/dist/modules/notifications/api/[id]/read/route.js +0 -15
  281. package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
  282. package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
  283. package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
  284. package/dist/modules/notifications/api/batch/route.js +0 -17
  285. package/dist/modules/notifications/api/batch/route.js.map +0 -7
  286. package/dist/modules/notifications/api/feature/route.js +0 -17
  287. package/dist/modules/notifications/api/feature/route.js.map +0 -7
  288. package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
  289. package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
  290. package/dist/modules/notifications/api/openapi.js +0 -76
  291. package/dist/modules/notifications/api/openapi.js.map +0 -7
  292. package/dist/modules/notifications/api/role/route.js +0 -17
  293. package/dist/modules/notifications/api/role/route.js.map +0 -7
  294. package/dist/modules/notifications/api/route.js +0 -85
  295. package/dist/modules/notifications/api/route.js.map +0 -7
  296. package/dist/modules/notifications/api/settings/route.js +0 -155
  297. package/dist/modules/notifications/api/settings/route.js.map +0 -7
  298. package/dist/modules/notifications/api/unread-count/route.js +0 -38
  299. package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
  300. package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
  301. package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
  302. package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
  303. package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
  304. package/dist/modules/notifications/cli.js +0 -16
  305. package/dist/modules/notifications/cli.js.map +0 -7
  306. package/dist/modules/notifications/data/entities.js +0 -112
  307. package/dist/modules/notifications/data/entities.js.map +0 -7
  308. package/dist/modules/notifications/data/validators.js +0 -98
  309. package/dist/modules/notifications/data/validators.js.map +0 -7
  310. package/dist/modules/notifications/di.js +0 -13
  311. package/dist/modules/notifications/di.js.map +0 -7
  312. package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
  313. package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
  314. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
  315. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
  316. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -220
  317. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
  318. package/dist/modules/notifications/index.js +0 -14
  319. package/dist/modules/notifications/index.js.map +0 -7
  320. package/dist/modules/notifications/lib/deliveryConfig.js +0 -107
  321. package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
  322. package/dist/modules/notifications/lib/deliveryStrategies.js +0 -14
  323. package/dist/modules/notifications/lib/deliveryStrategies.js.map +0 -7
  324. package/dist/modules/notifications/lib/events.js +0 -12
  325. package/dist/modules/notifications/lib/events.js.map +0 -7
  326. package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
  327. package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
  328. package/dist/modules/notifications/lib/notificationFactory.js +0 -54
  329. package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
  330. package/dist/modules/notifications/lib/notificationMapper.js +0 -34
  331. package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
  332. package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
  333. package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
  334. package/dist/modules/notifications/lib/notificationService.js +0 -279
  335. package/dist/modules/notifications/lib/notificationService.js.map +0 -7
  336. package/dist/modules/notifications/lib/routeHelpers.js +0 -101
  337. package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
  338. package/dist/modules/notifications/lib/safeHref.js +0 -24
  339. package/dist/modules/notifications/lib/safeHref.js.map +0 -7
  340. package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
  341. package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
  342. package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
  343. package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
  344. package/dist/modules/notifications/subscribers/deliver-notification.js +0 -165
  345. package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
  346. package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
  347. package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
  348. package/dist/modules/sales/notifications.client.js +0 -51
  349. package/dist/modules/sales/notifications.client.js.map +0 -7
  350. package/dist/modules/sales/notifications.js +0 -88
  351. package/dist/modules/sales/notifications.js.map +0 -7
  352. package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
  353. package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
  354. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
  355. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
  356. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
  357. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
  358. package/dist/modules/sales/widgets/notifications/index.js +0 -7
  359. package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
  360. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
  361. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
  362. package/dist/modules/staff/notifications.js +0 -75
  363. package/dist/modules/staff/notifications.js.map +0 -7
  364. package/dist/modules/workflows/notifications.js +0 -28
  365. package/dist/modules/workflows/notifications.js.map +0 -7
  366. package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
  367. package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
  368. package/generated/entities/notification/index.ts +0 -27
  369. package/src/modules/auth/api/profile/route.ts +0 -163
  370. package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -9
  371. package/src/modules/auth/backend/auth/profile/page.tsx +0 -174
  372. package/src/modules/auth/notifications.ts +0 -109
  373. package/src/modules/business_rules/notifications.ts +0 -25
  374. package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
  375. package/src/modules/catalog/notifications.ts +0 -25
  376. package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
  377. package/src/modules/customers/notifications.ts +0 -44
  378. package/src/modules/dashboards/lib/role-widgets.ts +0 -80
  379. package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -195
  380. package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
  381. package/src/modules/notifications/__tests__/notificationService.test.ts +0 -208
  382. package/src/modules/notifications/acl.ts +0 -7
  383. package/src/modules/notifications/api/[id]/action/route.ts +0 -75
  384. package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
  385. package/src/modules/notifications/api/[id]/read/route.ts +0 -12
  386. package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
  387. package/src/modules/notifications/api/batch/route.ts +0 -14
  388. package/src/modules/notifications/api/feature/route.ts +0 -14
  389. package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
  390. package/src/modules/notifications/api/openapi.ts +0 -76
  391. package/src/modules/notifications/api/role/route.ts +0 -14
  392. package/src/modules/notifications/api/route.ts +0 -92
  393. package/src/modules/notifications/api/settings/route.ts +0 -157
  394. package/src/modules/notifications/api/unread-count/route.ts +0 -38
  395. package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
  396. package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
  397. package/src/modules/notifications/cli.ts +0 -18
  398. package/src/modules/notifications/data/entities.ts +0 -99
  399. package/src/modules/notifications/data/validators.ts +0 -115
  400. package/src/modules/notifications/di.ts +0 -11
  401. package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
  402. package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
  403. package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -233
  404. package/src/modules/notifications/i18n/de.json +0 -50
  405. package/src/modules/notifications/i18n/en.json +0 -50
  406. package/src/modules/notifications/i18n/es.json +0 -50
  407. package/src/modules/notifications/i18n/pl.json +0 -50
  408. package/src/modules/notifications/index.ts +0 -12
  409. package/src/modules/notifications/lib/deliveryConfig.ts +0 -153
  410. package/src/modules/notifications/lib/deliveryStrategies.ts +0 -50
  411. package/src/modules/notifications/lib/events.ts +0 -48
  412. package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
  413. package/src/modules/notifications/lib/notificationFactory.ts +0 -76
  414. package/src/modules/notifications/lib/notificationMapper.ts +0 -33
  415. package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
  416. package/src/modules/notifications/lib/notificationService.ts +0 -414
  417. package/src/modules/notifications/lib/routeHelpers.ts +0 -151
  418. package/src/modules/notifications/lib/safeHref.ts +0 -29
  419. package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -300
  420. package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
  421. package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
  422. package/src/modules/notifications/subscribers/deliver-notification.ts +0 -204
  423. package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
  424. package/src/modules/sales/notifications.client.ts +0 -65
  425. package/src/modules/sales/notifications.ts +0 -82
  426. package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
  427. package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
  428. package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
  429. package/src/modules/sales/widgets/notifications/index.ts +0 -2
  430. package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
  431. package/src/modules/staff/notifications.ts +0 -71
  432. package/src/modules/workflows/notifications.ts +0 -25
  433. package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/data/validators.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\nimport { isSafeNotificationHref } from '../lib/safeHref'\n\nexport const notificationStatusSchema = z.enum(['unread', 'read', 'actioned', 'dismissed'])\nexport const notificationSeveritySchema = z.enum(['info', 'warning', 'success', 'error'])\n\nexport const safeRelativeHrefSchema = z.string().min(1).refine(\n (href) => isSafeNotificationHref(href),\n { message: 'Href must be a same-origin relative path starting with /' }\n)\n\nexport const notificationActionSchema = z.object({\n id: z.string().min(1),\n label: z.string().min(1),\n labelKey: z.string().optional(),\n variant: z.enum(['default', 'secondary', 'destructive', 'outline', 'ghost']).optional(),\n icon: z.string().optional(),\n commandId: z.string().optional(),\n href: safeRelativeHrefSchema.optional(),\n confirmRequired: z.boolean().optional(),\n confirmMessage: z.string().optional(),\n})\n\nconst baseNotificationFieldsSchema = z.object({\n type: z.string().min(1).max(100),\n titleKey: z.string().min(1).max(200).optional(),\n bodyKey: z.string().min(1).max(200).optional(),\n titleVariables: z.record(z.string(), z.string()).optional(),\n bodyVariables: z.record(z.string(), z.string()).optional(),\n title: z.string().min(1).max(500).optional(),\n body: z.string().max(2000).optional(),\n icon: z.string().max(100).optional(),\n severity: notificationSeveritySchema.optional().default('info'),\n actions: z.array(notificationActionSchema).optional(),\n primaryActionId: z.string().optional(),\n sourceModule: z.string().optional(),\n sourceEntityType: z.string().optional(),\n sourceEntityId: z.string().uuid().optional(),\n linkHref: safeRelativeHrefSchema.optional(),\n groupKey: z.string().optional(),\n expiresAt: z.string().datetime().optional(),\n})\n\nconst titleRequiredRefinement = {\n refine: (data: { titleKey?: string; title?: string }) => data.titleKey || data.title,\n message: 'Either titleKey or title must be provided',\n} as const\n\nexport const createNotificationSchema = baseNotificationFieldsSchema\n .extend({ recipientUserId: z.string().uuid() })\n .refine(titleRequiredRefinement.refine, { message: titleRequiredRefinement.message })\n\nexport const createBatchNotificationSchema = baseNotificationFieldsSchema\n .extend({ recipientUserIds: z.array(z.string().uuid()).min(1).max(1000) })\n .refine(titleRequiredRefinement.refine, { message: titleRequiredRefinement.message })\n\nexport const createRoleNotificationSchema = baseNotificationFieldsSchema\n .extend({ roleId: z.string().uuid() })\n .refine(titleRequiredRefinement.refine, { message: titleRequiredRefinement.message })\n\nexport const createFeatureNotificationSchema = baseNotificationFieldsSchema\n .extend({ requiredFeature: z.string().min(1).max(100) })\n .refine(titleRequiredRefinement.refine, { message: titleRequiredRefinement.message })\n\nexport const listNotificationsSchema = z.object({\n status: z.union([notificationStatusSchema, z.array(notificationStatusSchema)]).optional(),\n type: z.string().optional(),\n severity: notificationSeveritySchema.optional(),\n sourceEntityType: z.string().optional(),\n sourceEntityId: z.string().uuid().optional(),\n since: z.string().datetime().optional(),\n page: z.coerce.number().int().min(1).optional().default(1),\n pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),\n})\n\nexport const executeActionSchema = z.object({\n actionId: z.string().min(1),\n payload: z.record(z.string(), z.unknown()).optional(),\n})\n\nexport const restoreNotificationSchema = z.object({\n status: z.enum(['read', 'unread']).optional(),\n})\n\nconst notificationDeliveryStrategySchema = z.object({\n enabled: z.boolean().optional(),\n})\n\nconst notificationDeliveryEmailSchema = notificationDeliveryStrategySchema.extend({\n from: z.string().trim().min(1).optional(),\n replyTo: z.string().trim().min(1).optional(),\n subjectPrefix: z.string().trim().min(1).optional(),\n})\n\nconst notificationDeliveryCustomSchema = notificationDeliveryStrategySchema.extend({\n config: z.unknown().optional(),\n})\n\nexport const notificationDeliveryConfigSchema = z.object({\n appUrl: z.string().url().optional(),\n panelPath: safeRelativeHrefSchema.optional(),\n strategies: z.object({\n database: notificationDeliveryStrategySchema.optional(),\n email: notificationDeliveryEmailSchema.optional(),\n custom: z.record(z.string(), notificationDeliveryCustomSchema).optional(),\n }).optional(),\n})\n\nexport type CreateNotificationInput = z.infer<typeof createNotificationSchema>\nexport type CreateBatchNotificationInput = z.infer<typeof createBatchNotificationSchema>\nexport type CreateRoleNotificationInput = z.infer<typeof createRoleNotificationSchema>\nexport type CreateFeatureNotificationInput = z.infer<typeof createFeatureNotificationSchema>\nexport type ListNotificationsInput = z.infer<typeof listNotificationsSchema>\nexport type ExecuteActionInput = z.infer<typeof executeActionSchema>\nexport type NotificationDeliveryConfigInput = z.infer<typeof notificationDeliveryConfigSchema>\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,8BAA8B;AAEhC,MAAM,2BAA2B,EAAE,KAAK,CAAC,UAAU,QAAQ,YAA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EAAE,IAAI,CAAC,EAAE,SAAS;AACnD,CAAC;AAED,MAAM,mCAAmC,mCAAmC,OAAO;AAAA,EACjF,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;AAEM,MAAM,mCAAmC,EAAE,OAAO;AAAA,EACvD,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAClC,WAAW,uBAAuB,SAAS;AAAA,EAC3C,YAAY,EAAE,OAAO;AAAA,IACnB,UAAU,mCAAmC,SAAS;AAAA,IACtD,OAAO,gCAAgC,SAAS;AAAA,IAChD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,gCAAgC,EAAE,SAAS;AAAA,EAC1E,CAAC,EAAE,SAAS;AACd,CAAC;",
6
- "names": []
7
- }
@@ -1,13 +0,0 @@
1
- import { asFunction } from "awilix";
2
- import { createNotificationService } from "./lib/notificationService.js";
3
- function register(container) {
4
- container.register({
5
- notificationService: asFunction(
6
- ({ em, eventBus, commandBus }) => createNotificationService({ em, eventBus, commandBus })
7
- ).scoped()
8
- });
9
- }
10
- export {
11
- register
12
- };
13
- //# sourceMappingURL=di.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/modules/notifications/di.ts"],
4
- "sourcesContent": ["import type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport { asFunction } from 'awilix'\nimport { createNotificationService } from './lib/notificationService'\n\nexport function register(container: AppContainer): void {\n container.register({\n notificationService: asFunction(({ em, eventBus, commandBus }) =>\n createNotificationService({ em, eventBus, commandBus })\n ).scoped(),\n })\n}\n"],
5
- "mappings": "AACA,SAAS,kBAAkB;AAC3B,SAAS,iCAAiC;AAEnC,SAAS,SAAS,WAA+B;AACtD,YAAU,SAAS;AAAA,IACjB,qBAAqB;AAAA,MAAW,CAAC,EAAE,IAAI,UAAU,WAAW,MAC1D,0BAA0B,EAAE,IAAI,UAAU,WAAW,CAAC;AAAA,IACxD,EAAE,OAAO;AAAA,EACX,CAAC;AACH;",
6
- "names": []
7
- }
@@ -1,58 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Html, Head, Preview, Body, Container, Heading, Text, Section, Button, Hr } from "@react-email/components";
3
- function NotificationEmail({ title, body, actions, panelUrl, copy }) {
4
- return /* @__PURE__ */ jsxs(Html, { children: [
5
- /* @__PURE__ */ jsx(Head, {}),
6
- /* @__PURE__ */ jsx(Preview, { children: copy.preview }),
7
- /* @__PURE__ */ jsx(Body, { style: { backgroundColor: "#f5f5f5", fontFamily: "Arial, sans-serif", margin: 0, padding: 0 }, children: /* @__PURE__ */ jsx(Container, { style: { maxWidth: 560, margin: "0 auto", padding: "24px" }, children: /* @__PURE__ */ jsxs(Section, { style: { backgroundColor: "#ffffff", padding: "24px", borderRadius: 12 }, children: [
8
- /* @__PURE__ */ jsx(Heading, { as: "h1", style: { fontSize: "22px", margin: "0 0 8px", color: "#111827" }, children: copy.heading }),
9
- /* @__PURE__ */ jsx(Text, { style: { margin: "0 0 16px", color: "#4b5563" }, children: title }),
10
- body && /* @__PURE__ */ jsx(Text, { style: { margin: "0 0 16px", color: "#111827", fontSize: "15px" }, children: body }),
11
- /* @__PURE__ */ jsx(Text, { style: { margin: "0 0 16px", color: "#6b7280", fontSize: "13px" }, children: copy.bodyIntro }),
12
- actions.length > 0 && /* @__PURE__ */ jsx(Section, { style: { marginBottom: 16 }, children: actions.map((action) => /* @__PURE__ */ jsx(
13
- Button,
14
- {
15
- href: action.href,
16
- style: {
17
- backgroundColor: "#111827",
18
- color: "#ffffff",
19
- padding: "10px 16px",
20
- borderRadius: 8,
21
- textDecoration: "none",
22
- display: "inline-block",
23
- marginRight: 8,
24
- marginBottom: 8,
25
- fontSize: "13px"
26
- },
27
- children: action.label
28
- },
29
- action.id
30
- )) }),
31
- /* @__PURE__ */ jsx(Text, { style: { margin: "0 0 16px", color: "#6b7280", fontSize: "12px" }, children: copy.actionNotice }),
32
- /* @__PURE__ */ jsx(
33
- Button,
34
- {
35
- href: panelUrl,
36
- style: {
37
- backgroundColor: "#2563eb",
38
- color: "#ffffff",
39
- padding: "12px 18px",
40
- borderRadius: 8,
41
- textDecoration: "none",
42
- display: "inline-block",
43
- fontSize: "14px"
44
- },
45
- children: copy.openCta
46
- }
47
- ),
48
- /* @__PURE__ */ jsx(Hr, { style: { margin: "24px 0", borderColor: "#e5e7eb" } }),
49
- /* @__PURE__ */ jsx(Text, { style: { margin: 0, color: "#9ca3af", fontSize: "12px" }, children: copy.footer })
50
- ] }) }) })
51
- ] });
52
- }
53
- var NotificationEmail_default = NotificationEmail;
54
- export {
55
- NotificationEmail,
56
- NotificationEmail_default as default
57
- };
58
- //# sourceMappingURL=NotificationEmail.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/emails/NotificationEmail.tsx"],
4
- "sourcesContent": ["import React from 'react'\nimport { Html, Head, Preview, Body, Container, Heading, Text, Section, Button, Hr } from '@react-email/components'\n\nexport type NotificationEmailAction = {\n id: string\n label: string\n href: string\n}\n\nexport type NotificationEmailCopy = {\n preview: string\n heading: string\n bodyIntro: string\n actionNotice: string\n openCta: string\n footer: string\n}\n\ntype NotificationEmailProps = {\n title: string\n body?: string | null\n actions: NotificationEmailAction[]\n panelUrl: string\n copy: NotificationEmailCopy\n}\n\nexport function NotificationEmail({ title, body, actions, panelUrl, copy }: NotificationEmailProps) {\n return (\n <Html>\n <Head />\n <Preview>{copy.preview}</Preview>\n <Body style={{ backgroundColor: '#f5f5f5', fontFamily: 'Arial, sans-serif', margin: 0, padding: 0 }}>\n <Container style={{ maxWidth: 560, margin: '0 auto', padding: '24px' }}>\n <Section style={{ backgroundColor: '#ffffff', padding: '24px', borderRadius: 12 }}>\n <Heading as=\"h1\" style={{ fontSize: '22px', margin: '0 0 8px', color: '#111827' }}>\n {copy.heading}\n </Heading>\n <Text style={{ margin: '0 0 16px', color: '#4b5563' }}>{title}</Text>\n {body && (\n <Text style={{ margin: '0 0 16px', color: '#111827', fontSize: '15px' }}>\n {body}\n </Text>\n )}\n <Text style={{ margin: '0 0 16px', color: '#6b7280', fontSize: '13px' }}>\n {copy.bodyIntro}\n </Text>\n {actions.length > 0 && (\n <Section style={{ marginBottom: 16 }}>\n {actions.map((action) => (\n <Button\n key={action.id}\n href={action.href}\n style={{\n backgroundColor: '#111827',\n color: '#ffffff',\n padding: '10px 16px',\n borderRadius: 8,\n textDecoration: 'none',\n display: 'inline-block',\n marginRight: 8,\n marginBottom: 8,\n fontSize: '13px',\n }}\n >\n {action.label}\n </Button>\n ))}\n </Section>\n )}\n <Text style={{ margin: '0 0 16px', color: '#6b7280', fontSize: '12px' }}>\n {copy.actionNotice}\n </Text>\n <Button\n href={panelUrl}\n style={{\n backgroundColor: '#2563eb',\n color: '#ffffff',\n padding: '12px 18px',\n borderRadius: 8,\n textDecoration: 'none',\n display: 'inline-block',\n fontSize: '14px',\n }}\n >\n {copy.openCta}\n </Button>\n <Hr style={{ margin: '24px 0', borderColor: '#e5e7eb' }} />\n <Text style={{ margin: 0, color: '#9ca3af', fontSize: '12px' }}>\n {copy.footer}\n </Text>\n </Section>\n </Container>\n </Body>\n </Html>\n )\n}\n\nexport default NotificationEmail\n"],
5
- "mappings": "AA6BM,cAII,YAJJ;AA5BN,SAAS,MAAM,MAAM,SAAS,MAAM,WAAW,SAAS,MAAM,SAAS,QAAQ,UAAU;AAyBlF,SAAS,kBAAkB,EAAE,OAAO,MAAM,SAAS,UAAU,KAAK,GAA2B;AAClG,SACE,qBAAC,QACC;AAAA,wBAAC,QAAK;AAAA,IACN,oBAAC,WAAS,eAAK,SAAQ;AAAA,IACvB,oBAAC,QAAK,OAAO,EAAE,iBAAiB,WAAW,YAAY,qBAAqB,QAAQ,GAAG,SAAS,EAAE,GAChG,8BAAC,aAAU,OAAO,EAAE,UAAU,KAAK,QAAQ,UAAU,SAAS,OAAO,GACnE,+BAAC,WAAQ,OAAO,EAAE,iBAAiB,WAAW,SAAS,QAAQ,cAAc,GA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,GAC1D,eAAK,QACR;AAAA,OACF,GACF,GACF;AAAA,KACF;AAEJ;AAEA,IAAO,4BAAQ;",
6
- "names": []
7
- }
@@ -1,44 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useRouter } from "next/navigation";
4
- import { useT } from "@open-mercato/shared/lib/i18n/context";
5
- import { NotificationPanel } from "@open-mercato/ui/backend/notifications";
6
- import { useNotificationsPoll } from "@open-mercato/ui/backend/notifications";
7
- function NotificationInboxPageClient() {
8
- const t = useT();
9
- const router = useRouter();
10
- const {
11
- notifications,
12
- unreadCount,
13
- markAsRead,
14
- executeAction,
15
- dismiss,
16
- dismissUndo,
17
- undoDismiss,
18
- markAllRead
19
- } = useNotificationsPoll();
20
- return /* @__PURE__ */ jsx(
21
- NotificationPanel,
22
- {
23
- open: true,
24
- onOpenChange: (open) => {
25
- if (!open) router.push("/backend");
26
- },
27
- notifications,
28
- unreadCount,
29
- onMarkAsRead: markAsRead,
30
- onExecuteAction: executeAction,
31
- onDismiss: dismiss,
32
- dismissUndo,
33
- onUndoDismiss: undoDismiss,
34
- onMarkAllRead: markAllRead,
35
- t
36
- }
37
- );
38
- }
39
- var NotificationInboxPageClient_default = NotificationInboxPageClient;
40
- export {
41
- NotificationInboxPageClient,
42
- NotificationInboxPageClient_default as default
43
- };
44
- //# sourceMappingURL=NotificationInboxPageClient.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/frontend/NotificationInboxPageClient.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { NotificationPanel } from '@open-mercato/ui/backend/notifications'\nimport { useNotificationsPoll } from '@open-mercato/ui/backend/notifications'\n\nexport function NotificationInboxPageClient() {\n const t = useT()\n const router = useRouter()\n const {\n notifications,\n unreadCount,\n markAsRead,\n executeAction,\n dismiss,\n dismissUndo,\n undoDismiss,\n markAllRead,\n } = useNotificationsPoll()\n\n return (\n <NotificationPanel\n open\n onOpenChange={(open) => {\n if (!open) router.push('/backend')\n }}\n notifications={notifications}\n unreadCount={unreadCount}\n onMarkAsRead={markAsRead}\n onExecuteAction={executeAction}\n onDismiss={dismiss}\n dismissUndo={dismissUndo}\n onUndoDismiss={undoDismiss}\n onMarkAllRead={markAllRead}\n t={t}\n />\n )\n}\n\nexport default NotificationInboxPageClient\n"],
5
- "mappings": ";AAuBI;AApBJ,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AAE9B,SAAS,8BAA8B;AAC5C,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,qBAAqB;AAEzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAI;AAAA,MACJ,cAAc,CAAC,SAAS;AACtB,YAAI,CAAC,KAAM,QAAO,KAAK,UAAU;AAAA,MACnC;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX;AAAA,MACA,eAAe;AAAA,MACf,eAAe;AAAA,MACf;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,sCAAQ;",
6
- "names": []
7
- }
@@ -1,220 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { useT } from "@open-mercato/shared/lib/i18n/context";
5
- import { apiCall, readApiResultOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
6
- import { flash } from "@open-mercato/ui/backend/FlashMessages";
7
- import { Button } from "@open-mercato/ui/primitives/button";
8
- import { Input } from "@open-mercato/ui/primitives/input";
9
- import { Label } from "@open-mercato/ui/primitives/label";
10
- import { Switch } from "@open-mercato/ui/primitives/switch";
11
- import { Spinner } from "@open-mercato/ui/primitives/spinner";
12
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@open-mercato/ui/primitives/card";
13
- const emptySettings = {
14
- panelPath: "/backend/notifications",
15
- strategies: {
16
- database: { enabled: true },
17
- email: { enabled: true },
18
- custom: {}
19
- }
20
- };
21
- function NotificationSettingsPageClient() {
22
- const t = useT();
23
- const [settings, setSettings] = React.useState(null);
24
- const [loading, setLoading] = React.useState(true);
25
- const [saving, setSaving] = React.useState(false);
26
- const [error, setError] = React.useState(null);
27
- const fetchSettings = React.useCallback(async () => {
28
- setLoading(true);
29
- setError(null);
30
- try {
31
- const body = await readApiResultOrThrow(
32
- "/api/notifications/settings",
33
- void 0,
34
- { errorMessage: t("notifications.settings.loadError", "Failed to load notification settings"), allowNullResult: true }
35
- );
36
- if (body?.settings) {
37
- setSettings(body.settings);
38
- } else {
39
- setSettings(emptySettings);
40
- }
41
- } catch (err) {
42
- const message = err instanceof Error ? err.message : t("notifications.settings.loadError", "Failed to load notification settings");
43
- setError(message);
44
- flash(message, "error");
45
- } finally {
46
- setLoading(false);
47
- }
48
- }, [t]);
49
- React.useEffect(() => {
50
- fetchSettings();
51
- }, [fetchSettings]);
52
- const updateSettings = (patch) => {
53
- setSettings((prev) => prev ? { ...prev, ...patch } : prev);
54
- };
55
- const updateStrategy = (strategy, patch) => {
56
- setSettings((prev) => {
57
- if (!prev) return prev;
58
- return {
59
- ...prev,
60
- strategies: {
61
- ...prev.strategies,
62
- [strategy]: {
63
- ...prev.strategies[strategy],
64
- ...patch
65
- }
66
- }
67
- };
68
- });
69
- };
70
- const handleSave = async () => {
71
- if (!settings) return;
72
- setSaving(true);
73
- try {
74
- const response = await apiCall("/api/notifications/settings", {
75
- method: "POST",
76
- headers: { "Content-Type": "application/json" },
77
- body: JSON.stringify(settings)
78
- });
79
- if (!response.ok) {
80
- const message = response.result?.error || t("notifications.settings.saveError", "Failed to save notification settings");
81
- throw new Error(message);
82
- }
83
- if (response.result?.settings) {
84
- setSettings(response.result.settings);
85
- }
86
- flash(t("notifications.settings.saveSuccess", "Notification settings saved"), "success");
87
- } catch (err) {
88
- const message = err instanceof Error ? err.message : t("notifications.settings.saveError", "Failed to save notification settings");
89
- flash(message, "error");
90
- } finally {
91
- setSaving(false);
92
- }
93
- };
94
- if (loading || !settings) {
95
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
96
- /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
97
- t("notifications.settings.loading", "Loading notification settings...")
98
- ] });
99
- }
100
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
101
- /* @__PURE__ */ jsxs("div", { children: [
102
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold", children: t("notifications.settings.pageTitle", "Notification Delivery") }),
103
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: t("notifications.settings.pageDescription", "Configure delivery strategies for in-app notifications.") })
104
- ] }),
105
- /* @__PURE__ */ jsxs(Card, { children: [
106
- /* @__PURE__ */ jsxs(CardHeader, { children: [
107
- /* @__PURE__ */ jsx(CardTitle, { children: t("notifications.settings.core.title", "Core delivery") }),
108
- /* @__PURE__ */ jsx(CardDescription, { children: t("notifications.settings.core.description", "Control the default notification center and panel link used by external channels.") })
109
- ] }),
110
- /* @__PURE__ */ jsxs(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
111
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
112
- /* @__PURE__ */ jsx(Label, { htmlFor: "notifications-app-url", children: t("notifications.settings.core.appUrl", "Application URL") }),
113
- /* @__PURE__ */ jsx(
114
- Input,
115
- {
116
- id: "notifications-app-url",
117
- value: settings.appUrl ?? "",
118
- placeholder: "https://app.open-mercato.com",
119
- onChange: (event) => updateSettings({ appUrl: event.target.value || void 0 })
120
- }
121
- ),
122
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("notifications.settings.core.appUrlHint", "Used to build absolute links in email notifications.") })
123
- ] }),
124
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
125
- /* @__PURE__ */ jsx(Label, { htmlFor: "notifications-panel-path", children: t("notifications.settings.core.panelPath", "Notification panel path") }),
126
- /* @__PURE__ */ jsx(
127
- Input,
128
- {
129
- id: "notifications-panel-path",
130
- value: settings.panelPath,
131
- onChange: (event) => updateSettings({ panelPath: event.target.value })
132
- }
133
- ),
134
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("notifications.settings.core.panelPathHint", "Relative path for the read-only notification panel.") })
135
- ] }),
136
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [
137
- /* @__PURE__ */ jsxs("div", { children: [
138
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("notifications.settings.core.databaseLabel", "In-app notifications") }),
139
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("notifications.settings.core.databaseHint", "Store notifications in the database for the panel and bell.") })
140
- ] }),
141
- /* @__PURE__ */ jsx(
142
- Switch,
143
- {
144
- checked: settings.strategies.database.enabled,
145
- disabled: true,
146
- onCheckedChange: (checked) => updateStrategy("database", { enabled: checked })
147
- }
148
- )
149
- ] })
150
- ] })
151
- ] }),
152
- /* @__PURE__ */ jsxs(Card, { children: [
153
- /* @__PURE__ */ jsxs(CardHeader, { children: [
154
- /* @__PURE__ */ jsx(CardTitle, { children: t("notifications.settings.email.title", "Email strategy") }),
155
- /* @__PURE__ */ jsx(CardDescription, { children: t("notifications.settings.email.description", "Send notification copies via Resend using React templates.") })
156
- ] }),
157
- /* @__PURE__ */ jsxs(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
158
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-lg border p-3 md:col-span-2", children: [
159
- /* @__PURE__ */ jsxs("div", { children: [
160
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("notifications.settings.email.enabledLabel", "Enable email delivery") }),
161
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("notifications.settings.email.enabledHint", "Email actions are read-only and link back to the notification center.") })
162
- ] }),
163
- /* @__PURE__ */ jsx(
164
- Switch,
165
- {
166
- checked: settings.strategies.email.enabled,
167
- onCheckedChange: (checked) => updateStrategy("email", { enabled: checked })
168
- }
169
- )
170
- ] }),
171
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
172
- /* @__PURE__ */ jsx(Label, { htmlFor: "notifications-email-from", children: t("notifications.settings.email.from", "From address") }),
173
- /* @__PURE__ */ jsx(
174
- Input,
175
- {
176
- id: "notifications-email-from",
177
- value: settings.strategies.email.from ?? "",
178
- placeholder: "notifications@open-mercato.com",
179
- onChange: (event) => updateStrategy("email", { from: event.target.value || void 0 })
180
- }
181
- )
182
- ] }),
183
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
184
- /* @__PURE__ */ jsx(Label, { htmlFor: "notifications-email-reply", children: t("notifications.settings.email.replyTo", "Reply-to") }),
185
- /* @__PURE__ */ jsx(
186
- Input,
187
- {
188
- id: "notifications-email-reply",
189
- value: settings.strategies.email.replyTo ?? "",
190
- placeholder: "support@open-mercato.com",
191
- onChange: (event) => updateStrategy("email", { replyTo: event.target.value || void 0 })
192
- }
193
- )
194
- ] }),
195
- /* @__PURE__ */ jsxs("div", { className: "space-y-2 md:col-span-2", children: [
196
- /* @__PURE__ */ jsx(Label, { htmlFor: "notifications-email-subject-prefix", children: t("notifications.settings.email.subjectPrefix", "Subject prefix") }),
197
- /* @__PURE__ */ jsx(
198
- Input,
199
- {
200
- id: "notifications-email-subject-prefix",
201
- value: settings.strategies.email.subjectPrefix ?? "",
202
- placeholder: "[Open Mercato]",
203
- onChange: (event) => updateStrategy("email", { subjectPrefix: event.target.value || void 0 })
204
- }
205
- )
206
- ] })
207
- ] })
208
- ] }),
209
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
210
- /* @__PURE__ */ jsx(Button, { type: "button", onClick: handleSave, disabled: saving, children: saving ? t("notifications.settings.saving", "Saving...") : t("notifications.settings.save", "Save settings") }),
211
- error && /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: error })
212
- ] })
213
- ] });
214
- }
215
- var NotificationSettingsPageClient_default = NotificationSettingsPageClient;
216
- export {
217
- NotificationSettingsPageClient,
218
- NotificationSettingsPageClient_default as default
219
- };
220
- //# sourceMappingURL=NotificationSettingsPageClient.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/frontend/NotificationSettingsPageClient.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\n\ntype NotificationDeliveryConfig = {\n appUrl?: string\n panelPath: string\n strategies: {\n database: { enabled: boolean }\n email: { enabled: boolean; from?: string; replyTo?: string; subjectPrefix?: string }\n custom?: Record<string, { enabled?: boolean; config?: unknown }>\n }\n}\n\ntype SettingsResponse = {\n settings?: NotificationDeliveryConfig\n error?: string\n}\n\nconst emptySettings: NotificationDeliveryConfig = {\n panelPath: '/backend/notifications',\n strategies: {\n database: { enabled: true },\n email: { enabled: true },\n custom: {},\n },\n}\n\nexport function NotificationSettingsPageClient() {\n const t = useT()\n const [settings, setSettings] = React.useState<NotificationDeliveryConfig | null>(null)\n const [loading, setLoading] = React.useState(true)\n const [saving, setSaving] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n\n const fetchSettings = React.useCallback(async () => {\n setLoading(true)\n setError(null)\n try {\n const body = await readApiResultOrThrow<SettingsResponse>(\n '/api/notifications/settings',\n undefined,\n { errorMessage: t('notifications.settings.loadError', 'Failed to load notification settings'), allowNullResult: true },\n )\n if (body?.settings) {\n setSettings(body.settings)\n } else {\n setSettings(emptySettings)\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : t('notifications.settings.loadError', 'Failed to load notification settings')\n setError(message)\n flash(message, 'error')\n } finally {\n setLoading(false)\n }\n }, [t])\n\n React.useEffect(() => {\n fetchSettings()\n }, [fetchSettings])\n\n const updateSettings = (patch: Partial<NotificationDeliveryConfig>) => {\n setSettings((prev) => (prev ? { ...prev, ...patch } : prev))\n }\n\n const updateStrategy = (\n strategy: keyof NotificationDeliveryConfig['strategies'],\n patch: Partial<NotificationDeliveryConfig['strategies'][keyof NotificationDeliveryConfig['strategies']]>,\n ) => {\n setSettings((prev) => {\n if (!prev) return prev\n return {\n ...prev,\n strategies: {\n ...prev.strategies,\n [strategy]: {\n ...prev.strategies[strategy],\n ...patch,\n },\n },\n }\n })\n }\n\n const handleSave = async () => {\n if (!settings) return\n setSaving(true)\n try {\n const response = await apiCall<SettingsResponse>('/api/notifications/settings', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(settings),\n })\n if (!response.ok) {\n const message = response.result?.error || t('notifications.settings.saveError', 'Failed to save notification settings')\n throw new Error(message)\n }\n if (response.result?.settings) {\n setSettings(response.result.settings)\n }\n flash(t('notifications.settings.saveSuccess', 'Notification settings saved'), 'success')\n } catch (err) {\n const message = err instanceof Error ? err.message : t('notifications.settings.saveError', 'Failed to save notification settings')\n flash(message, 'error')\n } finally {\n setSaving(false)\n }\n }\n\n if (loading || !settings) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner size=\"sm\" />\n {t('notifications.settings.loading', 'Loading notification settings...')}\n </div>\n )\n }\n\n return (\n <div className=\"flex flex-col gap-6\">\n <div>\n <h1 className=\"text-2xl font-semibold\">{t('notifications.settings.pageTitle', 'Notification Delivery')}</h1>\n <p className=\"text-muted-foreground text-sm\">\n {t('notifications.settings.pageDescription', 'Configure delivery strategies for in-app notifications.')}\n </p>\n </div>\n\n <Card>\n <CardHeader>\n <CardTitle>{t('notifications.settings.core.title', 'Core delivery')}</CardTitle>\n <CardDescription>{t('notifications.settings.core.description', 'Control the default notification center and panel link used by external channels.')}</CardDescription>\n </CardHeader>\n <CardContent className=\"grid gap-4 md:grid-cols-2\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"notifications-app-url\">{t('notifications.settings.core.appUrl', 'Application URL')}</Label>\n <Input\n id=\"notifications-app-url\"\n value={settings.appUrl ?? ''}\n placeholder=\"https://app.open-mercato.com\"\n onChange={(event) => updateSettings({ appUrl: event.target.value || undefined })}\n />\n <p className=\"text-xs text-muted-foreground\">{t('notifications.settings.core.appUrlHint', 'Used to build absolute links in email notifications.')}</p>\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"notifications-panel-path\">{t('notifications.settings.core.panelPath', 'Notification panel path')}</Label>\n <Input\n id=\"notifications-panel-path\"\n value={settings.panelPath}\n onChange={(event) => updateSettings({ panelPath: event.target.value })}\n />\n <p className=\"text-xs text-muted-foreground\">{t('notifications.settings.core.panelPathHint', 'Relative path for the read-only notification panel.')}</p>\n </div>\n <div className=\"flex items-center justify-between rounded-lg border p-3\">\n <div>\n <p className=\"text-sm font-medium\">{t('notifications.settings.core.databaseLabel', 'In-app notifications')}</p>\n <p className=\"text-xs text-muted-foreground\">{t('notifications.settings.core.databaseHint', 'Store notifications in the database for the panel and bell.')}</p>\n </div>\n <Switch\n checked={settings.strategies.database.enabled}\n disabled\n onCheckedChange={(checked) => updateStrategy('database', { enabled: checked })}\n />\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle>{t('notifications.settings.email.title', 'Email strategy')}</CardTitle>\n <CardDescription>{t('notifications.settings.email.description', 'Send notification copies via Resend using React templates.')}</CardDescription>\n </CardHeader>\n <CardContent className=\"grid gap-4 md:grid-cols-2\">\n <div className=\"flex items-center justify-between rounded-lg border p-3 md:col-span-2\">\n <div>\n <p className=\"text-sm font-medium\">{t('notifications.settings.email.enabledLabel', 'Enable email delivery')}</p>\n <p className=\"text-xs text-muted-foreground\">{t('notifications.settings.email.enabledHint', 'Email actions are read-only and link back to the notification center.')}</p>\n </div>\n <Switch\n checked={settings.strategies.email.enabled}\n onCheckedChange={(checked) => updateStrategy('email', { enabled: checked })}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"notifications-email-from\">{t('notifications.settings.email.from', 'From address')}</Label>\n <Input\n id=\"notifications-email-from\"\n value={settings.strategies.email.from ?? ''}\n placeholder=\"notifications@open-mercato.com\"\n onChange={(event) => updateStrategy('email', { from: event.target.value || undefined })}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"notifications-email-reply\">{t('notifications.settings.email.replyTo', 'Reply-to')}</Label>\n <Input\n id=\"notifications-email-reply\"\n value={settings.strategies.email.replyTo ?? ''}\n placeholder=\"support@open-mercato.com\"\n onChange={(event) => updateStrategy('email', { replyTo: event.target.value || undefined })}\n />\n </div>\n <div className=\"space-y-2 md:col-span-2\">\n <Label htmlFor=\"notifications-email-subject-prefix\">{t('notifications.settings.email.subjectPrefix', 'Subject prefix')}</Label>\n <Input\n id=\"notifications-email-subject-prefix\"\n value={settings.strategies.email.subjectPrefix ?? ''}\n placeholder=\"[Open Mercato]\"\n onChange={(event) => updateStrategy('email', { subjectPrefix: event.target.value || undefined })}\n />\n </div>\n </CardContent>\n </Card>\n\n <div className=\"flex items-center gap-3\">\n <Button type=\"button\" onClick={handleSave} disabled={saving}>\n {saving ? t('notifications.settings.saving', 'Saving...') : t('notifications.settings.save', 'Save settings')}\n </Button>\n {error && <span className=\"text-sm text-destructive\">{error}</span>}\n </div>\n </div>\n )\n}\n\nexport default NotificationSettingsPageClient\n"],
5
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AA,8BAAC,SAAM,SAAQ,6BAA6B,YAAE,wCAAwC,UAAU,GAAE;AAAA,UAClG;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,OAAO,SAAS,WAAW,MAAM,WAAW;AAAA,cAC5C,aAAY;AAAA,cACZ,UAAU,CAAC,UAAU,eAAe,SAAS,EAAE,SAAS,MAAM,OAAO,SAAS,OAAU,CAAC;AAAA;AAAA,UAC3F;AAAA,WACF;AAAA,QACA,qBAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAM,SAAQ,sCAAsC,YAAE,8CAA8C,gBAAgB,GAAE;AAAA,UACvH;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,OAAO,SAAS,WAAW,MAAM,iBAAiB;AAAA,cAClD,aAAY;AAAA,cACZ,UAAU,CAAC,UAAU,eAAe,SAAS,EAAE,eAAe,MAAM,OAAO,SAAS,OAAU,CAAC;AAAA;AAAA,UACjG;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,UAAO,MAAK,UAAS,SAAS,YAAY,UAAU,QAClD,mBAAS,EAAE,iCAAiC,WAAW,IAAI,EAAE,+BAA+B,eAAe,GAC9G;AAAA,MACC,SAAS,oBAAC,UAAK,WAAU,4BAA4B,iBAAM;AAAA,OAC9D;AAAA,KACF;AAEJ;AAEA,IAAO,yCAAQ;",
6
- "names": []
7
- }
@@ -1,14 +0,0 @@
1
- const metadata = {
2
- name: "notifications",
3
- title: "Notifications",
4
- version: "0.1.0",
5
- description: "In-app notifications with module-extensible types and actions.",
6
- author: "Open Mercato Team",
7
- license: "Proprietary"
8
- };
9
- import { features } from "./acl.js";
10
- export {
11
- features,
12
- metadata
13
- };
14
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/modules/notifications/index.ts"],
4
- "sourcesContent": ["import type { ModuleInfo } from '@open-mercato/shared/modules/registry'\n\nexport const metadata: ModuleInfo = {\n name: 'notifications',\n title: 'Notifications',\n version: '0.1.0',\n description: 'In-app notifications with module-extensible types and actions.',\n author: 'Open Mercato Team',\n license: 'Proprietary',\n}\n\nexport { features } from './acl'\n"],
5
- "mappings": "AAEO,MAAM,WAAuB;AAAA,EAClC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AACX;AAEA,SAAS,gBAAgB;",
6
- "names": []
7
- }
@@ -1,107 +0,0 @@
1
- import { parseBooleanWithDefault } from "@open-mercato/shared/lib/boolean";
2
- import { notificationDeliveryConfigSchema } from "../data/validators.js";
3
- const NOTIFICATIONS_DELIVERY_CONFIG_KEY = "delivery_strategies";
4
- const envString = (value) => {
5
- if (!value) return void 0;
6
- const trimmed = value.trim();
7
- return trimmed.length ? trimmed : void 0;
8
- };
9
- const resolveEnvDefaults = () => {
10
- const appUrl = envString(
11
- process.env.NOTIFICATIONS_APP_URL || process.env.APPLICATION_URL || process.env.NEXT_PUBLIC_APP_URL || process.env.APP_URL
12
- );
13
- const panelPath = envString(process.env.NOTIFICATIONS_PANEL_PATH);
14
- const emailEnabled = parseBooleanWithDefault(process.env.NOTIFICATIONS_EMAIL_ENABLED, true);
15
- const emailFrom = envString(process.env.NOTIFICATIONS_EMAIL_FROM || process.env.EMAIL_FROM);
16
- const emailReplyTo = envString(process.env.NOTIFICATIONS_EMAIL_REPLY_TO || process.env.ADMIN_EMAIL);
17
- const emailSubjectPrefix = envString(process.env.NOTIFICATIONS_EMAIL_SUBJECT_PREFIX);
18
- return {
19
- appUrl,
20
- panelPath,
21
- emailEnabled,
22
- emailFrom,
23
- emailReplyTo,
24
- emailSubjectPrefix
25
- };
26
- };
27
- const DEFAULT_NOTIFICATION_DELIVERY_CONFIG = (() => {
28
- const env = resolveEnvDefaults();
29
- return {
30
- appUrl: env.appUrl,
31
- panelPath: env.panelPath ?? "/backend/notifications",
32
- strategies: {
33
- database: { enabled: true },
34
- email: {
35
- enabled: env.emailEnabled,
36
- from: env.emailFrom,
37
- replyTo: env.emailReplyTo,
38
- subjectPrefix: env.emailSubjectPrefix
39
- },
40
- custom: {}
41
- }
42
- };
43
- })();
44
- const normalizeDeliveryConfig = (input) => {
45
- const parsed = notificationDeliveryConfigSchema.safeParse(input ?? {});
46
- if (!parsed.success) {
47
- return { ...DEFAULT_NOTIFICATION_DELIVERY_CONFIG };
48
- }
49
- const value = parsed.data ?? {};
50
- const strategies = value.strategies ?? {};
51
- return {
52
- appUrl: value.appUrl,
53
- panelPath: value.panelPath ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG.panelPath,
54
- strategies: {
55
- database: {
56
- enabled: DEFAULT_NOTIFICATION_DELIVERY_CONFIG.strategies.database.enabled
57
- },
58
- email: {
59
- enabled: strategies.email?.enabled ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG.strategies.email.enabled,
60
- from: strategies.email?.from,
61
- replyTo: strategies.email?.replyTo,
62
- subjectPrefix: strategies.email?.subjectPrefix
63
- },
64
- custom: strategies.custom ?? {}
65
- }
66
- };
67
- };
68
- async function resolveNotificationDeliveryConfig(resolver, options) {
69
- const fallback = options?.defaultValue ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG;
70
- let service;
71
- try {
72
- service = resolver.resolve("moduleConfigService");
73
- } catch {
74
- return { ...fallback };
75
- }
76
- try {
77
- const value = await service.getValue("notifications", NOTIFICATIONS_DELIVERY_CONFIG_KEY, { defaultValue: fallback });
78
- return normalizeDeliveryConfig(value);
79
- } catch {
80
- return { ...fallback };
81
- }
82
- }
83
- async function saveNotificationDeliveryConfig(resolver, config) {
84
- let service;
85
- try {
86
- service = resolver.resolve("moduleConfigService");
87
- } catch {
88
- throw new Error("Configuration service unavailable");
89
- }
90
- const normalized = normalizeDeliveryConfig(config);
91
- await service.setValue("notifications", NOTIFICATIONS_DELIVERY_CONFIG_KEY, normalized);
92
- }
93
- function resolveNotificationPanelUrl(config) {
94
- const base = config.appUrl || process.env.APPLICATION_URL || process.env.NEXT_PUBLIC_APP_URL || process.env.APP_URL;
95
- if (!base || !base.trim()) {
96
- return config.panelPath;
97
- }
98
- return `${base.replace(/\/$/, "")}${config.panelPath}`;
99
- }
100
- export {
101
- DEFAULT_NOTIFICATION_DELIVERY_CONFIG,
102
- NOTIFICATIONS_DELIVERY_CONFIG_KEY,
103
- resolveNotificationDeliveryConfig,
104
- resolveNotificationPanelUrl,
105
- saveNotificationDeliveryConfig
106
- };
107
- //# sourceMappingURL=deliveryConfig.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/deliveryConfig.ts"],
4
- "sourcesContent": ["import type { ModuleConfigService } from '@open-mercato/core/modules/configs/lib/module-config-service'\nimport { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'\nimport { notificationDeliveryConfigSchema, type NotificationDeliveryConfigInput } from '../data/validators'\n\nexport const NOTIFICATIONS_DELIVERY_CONFIG_KEY = 'delivery_strategies'\n\nexport type NotificationDeliveryStrategyState = {\n enabled: boolean\n}\n\nexport type NotificationCustomDeliveryConfig = {\n enabled?: boolean\n config?: unknown\n}\n\nexport type NotificationEmailDeliveryConfig = NotificationDeliveryStrategyState & {\n from?: string\n replyTo?: string\n subjectPrefix?: string\n}\n\nexport type NotificationDeliveryConfig = {\n appUrl?: string\n panelPath: string\n strategies: {\n database: NotificationDeliveryStrategyState\n email: NotificationEmailDeliveryConfig\n custom?: Record<string, NotificationCustomDeliveryConfig>\n }\n}\n\nconst envString = (value: string | undefined | null) => {\n if (!value) return undefined\n const trimmed = value.trim()\n return trimmed.length ? trimmed : undefined\n}\n\nconst resolveEnvDefaults = () => {\n const appUrl = envString(\n process.env.NOTIFICATIONS_APP_URL ||\n process.env.APPLICATION_URL ||\n process.env.NEXT_PUBLIC_APP_URL ||\n process.env.APP_URL\n )\n const panelPath = envString(process.env.NOTIFICATIONS_PANEL_PATH)\n const emailEnabled = parseBooleanWithDefault(process.env.NOTIFICATIONS_EMAIL_ENABLED, true)\n const emailFrom = envString(process.env.NOTIFICATIONS_EMAIL_FROM || process.env.EMAIL_FROM)\n const emailReplyTo = envString(process.env.NOTIFICATIONS_EMAIL_REPLY_TO || process.env.ADMIN_EMAIL)\n const emailSubjectPrefix = envString(process.env.NOTIFICATIONS_EMAIL_SUBJECT_PREFIX)\n\n return {\n appUrl,\n panelPath,\n emailEnabled,\n emailFrom,\n emailReplyTo,\n emailSubjectPrefix,\n }\n}\n\nexport const DEFAULT_NOTIFICATION_DELIVERY_CONFIG: NotificationDeliveryConfig = (() => {\n const env = resolveEnvDefaults()\n return {\n appUrl: env.appUrl,\n panelPath: env.panelPath ?? '/backend/notifications',\n strategies: {\n database: { enabled: true },\n email: {\n enabled: env.emailEnabled,\n from: env.emailFrom,\n replyTo: env.emailReplyTo,\n subjectPrefix: env.emailSubjectPrefix,\n },\n custom: {},\n },\n }\n})()\n\nconst normalizeDeliveryConfig = (input?: unknown | null): NotificationDeliveryConfig => {\n const parsed = notificationDeliveryConfigSchema.safeParse(input ?? {})\n if (!parsed.success) {\n return { ...DEFAULT_NOTIFICATION_DELIVERY_CONFIG }\n }\n\n const value = parsed.data ?? {}\n const strategies = value.strategies ?? {}\n\n return {\n appUrl: value.appUrl,\n panelPath: value.panelPath ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG.panelPath,\n strategies: {\n database: {\n enabled: DEFAULT_NOTIFICATION_DELIVERY_CONFIG.strategies.database.enabled,\n },\n email: {\n enabled: strategies.email?.enabled ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG.strategies.email.enabled,\n from: strategies.email?.from,\n replyTo: strategies.email?.replyTo,\n subjectPrefix: strategies.email?.subjectPrefix,\n },\n custom: strategies.custom ?? {},\n },\n }\n}\n\ntype Resolver = {\n resolve: <T = unknown>(name: string) => T\n}\n\nexport async function resolveNotificationDeliveryConfig(\n resolver: Resolver,\n options?: { defaultValue?: NotificationDeliveryConfig }\n): Promise<NotificationDeliveryConfig> {\n const fallback = options?.defaultValue ?? DEFAULT_NOTIFICATION_DELIVERY_CONFIG\n let service: ModuleConfigService\n try {\n service = resolver.resolve<ModuleConfigService>('moduleConfigService')\n } catch {\n return { ...fallback }\n }\n try {\n const value = await service.getValue('notifications', NOTIFICATIONS_DELIVERY_CONFIG_KEY, { defaultValue: fallback })\n return normalizeDeliveryConfig(value)\n } catch {\n return { ...fallback }\n }\n}\n\nexport async function saveNotificationDeliveryConfig(\n resolver: Resolver,\n config: NotificationDeliveryConfigInput\n): Promise<void> {\n let service: ModuleConfigService\n try {\n service = resolver.resolve<ModuleConfigService>('moduleConfigService')\n } catch {\n throw new Error('Configuration service unavailable')\n }\n\n const normalized = normalizeDeliveryConfig(config)\n await service.setValue('notifications', NOTIFICATIONS_DELIVERY_CONFIG_KEY, normalized)\n}\n\nexport function resolveNotificationPanelUrl(config: NotificationDeliveryConfig): string | null {\n const base = config.appUrl\n || process.env.APPLICATION_URL\n || process.env.NEXT_PUBLIC_APP_URL\n || process.env.APP_URL\n if (!base || !base.trim()) {\n return config.panelPath\n }\n return `${base.replace(/\\/$/, '')}${config.panelPath}`\n}\n"],
5
- "mappings": "AACA,SAAS,+BAA+B;AACxC,SAAS,wCAA8E;AAEhF,MAAM,oCAAoC;AA2BjD,MAAM,YAAY,CAAC,UAAqC;AACtD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO,QAAQ,SAAS,UAAU;AACpC;AAEA,MAAM,qBAAqB,MAAM;AAC/B,QAAM,SAAS;AAAA,IACb,QAAQ,IAAI,yBACZ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI;AAAA,EACd;AACA,QAAM,YAAY,UAAU,QAAQ,IAAI,wBAAwB;AAChE,QAAM,eAAe,wBAAwB,QAAQ,IAAI,6BAA6B,IAAI;AAC1F,QAAM,YAAY,UAAU,QAAQ,IAAI,4BAA4B,Q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,UACA,SACqC;AACrC,QAAM,WAAW,SAAS,gBAAgB;AAC1C,MAAI;AACJ,MAAI;AACF,cAAU,SAAS,QAA6B,qBAAqB;AAAA,EACvE,QAAQ;AACN,WAAO,EAAE,GAAG,SAAS;AAAA,EACvB;AACA,MAAI;AACF,UAAM,QAAQ,MAAM,QAAQ,SAAS,iBAAiB,mCAAmC,EAAE,cAAc,SAAS,CAAC;AACnH,WAAO,wBAAwB,KAAK;AAAA,EACtC,QAAQ;AACN,WAAO,EAAE,GAAG,SAAS;AAAA,EACvB;AACF;AAEA,eAAsB,+BACpB,UACA,QACe;AACf,MAAI;AACJ,MAAI;AACF,cAAU,SAAS,QAA6B,qBAAqB;AAAA,EACvE,QAAQ;AACN,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,aAAa,wBAAwB,MAAM;AACjD,QAAM,QAAQ,SAAS,iBAAiB,mCAAmC,UAAU;AACvF;AAEO,SAAS,4BAA4B,QAAmD;AAC7F,QAAM,OAAO,OAAO,UACf,QAAQ,IAAI,mBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI;AACjB,MAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,GAAG;AACzB,WAAO,OAAO;AAAA,EAChB;AACA,SAAO,GAAG,KAAK,QAAQ,OAAO,EAAE,CAAC,GAAG,OAAO,SAAS;AACtD;",
6
- "names": []
7
- }
@@ -1,14 +0,0 @@
1
- const registry = [];
2
- function registerNotificationDeliveryStrategy(strategy, options) {
3
- const priority = options?.priority ?? 0;
4
- registry.push({ ...strategy, priority });
5
- registry.sort((a, b) => b.priority - a.priority);
6
- }
7
- function getNotificationDeliveryStrategies() {
8
- return registry;
9
- }
10
- export {
11
- getNotificationDeliveryStrategies,
12
- registerNotificationDeliveryStrategy
13
- };
14
- //# sourceMappingURL=deliveryStrategies.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/deliveryStrategies.ts"],
4
- "sourcesContent": ["import type { Notification } from '../data/entities'\nimport type { NotificationDeliveryConfig } from './deliveryConfig'\n\nexport type NotificationDeliveryStrategyConfig = {\n enabled?: boolean\n config?: unknown\n}\n\nexport type NotificationDeliveryRecipient = {\n email?: string | null\n name?: string | null\n}\n\nexport type NotificationDeliveryContext = {\n notification: Notification\n recipient: NotificationDeliveryRecipient\n title: string\n body: string | null\n panelUrl: string | null\n panelLink: string | null\n actionLinks: Array<{ id: string; label: string; href: string }>\n deliveryConfig: NotificationDeliveryConfig\n config: NotificationDeliveryStrategyConfig\n resolve: <T = unknown>(name: string) => T\n t: (key: string, fallback?: string, variables?: Record<string, string>) => string\n}\n\nexport type NotificationDeliveryStrategy = {\n id: string\n label?: string\n defaultEnabled?: boolean\n deliver: (ctx: NotificationDeliveryContext) => Promise<void> | void\n}\n\ntype RegisteredStrategy = NotificationDeliveryStrategy & { priority: number }\n\nconst registry: RegisteredStrategy[] = []\n\nexport function registerNotificationDeliveryStrategy(\n strategy: NotificationDeliveryStrategy,\n options?: { priority?: number }\n): void {\n const priority = options?.priority ?? 0\n registry.push({ ...strategy, priority })\n registry.sort((a, b) => b.priority - a.priority)\n}\n\nexport function getNotificationDeliveryStrategies(): NotificationDeliveryStrategy[] {\n return registry\n}\n"],
5
- "mappings": "AAoCA,MAAM,WAAiC,CAAC;AAEjC,SAAS,qCACd,UACA,SACM;AACN,QAAM,WAAW,SAAS,YAAY;AACtC,WAAS,KAAK,EAAE,GAAG,UAAU,SAAS,CAAC;AACvC,WAAS,KAAK,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AACjD;AAEO,SAAS,oCAAoE;AAClF,SAAO;AACT;",
6
- "names": []
7
- }