@open-mercato/core 0.4.2-canary-07dbc98202 → 0.4.2-canary-11e19dfb84

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 (235) hide show
  1. package/dist/generated/entities.ids.generated.js +59 -63
  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/auth/api/admin/nav.js +3 -4
  8. package/dist/modules/auth/api/admin/nav.js.map +2 -2
  9. package/dist/modules/auth/api/reset/confirm.js +2 -25
  10. package/dist/modules/auth/api/reset/confirm.js.map +2 -2
  11. package/dist/modules/auth/api/reset.js +0 -23
  12. package/dist/modules/auth/api/reset.js.map +2 -2
  13. package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
  14. package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
  15. package/dist/modules/auth/commands/users.js +0 -55
  16. package/dist/modules/auth/commands/users.js.map +2 -2
  17. package/dist/modules/auth/lib/setup-app.js +0 -1
  18. package/dist/modules/auth/lib/setup-app.js.map +2 -2
  19. package/dist/modules/auth/services/authService.js +3 -3
  20. package/dist/modules/auth/services/authService.js.map +2 -2
  21. package/dist/modules/configs/cli.js +0 -6
  22. package/dist/modules/configs/cli.js.map +2 -2
  23. package/dist/modules/customers/commands/deals.js +0 -31
  24. package/dist/modules/customers/commands/deals.js.map +2 -2
  25. package/dist/modules/sales/commands/documents.js +0 -53
  26. package/dist/modules/sales/commands/documents.js.map +2 -2
  27. package/dist/modules/sales/commands/payments.js +0 -26
  28. package/dist/modules/sales/commands/payments.js.map +2 -2
  29. package/dist/modules/staff/commands/leave-requests.js +0 -79
  30. package/dist/modules/staff/commands/leave-requests.js.map +2 -2
  31. package/generated/entities.ids.generated.ts +59 -63
  32. package/generated/entity-fields-registry.ts +0 -2
  33. package/package.json +2 -2
  34. package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
  35. package/src/modules/auth/api/admin/nav.ts +6 -10
  36. package/src/modules/auth/api/reset/confirm.ts +2 -25
  37. package/src/modules/auth/api/reset.ts +0 -23
  38. package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
  39. package/src/modules/auth/commands/users.ts +0 -68
  40. package/src/modules/auth/i18n/de.json +1 -29
  41. package/src/modules/auth/i18n/en.json +1 -29
  42. package/src/modules/auth/i18n/es.json +1 -29
  43. package/src/modules/auth/i18n/pl.json +1 -29
  44. package/src/modules/auth/lib/setup-app.ts +0 -1
  45. package/src/modules/auth/services/authService.ts +4 -4
  46. package/src/modules/business_rules/i18n/en.json +1 -3
  47. package/src/modules/catalog/i18n/en.json +1 -3
  48. package/src/modules/configs/cli.ts +0 -6
  49. package/src/modules/customers/commands/deals.ts +0 -39
  50. package/src/modules/customers/i18n/en.json +1 -5
  51. package/src/modules/sales/commands/documents.ts +0 -65
  52. package/src/modules/sales/commands/payments.ts +0 -33
  53. package/src/modules/sales/i18n/de.json +0 -20
  54. package/src/modules/sales/i18n/en.json +1 -25
  55. package/src/modules/sales/i18n/es.json +0 -20
  56. package/src/modules/sales/i18n/pl.json +0 -20
  57. package/src/modules/staff/commands/leave-requests.ts +0 -94
  58. package/src/modules/staff/i18n/de.json +0 -4
  59. package/src/modules/staff/i18n/en.json +1 -9
  60. package/src/modules/staff/i18n/es.json +0 -4
  61. package/src/modules/staff/i18n/pl.json +0 -4
  62. package/src/modules/workflows/i18n/en.json +1 -3
  63. package/dist/generated/entities/notification/index.js +0 -57
  64. package/dist/generated/entities/notification/index.js.map +0 -7
  65. package/dist/modules/auth/api/profile/route.js +0 -155
  66. package/dist/modules/auth/api/profile/route.js.map +0 -7
  67. package/dist/modules/auth/backend/auth/profile/page.js +0 -99
  68. package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
  69. package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -12
  70. package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
  71. package/dist/modules/auth/notifications.js +0 -112
  72. package/dist/modules/auth/notifications.js.map +0 -7
  73. package/dist/modules/business_rules/notifications.js +0 -28
  74. package/dist/modules/business_rules/notifications.js.map +0 -7
  75. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
  76. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
  77. package/dist/modules/catalog/notifications.js +0 -28
  78. package/dist/modules/catalog/notifications.js.map +0 -7
  79. package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
  80. package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
  81. package/dist/modules/customers/notifications.js +0 -48
  82. package/dist/modules/customers/notifications.js.map +0 -7
  83. package/dist/modules/notifications/acl.js +0 -11
  84. package/dist/modules/notifications/acl.js.map +0 -7
  85. package/dist/modules/notifications/api/[id]/action/route.js +0 -74
  86. package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
  87. package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
  88. package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
  89. package/dist/modules/notifications/api/[id]/read/route.js +0 -15
  90. package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
  91. package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
  92. package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
  93. package/dist/modules/notifications/api/batch/route.js +0 -17
  94. package/dist/modules/notifications/api/batch/route.js.map +0 -7
  95. package/dist/modules/notifications/api/feature/route.js +0 -17
  96. package/dist/modules/notifications/api/feature/route.js.map +0 -7
  97. package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
  98. package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
  99. package/dist/modules/notifications/api/openapi.js +0 -76
  100. package/dist/modules/notifications/api/openapi.js.map +0 -7
  101. package/dist/modules/notifications/api/role/route.js +0 -17
  102. package/dist/modules/notifications/api/role/route.js.map +0 -7
  103. package/dist/modules/notifications/api/route.js +0 -85
  104. package/dist/modules/notifications/api/route.js.map +0 -7
  105. package/dist/modules/notifications/api/settings/route.js +0 -155
  106. package/dist/modules/notifications/api/settings/route.js.map +0 -7
  107. package/dist/modules/notifications/api/unread-count/route.js +0 -38
  108. package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
  109. package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
  110. package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
  111. package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
  112. package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
  113. package/dist/modules/notifications/cli.js +0 -16
  114. package/dist/modules/notifications/cli.js.map +0 -7
  115. package/dist/modules/notifications/data/entities.js +0 -112
  116. package/dist/modules/notifications/data/entities.js.map +0 -7
  117. package/dist/modules/notifications/data/validators.js +0 -94
  118. package/dist/modules/notifications/data/validators.js.map +0 -7
  119. package/dist/modules/notifications/di.js +0 -13
  120. package/dist/modules/notifications/di.js.map +0 -7
  121. package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
  122. package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
  123. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
  124. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
  125. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -219
  126. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
  127. package/dist/modules/notifications/index.js +0 -14
  128. package/dist/modules/notifications/index.js.map +0 -7
  129. package/dist/modules/notifications/lib/deliveryConfig.js +0 -105
  130. package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
  131. package/dist/modules/notifications/lib/events.js +0 -12
  132. package/dist/modules/notifications/lib/events.js.map +0 -7
  133. package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
  134. package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
  135. package/dist/modules/notifications/lib/notificationFactory.js +0 -54
  136. package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
  137. package/dist/modules/notifications/lib/notificationMapper.js +0 -34
  138. package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
  139. package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
  140. package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
  141. package/dist/modules/notifications/lib/notificationService.js +0 -279
  142. package/dist/modules/notifications/lib/notificationService.js.map +0 -7
  143. package/dist/modules/notifications/lib/routeHelpers.js +0 -101
  144. package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
  145. package/dist/modules/notifications/lib/safeHref.js +0 -24
  146. package/dist/modules/notifications/lib/safeHref.js.map +0 -7
  147. package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
  148. package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
  149. package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
  150. package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
  151. package/dist/modules/notifications/subscribers/deliver-notification.js +0 -139
  152. package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
  153. package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
  154. package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
  155. package/dist/modules/sales/notifications.client.js +0 -51
  156. package/dist/modules/sales/notifications.client.js.map +0 -7
  157. package/dist/modules/sales/notifications.js +0 -88
  158. package/dist/modules/sales/notifications.js.map +0 -7
  159. package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
  160. package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
  161. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
  162. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
  163. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
  164. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
  165. package/dist/modules/sales/widgets/notifications/index.js +0 -7
  166. package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
  167. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
  168. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
  169. package/dist/modules/staff/notifications.js +0 -75
  170. package/dist/modules/staff/notifications.js.map +0 -7
  171. package/dist/modules/workflows/notifications.js +0 -28
  172. package/dist/modules/workflows/notifications.js.map +0 -7
  173. package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
  174. package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
  175. package/generated/entities/notification/index.ts +0 -27
  176. package/src/modules/auth/api/profile/route.ts +0 -160
  177. package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -8
  178. package/src/modules/auth/backend/auth/profile/page.tsx +0 -127
  179. package/src/modules/auth/notifications.ts +0 -109
  180. package/src/modules/business_rules/notifications.ts +0 -25
  181. package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
  182. package/src/modules/catalog/notifications.ts +0 -25
  183. package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
  184. package/src/modules/customers/notifications.ts +0 -44
  185. package/src/modules/notifications/acl.ts +0 -7
  186. package/src/modules/notifications/api/[id]/action/route.ts +0 -75
  187. package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
  188. package/src/modules/notifications/api/[id]/read/route.ts +0 -12
  189. package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
  190. package/src/modules/notifications/api/batch/route.ts +0 -14
  191. package/src/modules/notifications/api/feature/route.ts +0 -14
  192. package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
  193. package/src/modules/notifications/api/openapi.ts +0 -76
  194. package/src/modules/notifications/api/role/route.ts +0 -14
  195. package/src/modules/notifications/api/route.ts +0 -92
  196. package/src/modules/notifications/api/settings/route.ts +0 -157
  197. package/src/modules/notifications/api/unread-count/route.ts +0 -38
  198. package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
  199. package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
  200. package/src/modules/notifications/cli.ts +0 -18
  201. package/src/modules/notifications/data/entities.ts +0 -99
  202. package/src/modules/notifications/data/validators.ts +0 -110
  203. package/src/modules/notifications/di.ts +0 -11
  204. package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
  205. package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
  206. package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -231
  207. package/src/modules/notifications/i18n/de.json +0 -50
  208. package/src/modules/notifications/i18n/en.json +0 -50
  209. package/src/modules/notifications/i18n/es.json +0 -50
  210. package/src/modules/notifications/i18n/pl.json +0 -50
  211. package/src/modules/notifications/index.ts +0 -12
  212. package/src/modules/notifications/lib/deliveryConfig.ts +0 -145
  213. package/src/modules/notifications/lib/events.ts +0 -48
  214. package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
  215. package/src/modules/notifications/lib/notificationFactory.ts +0 -76
  216. package/src/modules/notifications/lib/notificationMapper.ts +0 -33
  217. package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
  218. package/src/modules/notifications/lib/notificationService.ts +0 -414
  219. package/src/modules/notifications/lib/routeHelpers.ts +0 -151
  220. package/src/modules/notifications/lib/safeHref.ts +0 -29
  221. package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -300
  222. package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
  223. package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
  224. package/src/modules/notifications/subscribers/deliver-notification.ts +0 -175
  225. package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
  226. package/src/modules/sales/notifications.client.ts +0 -65
  227. package/src/modules/sales/notifications.ts +0 -82
  228. package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
  229. package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
  230. package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
  231. package/src/modules/sales/widgets/notifications/index.ts +0 -2
  232. package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
  233. package/src/modules/staff/notifications.ts +0 -71
  234. package/src/modules/workflows/notifications.ts +0 -25
  235. package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
@@ -1,98 +0,0 @@
1
- import React from 'react'
2
- import { Html, Head, Preview, Body, Container, Heading, Text, Section, Button, Hr } from '@react-email/components'
3
-
4
- export type NotificationEmailAction = {
5
- id: string
6
- label: string
7
- href: string
8
- }
9
-
10
- export type NotificationEmailCopy = {
11
- preview: string
12
- heading: string
13
- bodyIntro: string
14
- actionNotice: string
15
- openCta: string
16
- footer: string
17
- }
18
-
19
- type NotificationEmailProps = {
20
- title: string
21
- body?: string | null
22
- actions: NotificationEmailAction[]
23
- panelUrl: string
24
- copy: NotificationEmailCopy
25
- }
26
-
27
- export function NotificationEmail({ title, body, actions, panelUrl, copy }: NotificationEmailProps) {
28
- return (
29
- <Html>
30
- <Head />
31
- <Preview>{copy.preview}</Preview>
32
- <Body style={{ backgroundColor: '#f5f5f5', fontFamily: 'Arial, sans-serif', margin: 0, padding: 0 }}>
33
- <Container style={{ maxWidth: 560, margin: '0 auto', padding: '24px' }}>
34
- <Section style={{ backgroundColor: '#ffffff', padding: '24px', borderRadius: 12 }}>
35
- <Heading as="h1" style={{ fontSize: '22px', margin: '0 0 8px', color: '#111827' }}>
36
- {copy.heading}
37
- </Heading>
38
- <Text style={{ margin: '0 0 16px', color: '#4b5563' }}>{title}</Text>
39
- {body && (
40
- <Text style={{ margin: '0 0 16px', color: '#111827', fontSize: '15px' }}>
41
- {body}
42
- </Text>
43
- )}
44
- <Text style={{ margin: '0 0 16px', color: '#6b7280', fontSize: '13px' }}>
45
- {copy.bodyIntro}
46
- </Text>
47
- {actions.length > 0 && (
48
- <Section style={{ marginBottom: 16 }}>
49
- {actions.map((action) => (
50
- <Button
51
- key={action.id}
52
- href={action.href}
53
- style={{
54
- backgroundColor: '#111827',
55
- color: '#ffffff',
56
- padding: '10px 16px',
57
- borderRadius: 8,
58
- textDecoration: 'none',
59
- display: 'inline-block',
60
- marginRight: 8,
61
- marginBottom: 8,
62
- fontSize: '13px',
63
- }}
64
- >
65
- {action.label}
66
- </Button>
67
- ))}
68
- </Section>
69
- )}
70
- <Text style={{ margin: '0 0 16px', color: '#6b7280', fontSize: '12px' }}>
71
- {copy.actionNotice}
72
- </Text>
73
- <Button
74
- href={panelUrl}
75
- style={{
76
- backgroundColor: '#2563eb',
77
- color: '#ffffff',
78
- padding: '12px 18px',
79
- borderRadius: 8,
80
- textDecoration: 'none',
81
- display: 'inline-block',
82
- fontSize: '14px',
83
- }}
84
- >
85
- {copy.openCta}
86
- </Button>
87
- <Hr style={{ margin: '24px 0', borderColor: '#e5e7eb' }} />
88
- <Text style={{ margin: 0, color: '#9ca3af', fontSize: '12px' }}>
89
- {copy.footer}
90
- </Text>
91
- </Section>
92
- </Container>
93
- </Body>
94
- </Html>
95
- )
96
- }
97
-
98
- export default NotificationEmail
@@ -1,42 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import { useRouter } from 'next/navigation'
5
- import { useT } from '@open-mercato/shared/lib/i18n/context'
6
- import { NotificationPanel } from '@open-mercato/ui/backend/notifications'
7
- import { useNotificationsPoll } from '@open-mercato/ui/backend/notifications'
8
-
9
- export function NotificationInboxPageClient() {
10
- const t = useT()
11
- const router = useRouter()
12
- const {
13
- notifications,
14
- unreadCount,
15
- markAsRead,
16
- executeAction,
17
- dismiss,
18
- dismissUndo,
19
- undoDismiss,
20
- markAllRead,
21
- } = useNotificationsPoll()
22
-
23
- return (
24
- <NotificationPanel
25
- open
26
- onOpenChange={(open) => {
27
- if (!open) router.push('/backend')
28
- }}
29
- notifications={notifications}
30
- unreadCount={unreadCount}
31
- onMarkAsRead={markAsRead}
32
- onExecuteAction={executeAction}
33
- onDismiss={dismiss}
34
- dismissUndo={dismissUndo}
35
- onUndoDismiss={undoDismiss}
36
- onMarkAllRead={markAllRead}
37
- t={t}
38
- />
39
- )
40
- }
41
-
42
- export default NotificationInboxPageClient
@@ -1,231 +0,0 @@
1
- "use client"
2
-
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
-
14
- type NotificationDeliveryConfig = {
15
- appUrl?: string
16
- panelPath: string
17
- strategies: {
18
- database: { enabled: boolean }
19
- email: { enabled: boolean; from?: string; replyTo?: string; subjectPrefix?: string }
20
- }
21
- }
22
-
23
- type SettingsResponse = {
24
- settings?: NotificationDeliveryConfig
25
- error?: string
26
- }
27
-
28
- const emptySettings: NotificationDeliveryConfig = {
29
- panelPath: '/backend/notifications',
30
- strategies: {
31
- database: { enabled: true },
32
- email: { enabled: true },
33
- },
34
- }
35
-
36
- export function NotificationSettingsPageClient() {
37
- const t = useT()
38
- const [settings, setSettings] = React.useState<NotificationDeliveryConfig | null>(null)
39
- const [loading, setLoading] = React.useState(true)
40
- const [saving, setSaving] = React.useState(false)
41
- const [error, setError] = React.useState<string | null>(null)
42
-
43
- const fetchSettings = React.useCallback(async () => {
44
- setLoading(true)
45
- setError(null)
46
- try {
47
- const body = await readApiResultOrThrow<SettingsResponse>(
48
- '/api/notifications/settings',
49
- undefined,
50
- { errorMessage: t('notifications.settings.loadError', 'Failed to load notification settings'), allowNullResult: true },
51
- )
52
- if (body?.settings) {
53
- setSettings(body.settings)
54
- } else {
55
- setSettings(emptySettings)
56
- }
57
- } catch (err) {
58
- const message = err instanceof Error ? err.message : t('notifications.settings.loadError', 'Failed to load notification settings')
59
- setError(message)
60
- flash(message, 'error')
61
- } finally {
62
- setLoading(false)
63
- }
64
- }, [t])
65
-
66
- React.useEffect(() => {
67
- fetchSettings()
68
- }, [fetchSettings])
69
-
70
- const updateSettings = (patch: Partial<NotificationDeliveryConfig>) => {
71
- setSettings((prev) => (prev ? { ...prev, ...patch } : prev))
72
- }
73
-
74
- const updateStrategy = (
75
- strategy: keyof NotificationDeliveryConfig['strategies'],
76
- patch: Partial<NotificationDeliveryConfig['strategies'][keyof NotificationDeliveryConfig['strategies']]>,
77
- ) => {
78
- setSettings((prev) => {
79
- if (!prev) return prev
80
- return {
81
- ...prev,
82
- strategies: {
83
- ...prev.strategies,
84
- [strategy]: {
85
- ...prev.strategies[strategy],
86
- ...patch,
87
- },
88
- },
89
- }
90
- })
91
- }
92
-
93
- const handleSave = async () => {
94
- if (!settings) return
95
- setSaving(true)
96
- try {
97
- const response = await apiCall<SettingsResponse>('/api/notifications/settings', {
98
- method: 'POST',
99
- headers: { 'Content-Type': 'application/json' },
100
- body: JSON.stringify(settings),
101
- })
102
- if (!response.ok) {
103
- const message = response.result?.error || t('notifications.settings.saveError', 'Failed to save notification settings')
104
- throw new Error(message)
105
- }
106
- if (response.result?.settings) {
107
- setSettings(response.result.settings)
108
- }
109
- flash(t('notifications.settings.saveSuccess', 'Notification settings saved'), 'success')
110
- } catch (err) {
111
- const message = err instanceof Error ? err.message : t('notifications.settings.saveError', 'Failed to save notification settings')
112
- flash(message, 'error')
113
- } finally {
114
- setSaving(false)
115
- }
116
- }
117
-
118
- if (loading || !settings) {
119
- return (
120
- <div className="flex items-center gap-2 text-sm text-muted-foreground">
121
- <Spinner size="sm" />
122
- {t('notifications.settings.loading', 'Loading notification settings...')}
123
- </div>
124
- )
125
- }
126
-
127
- return (
128
- <div className="flex flex-col gap-6">
129
- <div>
130
- <h1 className="text-2xl font-semibold">{t('notifications.settings.pageTitle', 'Notification Delivery')}</h1>
131
- <p className="text-muted-foreground text-sm">
132
- {t('notifications.settings.pageDescription', 'Configure delivery strategies for in-app notifications.')}
133
- </p>
134
- </div>
135
-
136
- <Card>
137
- <CardHeader>
138
- <CardTitle>{t('notifications.settings.core.title', 'Core delivery')}</CardTitle>
139
- <CardDescription>{t('notifications.settings.core.description', 'Control the default notification center and panel link used by external channels.')}</CardDescription>
140
- </CardHeader>
141
- <CardContent className="grid gap-4 md:grid-cols-2">
142
- <div className="space-y-2">
143
- <Label htmlFor="notifications-app-url">{t('notifications.settings.core.appUrl', 'Application URL')}</Label>
144
- <Input
145
- id="notifications-app-url"
146
- value={settings.appUrl ?? ''}
147
- placeholder="https://app.open-mercato.com"
148
- onChange={(event) => updateSettings({ appUrl: event.target.value || undefined })}
149
- />
150
- <p className="text-xs text-muted-foreground">{t('notifications.settings.core.appUrlHint', 'Used to build absolute links in email notifications.')}</p>
151
- </div>
152
- <div className="space-y-2">
153
- <Label htmlFor="notifications-panel-path">{t('notifications.settings.core.panelPath', 'Notification panel path')}</Label>
154
- <Input
155
- id="notifications-panel-path"
156
- value={settings.panelPath}
157
- onChange={(event) => updateSettings({ panelPath: event.target.value })}
158
- />
159
- <p className="text-xs text-muted-foreground">{t('notifications.settings.core.panelPathHint', 'Relative path for the read-only notification panel.')}</p>
160
- </div>
161
- <div className="flex items-center justify-between rounded-lg border p-3">
162
- <div>
163
- <p className="text-sm font-medium">{t('notifications.settings.core.databaseLabel', 'In-app notifications')}</p>
164
- <p className="text-xs text-muted-foreground">{t('notifications.settings.core.databaseHint', 'Store notifications in the database for the panel and bell.')}</p>
165
- </div>
166
- <Switch
167
- checked={settings.strategies.database.enabled}
168
- disabled
169
- onCheckedChange={(checked) => updateStrategy('database', { enabled: checked })}
170
- />
171
- </div>
172
- </CardContent>
173
- </Card>
174
-
175
- <Card>
176
- <CardHeader>
177
- <CardTitle>{t('notifications.settings.email.title', 'Email strategy')}</CardTitle>
178
- <CardDescription>{t('notifications.settings.email.description', 'Send notification copies via Resend using React templates.')}</CardDescription>
179
- </CardHeader>
180
- <CardContent className="grid gap-4 md:grid-cols-2">
181
- <div className="flex items-center justify-between rounded-lg border p-3 md:col-span-2">
182
- <div>
183
- <p className="text-sm font-medium">{t('notifications.settings.email.enabledLabel', 'Enable email delivery')}</p>
184
- <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>
185
- </div>
186
- <Switch
187
- checked={settings.strategies.email.enabled}
188
- onCheckedChange={(checked) => updateStrategy('email', { enabled: checked })}
189
- />
190
- </div>
191
- <div className="space-y-2">
192
- <Label htmlFor="notifications-email-from">{t('notifications.settings.email.from', 'From address')}</Label>
193
- <Input
194
- id="notifications-email-from"
195
- value={settings.strategies.email.from ?? ''}
196
- placeholder="notifications@open-mercato.com"
197
- onChange={(event) => updateStrategy('email', { from: event.target.value || undefined })}
198
- />
199
- </div>
200
- <div className="space-y-2">
201
- <Label htmlFor="notifications-email-reply">{t('notifications.settings.email.replyTo', 'Reply-to')}</Label>
202
- <Input
203
- id="notifications-email-reply"
204
- value={settings.strategies.email.replyTo ?? ''}
205
- placeholder="support@open-mercato.com"
206
- onChange={(event) => updateStrategy('email', { replyTo: event.target.value || undefined })}
207
- />
208
- </div>
209
- <div className="space-y-2 md:col-span-2">
210
- <Label htmlFor="notifications-email-subject-prefix">{t('notifications.settings.email.subjectPrefix', 'Subject prefix')}</Label>
211
- <Input
212
- id="notifications-email-subject-prefix"
213
- value={settings.strategies.email.subjectPrefix ?? ''}
214
- placeholder="[Open Mercato]"
215
- onChange={(event) => updateStrategy('email', { subjectPrefix: event.target.value || undefined })}
216
- />
217
- </div>
218
- </CardContent>
219
- </Card>
220
-
221
- <div className="flex items-center gap-3">
222
- <Button type="button" onClick={handleSave} disabled={saving}>
223
- {saving ? t('notifications.settings.saving', 'Saving...') : t('notifications.settings.save', 'Save settings')}
224
- </Button>
225
- {error && <span className="text-sm text-destructive">{error}</span>}
226
- </div>
227
- </div>
228
- )
229
- }
230
-
231
- export default NotificationSettingsPageClient
@@ -1,50 +0,0 @@
1
- {
2
- "notifications.nav.title": "Benachrichtigungen",
3
- "notifications.title": "Benachrichtigungen",
4
- "notifications.empty": "Keine Benachrichtigungen",
5
- "notifications.markAllRead": "Alle als gelesen markieren",
6
- "notifications.actionTaken": "Ausgeführte Aktion: {action}",
7
- "notifications.filters.all": "Alle",
8
- "notifications.filters.unread": "Ungelesen",
9
- "notifications.filters.actionRequired": "Aktion erforderlich",
10
- "notifications.actions.dismiss": "Verwerfen",
11
- "notifications.actions.undo": "Rückgängig",
12
- "notifications.actions.markRead": "Als gelesen markieren",
13
- "notifications.toast.new": "Neue Benachrichtigung",
14
- "notifications.toast.dismissed": "Benachrichtigung verworfen",
15
- "notifications.toast.actionSuccess": "Aktion erfolgreich ausgeführt",
16
- "notifications.toast.actionError": "Aktion konnte nicht ausgeführt werden",
17
- "notifications.error.load": "Benachrichtigungen konnten nicht geladen werden",
18
- "notifications.error.action": "Aktion konnte nicht ausgeführt werden",
19
- "notifications.badge.unread": "{count} ungelesene Benachrichtigungen",
20
- "notifications.delivery.email.preview": "Neue Benachrichtigung",
21
- "notifications.delivery.email.heading": "Sie haben eine neue Benachrichtigung",
22
- "notifications.delivery.email.bodyIntro": "Prüfen Sie die Benachrichtigung und führen Sie bei Bedarf Aktionen aus.",
23
- "notifications.delivery.email.actionNotice": "Aktionen sind in Open Mercato verfügbar und in dieser E-Mail schreibgeschützt.",
24
- "notifications.delivery.email.openCta": "Benachrichtigungszentrum öffnen",
25
- "notifications.delivery.email.footer": "Open Mercato Benachrichtigungen",
26
- "notifications.delivery.settings.invalid": "Ungültige Zustelleinstellungen",
27
- "notifications.settings.pageTitle": "Benachrichtigungszustellung",
28
- "notifications.settings.pageDescription": "Zustellstrategien für In-App-Benachrichtigungen konfigurieren.",
29
- "notifications.settings.loadError": "Benachrichtigungseinstellungen konnten nicht geladen werden",
30
- "notifications.settings.saveError": "Benachrichtigungseinstellungen konnten nicht gespeichert werden",
31
- "notifications.settings.saveSuccess": "Benachrichtigungseinstellungen gespeichert",
32
- "notifications.settings.loading": "Benachrichtigungseinstellungen werden geladen...",
33
- "notifications.settings.saving": "Speichern...",
34
- "notifications.settings.save": "Einstellungen speichern",
35
- "notifications.settings.core.title": "Kernzustellung",
36
- "notifications.settings.core.description": "Standard-Benachrichtigungszentrum und Panel-Link für externe Kanäle steuern.",
37
- "notifications.settings.core.appUrl": "Anwendungs-URL",
38
- "notifications.settings.core.appUrlHint": "Wird verwendet, um absolute Links in E-Mail-Benachrichtigungen zu erstellen.",
39
- "notifications.settings.core.panelPath": "Pfad des Benachrichtigungspanels",
40
- "notifications.settings.core.panelPathHint": "Relativer Pfad für das schreibgeschützte Benachrichtigungspanel.",
41
- "notifications.settings.core.databaseLabel": "In-App-Benachrichtigungen",
42
- "notifications.settings.core.databaseHint": "Speichert Benachrichtigungen in der Datenbank für Panel und Glocke.",
43
- "notifications.settings.email.title": "E-Mail-Strategie",
44
- "notifications.settings.email.description": "Benachrichtigungskopien per Resend mit React-Templates senden.",
45
- "notifications.settings.email.enabledLabel": "E-Mail-Zustellung aktivieren",
46
- "notifications.settings.email.enabledHint": "E-Mail-Aktionen sind schreibgeschützt und verlinken zurück zum Benachrichtigungszentrum.",
47
- "notifications.settings.email.from": "Absenderadresse",
48
- "notifications.settings.email.replyTo": "Antwortadresse",
49
- "notifications.settings.email.subjectPrefix": "Betreffpräfix"
50
- }
@@ -1,50 +0,0 @@
1
- {
2
- "notifications.nav.title": "Notifications",
3
- "notifications.title": "Notifications",
4
- "notifications.empty": "No notifications",
5
- "notifications.markAllRead": "Mark all read",
6
- "notifications.actionTaken": "Action taken: {action}",
7
- "notifications.filters.all": "All",
8
- "notifications.filters.unread": "Unread",
9
- "notifications.filters.actionRequired": "Action Required",
10
- "notifications.actions.dismiss": "Dismiss",
11
- "notifications.actions.undo": "Undo",
12
- "notifications.actions.markRead": "Mark as read",
13
- "notifications.toast.new": "New notification",
14
- "notifications.toast.dismissed": "Notification dismissed",
15
- "notifications.toast.actionSuccess": "Action completed successfully",
16
- "notifications.toast.actionError": "Failed to execute action",
17
- "notifications.error.load": "Failed to load notifications",
18
- "notifications.error.action": "Failed to execute action",
19
- "notifications.badge.unread": "{count} unread notifications",
20
- "notifications.delivery.email.preview": "New notification",
21
- "notifications.delivery.email.heading": "You have a new notification",
22
- "notifications.delivery.email.bodyIntro": "Review the notification details and take any required actions.",
23
- "notifications.delivery.email.actionNotice": "Actions are available in Open Mercato and are read-only in this email.",
24
- "notifications.delivery.email.openCta": "Open notification center",
25
- "notifications.delivery.email.footer": "Open Mercato notifications",
26
- "notifications.delivery.settings.invalid": "Invalid delivery settings",
27
- "notifications.settings.pageTitle": "Notification Delivery",
28
- "notifications.settings.pageDescription": "Configure delivery strategies for in-app notifications.",
29
- "notifications.settings.loadError": "Failed to load notification settings",
30
- "notifications.settings.saveError": "Failed to save notification settings",
31
- "notifications.settings.saveSuccess": "Notification settings saved",
32
- "notifications.settings.loading": "Loading notification settings...",
33
- "notifications.settings.saving": "Saving...",
34
- "notifications.settings.save": "Save settings",
35
- "notifications.settings.core.title": "Core delivery",
36
- "notifications.settings.core.description": "Control the default notification center and panel link used by external channels.",
37
- "notifications.settings.core.appUrl": "Application URL",
38
- "notifications.settings.core.appUrlHint": "Used to build absolute links in email notifications.",
39
- "notifications.settings.core.panelPath": "Notification panel path",
40
- "notifications.settings.core.panelPathHint": "Relative path for the read-only notification panel.",
41
- "notifications.settings.core.databaseLabel": "In-app notifications",
42
- "notifications.settings.core.databaseHint": "Store notifications in the database for the panel and bell.",
43
- "notifications.settings.email.title": "Email strategy",
44
- "notifications.settings.email.description": "Send notification copies via Resend using React templates.",
45
- "notifications.settings.email.enabledLabel": "Enable email delivery",
46
- "notifications.settings.email.enabledHint": "Email actions are read-only and link back to the notification center.",
47
- "notifications.settings.email.from": "From address",
48
- "notifications.settings.email.replyTo": "Reply-to",
49
- "notifications.settings.email.subjectPrefix": "Subject prefix"
50
- }
@@ -1,50 +0,0 @@
1
- {
2
- "notifications.nav.title": "Notificaciones",
3
- "notifications.title": "Notificaciones",
4
- "notifications.empty": "Sin notificaciones",
5
- "notifications.markAllRead": "Marcar todo como leído",
6
- "notifications.actionTaken": "Acción realizada: {action}",
7
- "notifications.filters.all": "Todas",
8
- "notifications.filters.unread": "No leídas",
9
- "notifications.filters.actionRequired": "Acción requerida",
10
- "notifications.actions.dismiss": "Descartar",
11
- "notifications.actions.undo": "Deshacer",
12
- "notifications.actions.markRead": "Marcar como leída",
13
- "notifications.toast.new": "Nueva notificación",
14
- "notifications.toast.dismissed": "Notificación descartada",
15
- "notifications.toast.actionSuccess": "Acción completada correctamente",
16
- "notifications.toast.actionError": "No se pudo ejecutar la acción",
17
- "notifications.error.load": "No se pudieron cargar las notificaciones",
18
- "notifications.error.action": "No se pudo ejecutar la acción",
19
- "notifications.badge.unread": "{count} notificaciones no leídas",
20
- "notifications.delivery.email.preview": "Nueva notificación",
21
- "notifications.delivery.email.heading": "Tienes una nueva notificación",
22
- "notifications.delivery.email.bodyIntro": "Revisa los detalles de la notificación y realiza las acciones necesarias.",
23
- "notifications.delivery.email.actionNotice": "Las acciones están disponibles en Open Mercato y son de solo lectura en este correo.",
24
- "notifications.delivery.email.openCta": "Abrir centro de notificaciones",
25
- "notifications.delivery.email.footer": "Notificaciones de Open Mercato",
26
- "notifications.delivery.settings.invalid": "Configuración de entrega no válida",
27
- "notifications.settings.pageTitle": "Entrega de notificaciones",
28
- "notifications.settings.pageDescription": "Configura las estrategias de entrega para las notificaciones en la app.",
29
- "notifications.settings.loadError": "No se pudieron cargar los ajustes de notificaciones",
30
- "notifications.settings.saveError": "No se pudieron guardar los ajustes de notificaciones",
31
- "notifications.settings.saveSuccess": "Ajustes de notificaciones guardados",
32
- "notifications.settings.loading": "Cargando ajustes de notificaciones...",
33
- "notifications.settings.saving": "Guardando...",
34
- "notifications.settings.save": "Guardar ajustes",
35
- "notifications.settings.core.title": "Entrega principal",
36
- "notifications.settings.core.description": "Controla el centro de notificaciones y el enlace del panel para canales externos.",
37
- "notifications.settings.core.appUrl": "URL de la aplicación",
38
- "notifications.settings.core.appUrlHint": "Se usa para construir enlaces absolutos en notificaciones por email.",
39
- "notifications.settings.core.panelPath": "Ruta del panel de notificaciones",
40
- "notifications.settings.core.panelPathHint": "Ruta relativa para el panel de notificaciones de solo lectura.",
41
- "notifications.settings.core.databaseLabel": "Notificaciones en la app",
42
- "notifications.settings.core.databaseHint": "Guarda las notificaciones en la base de datos para el panel y la campana.",
43
- "notifications.settings.email.title": "Estrategia de email",
44
- "notifications.settings.email.description": "Envía copias de notificaciones vía Resend con plantillas React.",
45
- "notifications.settings.email.enabledLabel": "Habilitar entrega por email",
46
- "notifications.settings.email.enabledHint": "Las acciones del email son de solo lectura y enlazan al centro de notificaciones.",
47
- "notifications.settings.email.from": "Dirección del remitente",
48
- "notifications.settings.email.replyTo": "Responder a",
49
- "notifications.settings.email.subjectPrefix": "Prefijo de asunto"
50
- }
@@ -1,50 +0,0 @@
1
- {
2
- "notifications.nav.title": "Powiadomienia",
3
- "notifications.title": "Powiadomienia",
4
- "notifications.empty": "Brak powiadomień",
5
- "notifications.markAllRead": "Oznacz wszystkie jako przeczytane",
6
- "notifications.actionTaken": "Wykonana akcja: {action}",
7
- "notifications.filters.all": "Wszystkie",
8
- "notifications.filters.unread": "Nieprzeczytane",
9
- "notifications.filters.actionRequired": "Wymagana akcja",
10
- "notifications.actions.dismiss": "Odrzuć",
11
- "notifications.actions.undo": "Cofnij",
12
- "notifications.actions.markRead": "Oznacz jako przeczytane",
13
- "notifications.toast.new": "Nowe powiadomienie",
14
- "notifications.toast.dismissed": "Powiadomienie odrzucone",
15
- "notifications.toast.actionSuccess": "Akcja wykonana pomyślnie",
16
- "notifications.toast.actionError": "Nie udało się wykonać akcji",
17
- "notifications.error.load": "Nie udało się załadować powiadomień",
18
- "notifications.error.action": "Nie udało się wykonać akcji",
19
- "notifications.badge.unread": "{count} nieprzeczytanych powiadomień",
20
- "notifications.delivery.email.preview": "Nowe powiadomienie",
21
- "notifications.delivery.email.heading": "Masz nowe powiadomienie",
22
- "notifications.delivery.email.bodyIntro": "Sprawdź szczegóły powiadomienia i wykonaj wymagane działania.",
23
- "notifications.delivery.email.actionNotice": "Akcje są dostępne w Open Mercato i w tym e-mailu są tylko do odczytu.",
24
- "notifications.delivery.email.openCta": "Otwórz centrum powiadomień",
25
- "notifications.delivery.email.footer": "Powiadomienia Open Mercato",
26
- "notifications.delivery.settings.invalid": "Nieprawidłowe ustawienia dostarczania",
27
- "notifications.settings.pageTitle": "Dostarczanie powiadomień",
28
- "notifications.settings.pageDescription": "Skonfiguruj strategie dostarczania powiadomień w aplikacji.",
29
- "notifications.settings.loadError": "Nie udało się załadować ustawień powiadomień",
30
- "notifications.settings.saveError": "Nie udało się zapisać ustawień powiadomień",
31
- "notifications.settings.saveSuccess": "Ustawienia powiadomień zapisane",
32
- "notifications.settings.loading": "Ładowanie ustawień powiadomień...",
33
- "notifications.settings.saving": "Zapisywanie...",
34
- "notifications.settings.save": "Zapisz ustawienia",
35
- "notifications.settings.core.title": "Podstawowe dostarczanie",
36
- "notifications.settings.core.description": "Kontroluj centrum powiadomień i link panelu dla kanałów zewnętrznych.",
37
- "notifications.settings.core.appUrl": "URL aplikacji",
38
- "notifications.settings.core.appUrlHint": "Służy do budowania bezwzględnych linków w powiadomieniach e-mail.",
39
- "notifications.settings.core.panelPath": "Ścieżka panelu powiadomień",
40
- "notifications.settings.core.panelPathHint": "Względna ścieżka do panelu powiadomień tylko do odczytu.",
41
- "notifications.settings.core.databaseLabel": "Powiadomienia w aplikacji",
42
- "notifications.settings.core.databaseHint": "Zapisuje powiadomienia w bazie danych dla panelu i dzwonka.",
43
- "notifications.settings.email.title": "Strategia e-mail",
44
- "notifications.settings.email.description": "Wysyłaj kopie powiadomień przez Resend z szablonami React.",
45
- "notifications.settings.email.enabledLabel": "Włącz dostarczanie e-mail",
46
- "notifications.settings.email.enabledHint": "Akcje w e-mailu są tylko do odczytu i prowadzą do centrum powiadomień.",
47
- "notifications.settings.email.from": "Adres nadawcy",
48
- "notifications.settings.email.replyTo": "Odpowiedz do",
49
- "notifications.settings.email.subjectPrefix": "Prefiks tematu"
50
- }
@@ -1,12 +0,0 @@
1
- import type { ModuleInfo } from '@open-mercato/shared/modules/registry'
2
-
3
- export const metadata: ModuleInfo = {
4
- name: 'notifications',
5
- title: 'Notifications',
6
- version: '0.1.0',
7
- description: 'In-app notifications with module-extensible types and actions.',
8
- author: 'Open Mercato Team',
9
- license: 'Proprietary',
10
- }
11
-
12
- export { features } from './acl'