@open-mercato/core 0.4.2-canary-07dbc98202 → 0.4.2-canary-1000cb714f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/entities.ids.generated.js +59 -63
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +0 -2
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/api_docs/frontend/docs/api/page.js +2 -3
- package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
- package/dist/modules/auth/api/admin/nav.js +3 -4
- package/dist/modules/auth/api/admin/nav.js.map +2 -2
- package/dist/modules/auth/api/reset/confirm.js +2 -25
- package/dist/modules/auth/api/reset/confirm.js.map +2 -2
- package/dist/modules/auth/api/reset.js +0 -23
- package/dist/modules/auth/api/reset.js.map +2 -2
- package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
- package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
- package/dist/modules/auth/commands/users.js +0 -55
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +0 -1
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/services/authService.js +3 -3
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/configs/cli.js +0 -6
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +0 -31
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +0 -53
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +0 -26
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/staff/commands/leave-requests.js +0 -79
- package/dist/modules/staff/commands/leave-requests.js.map +2 -2
- package/generated/entities.ids.generated.ts +59 -63
- package/generated/entity-fields-registry.ts +0 -2
- package/package.json +2 -2
- package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
- package/src/modules/auth/api/admin/nav.ts +6 -10
- package/src/modules/auth/api/reset/confirm.ts +2 -25
- package/src/modules/auth/api/reset.ts +0 -23
- package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
- package/src/modules/auth/commands/users.ts +0 -68
- package/src/modules/auth/i18n/de.json +1 -29
- package/src/modules/auth/i18n/en.json +1 -29
- package/src/modules/auth/i18n/es.json +1 -29
- package/src/modules/auth/i18n/pl.json +1 -29
- package/src/modules/auth/lib/setup-app.ts +0 -1
- package/src/modules/auth/services/authService.ts +4 -4
- package/src/modules/business_rules/i18n/en.json +1 -3
- package/src/modules/catalog/i18n/en.json +1 -3
- package/src/modules/configs/cli.ts +0 -6
- package/src/modules/customers/commands/deals.ts +0 -39
- package/src/modules/customers/i18n/en.json +1 -5
- package/src/modules/sales/commands/documents.ts +0 -65
- package/src/modules/sales/commands/payments.ts +0 -33
- package/src/modules/sales/i18n/de.json +0 -20
- package/src/modules/sales/i18n/en.json +1 -25
- package/src/modules/sales/i18n/es.json +0 -20
- package/src/modules/sales/i18n/pl.json +0 -20
- package/src/modules/staff/commands/leave-requests.ts +0 -94
- package/src/modules/staff/i18n/de.json +0 -4
- package/src/modules/staff/i18n/en.json +1 -9
- package/src/modules/staff/i18n/es.json +0 -4
- package/src/modules/staff/i18n/pl.json +0 -4
- package/src/modules/workflows/i18n/en.json +1 -3
- package/dist/generated/entities/notification/index.js +0 -57
- package/dist/generated/entities/notification/index.js.map +0 -7
- package/dist/modules/auth/api/profile/route.js +0 -155
- package/dist/modules/auth/api/profile/route.js.map +0 -7
- package/dist/modules/auth/backend/auth/profile/page.js +0 -99
- package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
- package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -12
- package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
- package/dist/modules/auth/notifications.js +0 -112
- package/dist/modules/auth/notifications.js.map +0 -7
- package/dist/modules/business_rules/notifications.js +0 -28
- package/dist/modules/business_rules/notifications.js.map +0 -7
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
- package/dist/modules/catalog/notifications.js +0 -28
- package/dist/modules/catalog/notifications.js.map +0 -7
- package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
- package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
- package/dist/modules/customers/notifications.js +0 -48
- package/dist/modules/customers/notifications.js.map +0 -7
- package/dist/modules/notifications/acl.js +0 -11
- package/dist/modules/notifications/acl.js.map +0 -7
- package/dist/modules/notifications/api/[id]/action/route.js +0 -74
- package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
- package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/read/route.js +0 -15
- package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
- package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
- package/dist/modules/notifications/api/batch/route.js +0 -17
- package/dist/modules/notifications/api/batch/route.js.map +0 -7
- package/dist/modules/notifications/api/feature/route.js +0 -17
- package/dist/modules/notifications/api/feature/route.js.map +0 -7
- package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
- package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
- package/dist/modules/notifications/api/openapi.js +0 -76
- package/dist/modules/notifications/api/openapi.js.map +0 -7
- package/dist/modules/notifications/api/role/route.js +0 -17
- package/dist/modules/notifications/api/role/route.js.map +0 -7
- package/dist/modules/notifications/api/route.js +0 -85
- package/dist/modules/notifications/api/route.js.map +0 -7
- package/dist/modules/notifications/api/settings/route.js +0 -155
- package/dist/modules/notifications/api/settings/route.js.map +0 -7
- package/dist/modules/notifications/api/unread-count/route.js +0 -38
- package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
- package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
- package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
- package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
- package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
- package/dist/modules/notifications/cli.js +0 -16
- package/dist/modules/notifications/cli.js.map +0 -7
- package/dist/modules/notifications/data/entities.js +0 -112
- package/dist/modules/notifications/data/entities.js.map +0 -7
- package/dist/modules/notifications/data/validators.js +0 -94
- package/dist/modules/notifications/data/validators.js.map +0 -7
- package/dist/modules/notifications/di.js +0 -13
- package/dist/modules/notifications/di.js.map +0 -7
- package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
- package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -219
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
- package/dist/modules/notifications/index.js +0 -14
- package/dist/modules/notifications/index.js.map +0 -7
- package/dist/modules/notifications/lib/deliveryConfig.js +0 -105
- package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
- package/dist/modules/notifications/lib/events.js +0 -12
- package/dist/modules/notifications/lib/events.js.map +0 -7
- package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
- package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
- package/dist/modules/notifications/lib/notificationFactory.js +0 -54
- package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
- package/dist/modules/notifications/lib/notificationMapper.js +0 -34
- package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
- package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
- package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
- package/dist/modules/notifications/lib/notificationService.js +0 -279
- package/dist/modules/notifications/lib/notificationService.js.map +0 -7
- package/dist/modules/notifications/lib/routeHelpers.js +0 -101
- package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
- package/dist/modules/notifications/lib/safeHref.js +0 -24
- package/dist/modules/notifications/lib/safeHref.js.map +0 -7
- package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
- package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
- package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
- package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
- package/dist/modules/notifications/subscribers/deliver-notification.js +0 -139
- package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
- package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
- package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
- package/dist/modules/sales/notifications.client.js +0 -51
- package/dist/modules/sales/notifications.client.js.map +0 -7
- package/dist/modules/sales/notifications.js +0 -88
- package/dist/modules/sales/notifications.js.map +0 -7
- package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
- package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/index.js +0 -7
- package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
- package/dist/modules/staff/notifications.js +0 -75
- package/dist/modules/staff/notifications.js.map +0 -7
- package/dist/modules/workflows/notifications.js +0 -28
- package/dist/modules/workflows/notifications.js.map +0 -7
- package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
- package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
- package/generated/entities/notification/index.ts +0 -27
- package/src/modules/auth/api/profile/route.ts +0 -160
- package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -8
- package/src/modules/auth/backend/auth/profile/page.tsx +0 -127
- package/src/modules/auth/notifications.ts +0 -109
- package/src/modules/business_rules/notifications.ts +0 -25
- package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
- package/src/modules/catalog/notifications.ts +0 -25
- package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
- package/src/modules/customers/notifications.ts +0 -44
- package/src/modules/notifications/acl.ts +0 -7
- package/src/modules/notifications/api/[id]/action/route.ts +0 -75
- package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
- package/src/modules/notifications/api/[id]/read/route.ts +0 -12
- package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
- package/src/modules/notifications/api/batch/route.ts +0 -14
- package/src/modules/notifications/api/feature/route.ts +0 -14
- package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
- package/src/modules/notifications/api/openapi.ts +0 -76
- package/src/modules/notifications/api/role/route.ts +0 -14
- package/src/modules/notifications/api/route.ts +0 -92
- package/src/modules/notifications/api/settings/route.ts +0 -157
- package/src/modules/notifications/api/unread-count/route.ts +0 -38
- package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
- package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
- package/src/modules/notifications/cli.ts +0 -18
- package/src/modules/notifications/data/entities.ts +0 -99
- package/src/modules/notifications/data/validators.ts +0 -110
- package/src/modules/notifications/di.ts +0 -11
- package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
- package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
- package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -231
- package/src/modules/notifications/i18n/de.json +0 -50
- package/src/modules/notifications/i18n/en.json +0 -50
- package/src/modules/notifications/i18n/es.json +0 -50
- package/src/modules/notifications/i18n/pl.json +0 -50
- package/src/modules/notifications/index.ts +0 -12
- package/src/modules/notifications/lib/deliveryConfig.ts +0 -145
- package/src/modules/notifications/lib/events.ts +0 -48
- package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
- package/src/modules/notifications/lib/notificationFactory.ts +0 -76
- package/src/modules/notifications/lib/notificationMapper.ts +0 -33
- package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
- package/src/modules/notifications/lib/notificationService.ts +0 -414
- package/src/modules/notifications/lib/routeHelpers.ts +0 -151
- package/src/modules/notifications/lib/safeHref.ts +0 -29
- package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -300
- package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
- package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
- package/src/modules/notifications/subscribers/deliver-notification.ts +0 -175
- package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
- package/src/modules/sales/notifications.client.ts +0 -65
- package/src/modules/sales/notifications.ts +0 -82
- package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
- package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
- package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
- package/src/modules/sales/widgets/notifications/index.ts +0 -2
- package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
- package/src/modules/staff/notifications.ts +0 -71
- package/src/modules/workflows/notifications.ts +0 -25
- package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/auth/backend/auth/profile/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ntype ProfileResponse = {\n email?: string | null\n}\n\ntype ProfileUpdateResponse = {\n ok?: boolean\n email?: string | null\n}\n\ntype ProfileFormValues = {\n email: string\n password: string\n confirmPassword: string\n}\n\nexport default function AuthProfilePage() {\n const t = useT()\n const router = useRouter()\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [email, setEmail] = React.useState('')\n const [formKey, setFormKey] = React.useState(0)\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<ProfileResponse>('/api/auth/profile')\n if (!ok) throw new Error('load_failed')\n const resolvedEmail = typeof result?.email === 'string' ? result.email : ''\n if (!cancelled) setEmail(resolvedEmail)\n } catch (err) {\n console.error('Failed to load auth profile', err)\n if (!cancelled) setError(t('auth.profile.form.errors.load', 'Failed to load profile.'))\n } finally {\n if (!cancelled) setLoading(false)\n }\n }\n load()\n return () => { cancelled = true }\n }, [t])\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'email', label: t('auth.profile.form.email', 'Email'), type: 'text', required: true },\n { id: 'password', label: t('auth.profile.form.password', 'New password'), type: 'text' },\n { id: 'confirmPassword', label: t('auth.profile.form.confirmPassword', 'Confirm new password'), type: 'text' },\n ], [t])\n\n const handleSubmit = React.useCallback(async (values: ProfileFormValues) => {\n const nextEmail = values.email?.trim() ?? ''\n const password = values.password?.trim() ?? ''\n const confirmPassword = values.confirmPassword?.trim() ?? ''\n\n if (!nextEmail) {\n const message = t('auth.profile.form.errors.emailRequired', 'Email is required.')\n throw createCrudFormError(message, { email: message })\n }\n\n if (password || confirmPassword) {\n if (password !== confirmPassword) {\n const message = t('auth.profile.form.errors.passwordMismatch', 'Passwords do not match.')\n throw createCrudFormError(message, { confirmPassword: message })\n }\n }\n\n if (!password && nextEmail === email) {\n throw createCrudFormError(t('auth.profile.form.errors.noChanges', 'No changes to save.'))\n }\n\n const payload: { email: string; password?: string } = { email: nextEmail }\n if (password) payload.password = password\n\n const result = await readApiResultOrThrow<ProfileUpdateResponse>(\n '/api/auth/profile',\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n { errorMessage: t('auth.profile.form.errors.save', 'Failed to update profile.') },\n )\n\n const resolvedEmail = typeof result?.email === 'string' ? result.email : nextEmail\n setEmail(resolvedEmail)\n setFormKey((prev) => prev + 1)\n flash(t('auth.profile.form.success', 'Profile updated.'), 'success')\n router.refresh()\n }, [email, router, t])\n\n return (\n <Page>\n <PageBody>\n {loading ? (\n <LoadingMessage label={t('auth.profile.form.loading', 'Loading profile...')} />\n ) : error ? (\n <ErrorMessage label={error} />\n ) : (\n <CrudForm<ProfileFormValues>\n key={formKey}\n title={t('auth.profile.title', 'Profile')}\n fields={fields}\n initialValues={{\n email,\n password: '',\n confirmPassword: '',\n }}\n submitLabel={t('auth.profile.form.save', 'Save changes')}\n onSubmit={handleSubmit}\n />\n )}\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AA0GU;AAzGV,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAgC;AACzC,SAAS,SAAS,4BAA4B;AAC9C,SAAS,2BAA2B;AACpC,SAAS,aAAa;AACtB,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,YAAY;AAiBN,SAAR,kBAAmC;AACxC,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,IAAI;AAC5D,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,EAAE;AAC3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|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/auth/backend/auth/profile/page.meta.ts"],
|
|
4
|
-
"sourcesContent": ["export const metadata = {\n requireAuth: true,\n pageTitle: 'Profile',\n pageTitleKey: 'auth.profile.title',\n breadcrumb: [\n { label: 'Profile', labelKey: 'auth.profile.title' },\n ],\n}\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,IACV,EAAE,OAAO,WAAW,UAAU,qBAAqB;AAAA,EACrD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "auth.password_reset.requested",
|
|
4
|
-
module: "auth",
|
|
5
|
-
titleKey: "auth.notifications.passwordReset.requested.title",
|
|
6
|
-
bodyKey: "auth.notifications.passwordReset.requested.body",
|
|
7
|
-
icon: "key",
|
|
8
|
-
severity: "info",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/auth/profile",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/auth/profile",
|
|
19
|
-
expiresAfterHours: 24
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: "auth.password_reset.completed",
|
|
23
|
-
module: "auth",
|
|
24
|
-
titleKey: "auth.notifications.passwordReset.completed.title",
|
|
25
|
-
bodyKey: "auth.notifications.passwordReset.completed.body",
|
|
26
|
-
icon: "check-circle",
|
|
27
|
-
severity: "success",
|
|
28
|
-
actions: [],
|
|
29
|
-
expiresAfterHours: 72
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: "auth.account.locked",
|
|
33
|
-
module: "auth",
|
|
34
|
-
titleKey: "auth.notifications.account.locked.title",
|
|
35
|
-
bodyKey: "auth.notifications.account.locked.body",
|
|
36
|
-
icon: "lock",
|
|
37
|
-
severity: "warning",
|
|
38
|
-
actions: [
|
|
39
|
-
{
|
|
40
|
-
id: "contact_support",
|
|
41
|
-
labelKey: "auth.actions.contactSupport",
|
|
42
|
-
variant: "default",
|
|
43
|
-
href: "/backend/support",
|
|
44
|
-
icon: "mail"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
linkHref: "/backend/support"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "auth.login.new_device",
|
|
51
|
-
module: "auth",
|
|
52
|
-
titleKey: "auth.notifications.login.newDevice.title",
|
|
53
|
-
bodyKey: "auth.notifications.login.newDevice.body",
|
|
54
|
-
icon: "smartphone",
|
|
55
|
-
severity: "info",
|
|
56
|
-
actions: [
|
|
57
|
-
{
|
|
58
|
-
id: "view_sessions",
|
|
59
|
-
labelKey: "auth.actions.viewSessions",
|
|
60
|
-
variant: "outline",
|
|
61
|
-
href: "/backend/auth/sessions",
|
|
62
|
-
icon: "list"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
linkHref: "/backend/auth/sessions",
|
|
66
|
-
expiresAfterHours: 168
|
|
67
|
-
// 7 days
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "auth.role.assigned",
|
|
71
|
-
module: "auth",
|
|
72
|
-
titleKey: "auth.notifications.role.assigned.title",
|
|
73
|
-
bodyKey: "auth.notifications.role.assigned.body",
|
|
74
|
-
icon: "user-plus",
|
|
75
|
-
severity: "success",
|
|
76
|
-
actions: [
|
|
77
|
-
{
|
|
78
|
-
id: "view_permissions",
|
|
79
|
-
labelKey: "auth.actions.viewPermissions",
|
|
80
|
-
variant: "outline",
|
|
81
|
-
href: "/backend/auth/profile",
|
|
82
|
-
icon: "shield"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
linkHref: "/backend/auth/profile",
|
|
86
|
-
expiresAfterHours: 168
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: "auth.role.revoked",
|
|
90
|
-
module: "auth",
|
|
91
|
-
titleKey: "auth.notifications.role.revoked.title",
|
|
92
|
-
bodyKey: "auth.notifications.role.revoked.body",
|
|
93
|
-
icon: "user-minus",
|
|
94
|
-
severity: "warning",
|
|
95
|
-
actions: [
|
|
96
|
-
{
|
|
97
|
-
id: "view_profile",
|
|
98
|
-
labelKey: "common.view",
|
|
99
|
-
variant: "outline",
|
|
100
|
-
href: "/backend/auth/profile"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
linkHref: "/backend/auth/profile",
|
|
104
|
-
expiresAfterHours: 168
|
|
105
|
-
}
|
|
106
|
-
];
|
|
107
|
-
var notifications_default = notificationTypes;
|
|
108
|
-
export {
|
|
109
|
-
notifications_default as default,
|
|
110
|
-
notificationTypes
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/auth/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'auth.password_reset.requested',\n module: 'auth',\n titleKey: 'auth.notifications.passwordReset.requested.title',\n bodyKey: 'auth.notifications.passwordReset.requested.body',\n icon: 'key',\n severity: 'info',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/auth/profile',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 24,\n },\n {\n type: 'auth.password_reset.completed',\n module: 'auth',\n titleKey: 'auth.notifications.passwordReset.completed.title',\n bodyKey: 'auth.notifications.passwordReset.completed.body',\n icon: 'check-circle',\n severity: 'success',\n actions: [],\n expiresAfterHours: 72,\n },\n {\n type: 'auth.account.locked',\n module: 'auth',\n titleKey: 'auth.notifications.account.locked.title',\n bodyKey: 'auth.notifications.account.locked.body',\n icon: 'lock',\n severity: 'warning',\n actions: [\n {\n id: 'contact_support',\n labelKey: 'auth.actions.contactSupport',\n variant: 'default',\n href: '/backend/support',\n icon: 'mail',\n },\n ],\n linkHref: '/backend/support',\n },\n {\n type: 'auth.login.new_device',\n module: 'auth',\n titleKey: 'auth.notifications.login.newDevice.title',\n bodyKey: 'auth.notifications.login.newDevice.body',\n icon: 'smartphone',\n severity: 'info',\n actions: [\n {\n id: 'view_sessions',\n labelKey: 'auth.actions.viewSessions',\n variant: 'outline',\n href: '/backend/auth/sessions',\n icon: 'list',\n },\n ],\n linkHref: '/backend/auth/sessions',\n expiresAfterHours: 168, // 7 days\n },\n {\n type: 'auth.role.assigned',\n module: 'auth',\n titleKey: 'auth.notifications.role.assigned.title',\n bodyKey: 'auth.notifications.role.assigned.body',\n icon: 'user-plus',\n severity: 'success',\n actions: [\n {\n id: 'view_permissions',\n labelKey: 'auth.actions.viewPermissions',\n variant: 'outline',\n href: '/backend/auth/profile',\n icon: 'shield',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 168,\n },\n {\n type: 'auth.role.revoked',\n module: 'auth',\n titleKey: 'auth.notifications.role.revoked.title',\n bodyKey: 'auth.notifications.role.revoked.body',\n icon: 'user-minus',\n severity: 'warning',\n actions: [\n {\n id: 'view_profile',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/auth/profile',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 168,\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAA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AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "business_rules.rule.execution_failed",
|
|
4
|
-
module: "business_rules",
|
|
5
|
-
titleKey: "businessRules.notifications.rule.executionFailed.title",
|
|
6
|
-
bodyKey: "businessRules.notifications.rule.executionFailed.body",
|
|
7
|
-
icon: "alert-triangle",
|
|
8
|
-
severity: "error",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/business-rules/{sourceEntityId}",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/business-rules/{sourceEntityId}",
|
|
19
|
-
expiresAfterHours: 168
|
|
20
|
-
// 7 days
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
var notifications_default = notificationTypes;
|
|
24
|
-
export {
|
|
25
|
-
notifications_default as default,
|
|
26
|
-
notificationTypes
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/business_rules/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'business_rules.rule.execution_failed',\n module: 'business_rules',\n titleKey: 'businessRules.notifications.rule.executionFailed.title',\n bodyKey: 'businessRules.notifications.rule.executionFailed.body',\n icon: 'alert-triangle',\n severity: 'error',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/business-rules/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/business-rules/{sourceEntityId}',\n expiresAfterHours: 168, // 7 days\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { resolveNotificationService } from "../../notifications/lib/notificationService.js";
|
|
2
|
-
import { buildFeatureNotificationFromType } from "../../notifications/lib/notificationBuilder.js";
|
|
3
|
-
import { notificationTypes } from "../notifications.js";
|
|
4
|
-
const metadata = {
|
|
5
|
-
event: "business_rules.rule.execution_failed",
|
|
6
|
-
persistent: true,
|
|
7
|
-
id: "business_rules:rule-execution-failed-notification"
|
|
8
|
-
};
|
|
9
|
-
async function handle(payload, ctx) {
|
|
10
|
-
try {
|
|
11
|
-
const notificationService = resolveNotificationService(ctx);
|
|
12
|
-
const typeDef = notificationTypes.find((type) => type.type === "business_rules.rule.execution_failed");
|
|
13
|
-
if (!typeDef) return;
|
|
14
|
-
const notificationInput = buildFeatureNotificationFromType(typeDef, {
|
|
15
|
-
requiredFeature: "business_rules.manage",
|
|
16
|
-
bodyVariables: {
|
|
17
|
-
ruleName: payload.ruleName,
|
|
18
|
-
entityType: payload.entityType ?? "",
|
|
19
|
-
errorMessage: payload.errorMessage ?? "Unknown error"
|
|
20
|
-
},
|
|
21
|
-
sourceEntityType: "business_rules:rule",
|
|
22
|
-
sourceEntityId: payload.ruleId,
|
|
23
|
-
linkHref: `/backend/business-rules/${payload.ruleId}`
|
|
24
|
-
});
|
|
25
|
-
await notificationService.createForFeature(notificationInput, {
|
|
26
|
-
tenantId: payload.tenantId,
|
|
27
|
-
organizationId: payload.organizationId ?? null
|
|
28
|
-
});
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error("[business_rules:rule-execution-failed-notification] Failed to create notification:", err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
handle as default,
|
|
35
|
-
metadata
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=rule-execution-failed-notification.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/modules/business_rules/subscribers/rule-execution-failed-notification.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport { resolveNotificationService } from '../../notifications/lib/notificationService'\nimport { buildFeatureNotificationFromType } from '../../notifications/lib/notificationBuilder'\nimport { notificationTypes } from '../notifications'\n\nexport const metadata = {\n event: 'business_rules.rule.execution_failed',\n persistent: true,\n id: 'business_rules:rule-execution-failed-notification',\n}\n\ntype RuleExecutionFailedPayload = {\n ruleId: string\n ruleName: string\n entityType?: string | null\n errorMessage?: string | null\n tenantId: string\n organizationId?: string | null\n}\n\ntype ResolverContext = {\n resolve: <T = unknown>(name: string) => T\n}\n\nexport default async function handle(payload: RuleExecutionFailedPayload, ctx: ResolverContext) {\n try {\n const notificationService = resolveNotificationService(ctx)\n const typeDef = notificationTypes.find((type) => type.type === 'business_rules.rule.execution_failed')\n if (!typeDef) return\n\n const notificationInput = buildFeatureNotificationFromType(typeDef, {\n requiredFeature: 'business_rules.manage',\n bodyVariables: {\n ruleName: payload.ruleName,\n entityType: payload.entityType ?? '',\n errorMessage: payload.errorMessage ?? 'Unknown error',\n },\n sourceEntityType: 'business_rules:rule',\n sourceEntityId: payload.ruleId,\n linkHref: `/backend/business-rules/${payload.ruleId}`,\n })\n\n await notificationService.createForFeature(notificationInput, {\n tenantId: payload.tenantId,\n organizationId: payload.organizationId ?? null,\n })\n } catch (err) {\n console.error('[business_rules:rule-execution-failed-notification] Failed to create notification:', err)\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,kCAAkC;AAC3C,SAAS,wCAAwC;AACjD,SAAS,yBAAyB;AAE3B,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAeA,eAAO,OAA8B,SAAqC,KAAsB;AAC9F,MAAI;AACF,UAAM,sBAAsB,2BAA2B,GAAG;AAC1D,UAAM,UAAU,kBAAkB,KAAK,CAAC,SAAS,KAAK,SAAS,sCAAsC;AACrG,QAAI,CAAC,QAAS;AAEd,UAAM,oBAAoB,iCAAiC,SAAS;AAAA,MAClE,iBAAiB;AAAA,MACjB,eAAe;AAAA,QACb,UAAU,QAAQ;AAAA,QAClB,YAAY,QAAQ,cAAc;AAAA,QAClC,cAAc,QAAQ,gBAAgB;AAAA,MACxC;AAAA,MACA,kBAAkB;AAAA,MAClB,gBAAgB,QAAQ;AAAA,MACxB,UAAU,2BAA2B,QAAQ,MAAM;AAAA,IACrD,CAAC;AAED,UAAM,oBAAoB,iBAAiB,mBAAmB;AAAA,MAC5D,UAAU,QAAQ;AAAA,MAClB,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,YAAQ,MAAM,sFAAsF,GAAG;AAAA,EACzG;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "catalog.product.low_stock",
|
|
4
|
-
module: "catalog",
|
|
5
|
-
titleKey: "catalog.notifications.product.lowStock.title",
|
|
6
|
-
bodyKey: "catalog.notifications.product.lowStock.body",
|
|
7
|
-
icon: "package-x",
|
|
8
|
-
severity: "warning",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/catalog/products/{sourceEntityId}",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/catalog/products/{sourceEntityId}",
|
|
19
|
-
expiresAfterHours: 72
|
|
20
|
-
// 3 days
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
var notifications_default = notificationTypes;
|
|
24
|
-
export {
|
|
25
|
-
notifications_default as default,
|
|
26
|
-
notificationTypes
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/catalog/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'catalog.product.low_stock',\n module: 'catalog',\n titleKey: 'catalog.notifications.product.lowStock.title',\n bodyKey: 'catalog.notifications.product.lowStock.body',\n icon: 'package-x',\n severity: 'warning',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/catalog/products/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/catalog/products/{sourceEntityId}',\n expiresAfterHours: 72, // 3 days\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { resolveNotificationService } from "../../notifications/lib/notificationService.js";
|
|
2
|
-
import { buildFeatureNotificationFromType } from "../../notifications/lib/notificationBuilder.js";
|
|
3
|
-
import { notificationTypes } from "../notifications.js";
|
|
4
|
-
const metadata = {
|
|
5
|
-
event: "catalog.product.stock_low",
|
|
6
|
-
persistent: true,
|
|
7
|
-
id: "catalog:low-stock-notification"
|
|
8
|
-
};
|
|
9
|
-
async function handle(payload, ctx) {
|
|
10
|
-
try {
|
|
11
|
-
const notificationService = resolveNotificationService(ctx);
|
|
12
|
-
const typeDef = notificationTypes.find((type) => type.type === "catalog.product.low_stock");
|
|
13
|
-
if (!typeDef) return;
|
|
14
|
-
const notificationInput = buildFeatureNotificationFromType(typeDef, {
|
|
15
|
-
requiredFeature: "catalog.products.manage",
|
|
16
|
-
bodyVariables: {
|
|
17
|
-
productName: payload.productName,
|
|
18
|
-
sku: payload.sku ?? "",
|
|
19
|
-
currentStock: String(payload.currentStock),
|
|
20
|
-
threshold: String(payload.threshold)
|
|
21
|
-
},
|
|
22
|
-
sourceEntityType: "catalog:product",
|
|
23
|
-
sourceEntityId: payload.productId,
|
|
24
|
-
linkHref: `/backend/catalog/products/${payload.productId}`
|
|
25
|
-
});
|
|
26
|
-
await notificationService.createForFeature(notificationInput, {
|
|
27
|
-
tenantId: payload.tenantId,
|
|
28
|
-
organizationId: payload.organizationId ?? null
|
|
29
|
-
});
|
|
30
|
-
} catch (err) {
|
|
31
|
-
console.error("[catalog:low-stock-notification] Failed to create notification:", err);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
handle as default,
|
|
36
|
-
metadata
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=low-stock-notification.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/modules/catalog/subscribers/low-stock-notification.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport { resolveNotificationService } from '../../notifications/lib/notificationService'\nimport { buildFeatureNotificationFromType } from '../../notifications/lib/notificationBuilder'\nimport { notificationTypes } from '../notifications'\n\nexport const metadata = {\n event: 'catalog.product.stock_low',\n persistent: true,\n id: 'catalog:low-stock-notification',\n}\n\ntype LowStockPayload = {\n productId: string\n productName: string\n sku?: string | null\n currentStock: number\n threshold: number\n tenantId: string\n organizationId?: string | null\n}\n\ntype ResolverContext = {\n resolve: <T = unknown>(name: string) => T\n}\n\nexport default async function handle(payload: LowStockPayload, ctx: ResolverContext) {\n try {\n const notificationService = resolveNotificationService(ctx)\n const typeDef = notificationTypes.find((type) => type.type === 'catalog.product.low_stock')\n if (!typeDef) return\n\n const notificationInput = buildFeatureNotificationFromType(typeDef, {\n requiredFeature: 'catalog.products.manage',\n bodyVariables: {\n productName: payload.productName,\n sku: payload.sku ?? '',\n currentStock: String(payload.currentStock),\n threshold: String(payload.threshold),\n },\n sourceEntityType: 'catalog:product',\n sourceEntityId: payload.productId,\n linkHref: `/backend/catalog/products/${payload.productId}`,\n })\n\n await notificationService.createForFeature(notificationInput, {\n tenantId: payload.tenantId,\n organizationId: payload.organizationId ?? null,\n })\n } catch (err) {\n console.error('[catalog:low-stock-notification] Failed to create notification:', err)\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,kCAAkC;AAC3C,SAAS,wCAAwC;AACjD,SAAS,yBAAyB;AAE3B,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAgBA,eAAO,OAA8B,SAA0B,KAAsB;AACnF,MAAI;AACF,UAAM,sBAAsB,2BAA2B,GAAG;AAC1D,UAAM,UAAU,kBAAkB,KAAK,CAAC,SAAS,KAAK,SAAS,2BAA2B;AAC1F,QAAI,CAAC,QAAS;AAEd,UAAM,oBAAoB,iCAAiC,SAAS;AAAA,MAClE,iBAAiB;AAAA,MACjB,eAAe;AAAA,QACb,aAAa,QAAQ;AAAA,QACrB,KAAK,QAAQ,OAAO;AAAA,QACpB,cAAc,OAAO,QAAQ,YAAY;AAAA,QACzC,WAAW,OAAO,QAAQ,SAAS;AAAA,MACrC;AAAA,MACA,kBAAkB;AAAA,MAClB,gBAAgB,QAAQ;AAAA,MACxB,UAAU,6BAA6B,QAAQ,SAAS;AAAA,IAC1D,CAAC;AAED,UAAM,oBAAoB,iBAAiB,mBAAmB;AAAA,MAC5D,UAAU,QAAQ;AAAA,MAClB,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,YAAQ,MAAM,mEAAmE,GAAG;AAAA,EACtF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "customers.deal.won",
|
|
4
|
-
module: "customers",
|
|
5
|
-
titleKey: "customers.notifications.deal.won.title",
|
|
6
|
-
bodyKey: "customers.notifications.deal.won.body",
|
|
7
|
-
icon: "trophy",
|
|
8
|
-
severity: "success",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/customers/deals/{sourceEntityId}",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/customers/deals/{sourceEntityId}",
|
|
19
|
-
expiresAfterHours: 168
|
|
20
|
-
// 7 days
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: "customers.deal.lost",
|
|
24
|
-
module: "customers",
|
|
25
|
-
titleKey: "customers.notifications.deal.lost.title",
|
|
26
|
-
bodyKey: "customers.notifications.deal.lost.body",
|
|
27
|
-
icon: "x-circle",
|
|
28
|
-
severity: "warning",
|
|
29
|
-
actions: [
|
|
30
|
-
{
|
|
31
|
-
id: "view",
|
|
32
|
-
labelKey: "common.view",
|
|
33
|
-
variant: "outline",
|
|
34
|
-
href: "/backend/customers/deals/{sourceEntityId}",
|
|
35
|
-
icon: "external-link"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
linkHref: "/backend/customers/deals/{sourceEntityId}",
|
|
39
|
-
expiresAfterHours: 168
|
|
40
|
-
// 7 days
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
var notifications_default = notificationTypes;
|
|
44
|
-
export {
|
|
45
|
-
notifications_default as default,
|
|
46
|
-
notificationTypes
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/customers/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'customers.deal.won',\n module: 'customers',\n titleKey: 'customers.notifications.deal.won.title',\n bodyKey: 'customers.notifications.deal.won.body',\n icon: 'trophy',\n severity: 'success',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/customers/deals/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/customers/deals/{sourceEntityId}',\n expiresAfterHours: 168, // 7 days\n },\n {\n type: 'customers.deal.lost',\n module: 'customers',\n titleKey: 'customers.notifications.deal.lost.title',\n bodyKey: 'customers.notifications.deal.lost.body',\n icon: 'x-circle',\n severity: 'warning',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/customers/deals/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/customers/deals/{sourceEntityId}',\n expiresAfterHours: 168, // 7 days\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const features = [
|
|
2
|
-
{ id: "notifications.view", title: "View own notifications", module: "notifications" },
|
|
3
|
-
{ id: "notifications.create", title: "Create notifications for others", module: "notifications" },
|
|
4
|
-
{ id: "notifications.manage", title: "Manage all notifications", module: "notifications" }
|
|
5
|
-
];
|
|
6
|
-
var acl_default = features;
|
|
7
|
-
export {
|
|
8
|
-
acl_default as default,
|
|
9
|
-
features
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=acl.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/notifications/acl.ts"],
|
|
4
|
-
"sourcesContent": ["export const features = [\n { id: 'notifications.view', title: 'View own notifications', module: 'notifications' },\n { id: 'notifications.create', title: 'Create notifications for others', module: 'notifications' },\n { id: 'notifications.manage', title: 'Manage all notifications', module: 'notifications' },\n]\n\nexport default features\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,EAAE,IAAI,sBAAsB,OAAO,0BAA0B,QAAQ,gBAAgB;AAAA,EACrF,EAAE,IAAI,wBAAwB,OAAO,mCAAmC,QAAQ,gBAAgB;AAAA,EAChG,EAAE,IAAI,wBAAwB,OAAO,4BAA4B,QAAQ,gBAAgB;AAC3F;AAEA,IAAO,cAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { executeActionSchema } from "../../../data/validators.js";
|
|
2
|
-
import { actionResultResponseSchema, errorResponseSchema } from "../../openapi.js";
|
|
3
|
-
import { resolveNotificationContext } from "../../../lib/routeHelpers.js";
|
|
4
|
-
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
5
|
-
const metadata = {
|
|
6
|
-
POST: { requireAuth: true }
|
|
7
|
-
};
|
|
8
|
-
async function POST(req, { params }) {
|
|
9
|
-
const { id } = await params;
|
|
10
|
-
const { service, scope } = await resolveNotificationContext(req);
|
|
11
|
-
const body = await req.json().catch(() => ({}));
|
|
12
|
-
const input = executeActionSchema.parse(body);
|
|
13
|
-
try {
|
|
14
|
-
const { notification, result } = await service.executeAction(id, input, scope);
|
|
15
|
-
const action = notification.actionData?.actions?.find((a) => a.id === input.actionId);
|
|
16
|
-
const href = action?.href?.replace("{sourceEntityId}", notification.sourceEntityId ?? "");
|
|
17
|
-
return Response.json({
|
|
18
|
-
ok: true,
|
|
19
|
-
result,
|
|
20
|
-
href
|
|
21
|
-
});
|
|
22
|
-
} catch (error) {
|
|
23
|
-
const { t } = await resolveTranslations();
|
|
24
|
-
const fallback = t("notifications.error.action", "Failed to execute action");
|
|
25
|
-
const message = error instanceof Error && error.message ? error.message : fallback;
|
|
26
|
-
return Response.json({ error: message }, { status: 400 });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const openApi = {
|
|
30
|
-
POST: {
|
|
31
|
-
summary: "Execute notification action",
|
|
32
|
-
tags: ["Notifications"],
|
|
33
|
-
parameters: [
|
|
34
|
-
{
|
|
35
|
-
name: "id",
|
|
36
|
-
in: "path",
|
|
37
|
-
required: true,
|
|
38
|
-
schema: { type: "string", format: "uuid" }
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
requestBody: {
|
|
42
|
-
required: true,
|
|
43
|
-
content: {
|
|
44
|
-
"application/json": {
|
|
45
|
-
schema: executeActionSchema
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
responses: {
|
|
50
|
-
200: {
|
|
51
|
-
description: "Action executed successfully",
|
|
52
|
-
content: {
|
|
53
|
-
"application/json": {
|
|
54
|
-
schema: actionResultResponseSchema
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
400: {
|
|
59
|
-
description: "Action not found or failed",
|
|
60
|
-
content: {
|
|
61
|
-
"application/json": {
|
|
62
|
-
schema: errorResponseSchema
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
export {
|
|
70
|
-
POST,
|
|
71
|
-
metadata,
|
|
72
|
-
openApi
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/action/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { executeActionSchema } from '../../../data/validators'\nimport { actionResultResponseSchema, errorResponseSchema } from '../../openapi'\nimport { resolveNotificationContext } from '../../../lib/routeHelpers'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\n\nexport const metadata = {\n POST: { requireAuth: true },\n}\n\nexport async function POST(req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params\n const { service, scope } = await resolveNotificationContext(req)\n\n const body = await req.json().catch(() => ({}))\n const input = executeActionSchema.parse(body)\n\n try {\n const { notification, result } = await service.executeAction(id, input, scope)\n\n const action = notification.actionData?.actions?.find((a) => a.id === input.actionId)\n const href = action?.href?.replace('{sourceEntityId}', notification.sourceEntityId ?? '')\n\n return Response.json({\n ok: true,\n result,\n href,\n })\n } catch (error) {\n const { t } = await resolveTranslations()\n const fallback = t('notifications.error.action', 'Failed to execute action')\n const message = error instanceof Error && error.message ? error.message : fallback\n return Response.json({ error: message }, { status: 400 })\n }\n}\n\nexport const openApi = {\n POST: {\n summary: 'Execute notification action',\n tags: ['Notifications'],\n parameters: [\n {\n name: 'id',\n in: 'path',\n required: true,\n schema: { type: 'string', format: 'uuid' },\n },\n ],\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: executeActionSchema,\n },\n },\n },\n responses: {\n 200: {\n description: 'Action executed successfully',\n content: {\n 'application/json': {\n schema: actionResultResponseSchema,\n },\n },\n },\n 400: {\n description: 'Action not found or failed',\n content: {\n 'application/json': {\n schema: errorResponseSchema,\n },\n },\n },\n },\n },\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,2BAA2B;AACpC,SAAS,4BAA4B,2BAA2B;AAChE,SAAS,kCAAkC;AAC3C,SAAS,2BAA2B;AAE7B,MAAM,WAAW;AAAA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;AAAA,MACT,KAAK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,MACA,KAAK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from "../../../lib/routeHelpers.js";
|
|
2
|
-
const metadata = {
|
|
3
|
-
PUT: { requireAuth: true }
|
|
4
|
-
};
|
|
5
|
-
const PUT = createSingleNotificationActionRoute("dismiss");
|
|
6
|
-
const openApi = createSingleNotificationActionOpenApi(
|
|
7
|
-
"Dismiss notification",
|
|
8
|
-
"Notification dismissed"
|
|
9
|
-
);
|
|
10
|
-
export {
|
|
11
|
-
PUT,
|
|
12
|
-
metadata,
|
|
13
|
-
openApi
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/dismiss/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from '../../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport const PUT = createSingleNotificationActionRoute('dismiss')\n\nexport const openApi = createSingleNotificationActionOpenApi(\n 'Dismiss notification',\n 'Notification dismissed'\n)\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qCAAqC,6CAA6C;AAEpF,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEO,MAAM,MAAM,oCAAoC,SAAS;AAEzD,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from "../../../lib/routeHelpers.js";
|
|
2
|
-
const metadata = {
|
|
3
|
-
PUT: { requireAuth: true }
|
|
4
|
-
};
|
|
5
|
-
const PUT = createSingleNotificationActionRoute("markAsRead");
|
|
6
|
-
const openApi = createSingleNotificationActionOpenApi(
|
|
7
|
-
"Mark notification as read",
|
|
8
|
-
"Notification marked as read"
|
|
9
|
-
);
|
|
10
|
-
export {
|
|
11
|
-
PUT,
|
|
12
|
-
metadata,
|
|
13
|
-
openApi
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/read/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from '../../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport const PUT = createSingleNotificationActionRoute('markAsRead')\n\nexport const openApi = createSingleNotificationActionOpenApi(\n 'Mark notification as read',\n 'Notification marked as read'\n)\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qCAAqC,6CAA6C;AAEpF,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEO,MAAM,MAAM,oCAAoC,YAAY;AAE5D,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { restoreNotificationSchema } from "../../../data/validators.js";
|
|
3
|
-
import { resolveNotificationContext } from "../../../lib/routeHelpers.js";
|
|
4
|
-
const metadata = {
|
|
5
|
-
PUT: { requireAuth: true }
|
|
6
|
-
};
|
|
7
|
-
async function PUT(req, { params }) {
|
|
8
|
-
const { id } = await params;
|
|
9
|
-
const { service, scope } = await resolveNotificationContext(req);
|
|
10
|
-
const body = await req.json().catch(() => ({}));
|
|
11
|
-
const input = restoreNotificationSchema.parse(body);
|
|
12
|
-
await service.restoreDismissed(id, input.status, scope);
|
|
13
|
-
return Response.json({ ok: true });
|
|
14
|
-
}
|
|
15
|
-
const openApi = {
|
|
16
|
-
PUT: {
|
|
17
|
-
summary: "Restore dismissed notification",
|
|
18
|
-
description: "Undo a dismissal and restore a notification to read or unread.",
|
|
19
|
-
tags: ["Notifications"],
|
|
20
|
-
parameters: [
|
|
21
|
-
{
|
|
22
|
-
name: "id",
|
|
23
|
-
in: "path",
|
|
24
|
-
required: true,
|
|
25
|
-
schema: { type: "string", format: "uuid" }
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
requestBody: {
|
|
29
|
-
required: false,
|
|
30
|
-
content: {
|
|
31
|
-
"application/json": {
|
|
32
|
-
schema: restoreNotificationSchema
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
responses: {
|
|
37
|
-
200: {
|
|
38
|
-
description: "Notification restored",
|
|
39
|
-
content: {
|
|
40
|
-
"application/json": {
|
|
41
|
-
schema: z.object({ ok: z.boolean() })
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
PUT,
|
|
50
|
-
metadata,
|
|
51
|
-
openApi
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=route.js.map
|