@open-mercato/shared 0.9.1-develop.7542.1.61a5e7dcbb → 0.9.1-develop.7543.1.4d3d24cb1e
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/lib/version.js
CHANGED
package/dist/lib/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/version.ts"],
|
|
4
|
-
"sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.9.1-develop.
|
|
4
|
+
"sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.9.1-develop.7543.1.4d3d24cb1e';\nexport const appVersion = APP_VERSION;\n"],
|
|
5
5
|
"mappings": "AACO,MAAM,cAAc;AACpB,MAAM,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
3
|
+
"sources": ["../../../src/modules/notifications/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ComponentType } from 'react'\n\nexport type NotificationStatus = 'unread' | 'read' | 'actioned' | 'dismissed'\nexport type NotificationSeverity = 'info' | 'warning' | 'success' | 'error'\n\n/**\n * `code` of the 409 body `POST /api/notifications/:id/action` answers with when the notification's\n * action has already been executed. Lets a client tell that refusal apart from a 409 raised by\n * the action's own command.\n */\nexport const NOTIFICATION_ACTION_ALREADY_EXECUTED_ERROR_CODE = 'notification_action_already_executed'\n\nexport type NotificationAction = {\n id: string\n label: string\n labelKey?: string\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost'\n icon?: string\n commandId?: string\n href?: string\n confirmRequired?: boolean\n confirmMessage?: string\n}\n\nexport type NotificationActionData = {\n actions: NotificationAction[]\n primaryActionId?: string\n}\n\nexport type NotificationTypeAction = {\n id: string\n labelKey: string\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost'\n icon?: string\n commandId?: string\n href?: string\n confirmRequired?: boolean\n confirmMessageKey?: string\n}\n\nexport type NotificationRendererProps = {\n notification: {\n id: string\n type: string\n title: string\n body?: string | null\n titleKey?: string | null\n bodyKey?: string | null\n titleVariables?: Record<string, string> | null\n bodyVariables?: Record<string, string> | null\n icon?: string | null\n severity: string\n status: string\n sourceModule?: string | null\n sourceEntityType?: string | null\n sourceEntityId?: string | null\n linkHref?: string | null\n createdAt: string\n }\n onAction: (actionId: string) => Promise<void>\n onDismiss: () => Promise<void>\n actions: NotificationTypeAction[]\n}\n\nexport type NotificationTypeDefinition = {\n type: string\n module: string\n titleKey: string\n bodyKey?: string\n icon: string\n severity: NotificationSeverity\n actions: NotificationTypeAction[]\n primaryActionId?: string\n linkHref?: string\n Renderer?: ComponentType<NotificationRendererProps>\n expiresAfterHours?: number\n /**\n * Optional i18n key for the short type name shown in a per-channel\n * preferences UI (e.g. \"Order created\"). Distinct from `titleKey`, which is\n * the per-instance message title. Falls back to `titleKey` when omitted.\n */\n labelKey?: string\n /** Optional i18n key for helper text shown beside the type in a preferences UI. */\n descriptionKey?: string\n /**\n * Optional free-form grouping label (e.g. `security`, `orders`, `marketing`) so a\n * client \u2014 typically a mobile app \u2014 can list/group notification types under a heading.\n * Plain string, not an enum; mirrored to the `notification_types` table and returned by\n * `GET /api/notifications/types`.\n *\n * Defaults to the prefix before the first dot in `type` (`sales.order.created` \u2192\n * `sales`), resolved once during `syncNotificationTypes`. Declare it only to override\n * that default. Localize the heading by adding `notifications.categories.<key>` to YOUR\n * OWN module's `i18n/*.json` \u2014 the `notifications` module deliberately ships no category\n * labels and knows nothing about which categories exist. `GET /api/notifications/types`\n * resolves the key into `categoryLabel`, falling back to the raw key when absent.\n *\n * Clients group on `category` (stable across locales) and display `categoryLabel`.\n */\n category?: string\n /**\n * When `true`, this type's push is delivered as a silent / content-available (data-only)\n * wake-up instead of a visible alert. `silent` selects the delivery STYLE only \u2014 the\n * notification still flows through the normal `notificationService.create()` path (in-app\n * row created, per-channel preferences respected unless the type is `nonOptOut`).\n */\n silent?: boolean\n /**\n * When `true`, the recipient cannot opt out of this type: delivery ignores any\n * stored per-channel preference (security/account alerts that must always be\n * delivered). A preferences UI should render it as locked/forced-on, and\n * `setPreferences` refuses to store an opt-out row for it.\n */\n nonOptOut?: boolean\n /**\n * When `true`, this type is hidden from the client-facing catalogue: it is NOT mirrored to the\n * `notification_types` table and therefore not returned by `GET /api/notifications/types`, so a\n * mobile app's preferences screen never lists it. Used for internal/admin-only types (e.g. one-off\n * admin custom pushes) that are dispatched by the server, not toggled by users. The type still\n * lives in the in-memory registry for delivery logic (`getNotificationType`).\n */\n hiddenFromSettings?: boolean\n /**\n * Optional per-type channel eligibility: the delivery channels this type may EVER use\n * (e.g. a marketing type restricted to `['push']` so it never lands in the in-app bell).\n * The dispatcher intersects it with the per-send target, the registered strategies, and the\n * recipient's preferences via `shouldDeliver`. Omit to make the type eligible for every\n * registered channel (pre-Phase-7 behavior).\n *\n * Operators can override this set per tenant via the `notification_type_overrides` table\n * (`PATCH /api/notifications/types` / the Notification Delivery settings page): a stored\n * array replaces the code-declared one, an absent row (or `NULL`) inherits it. A channel\n * outside the effective set never delivers for the type in that tenant \u2014 the check runs\n * before both the `nonOptOut` bypass and user preferences, and the preference UIs render\n * that cell locked off.\n */\n channels?: string[]\n}\n\n/**\n * A delivery channel in the module-registered channel catalogue. Any module can contribute channels\n * by exporting `notificationChannels: NotificationChannelDefinition[]` from a `notification-channels.ts`\n * file (generator-discovered), so a preferences UI and the `/api/notifications/channels` endpoint stay\n * in sync with the actual delivery paths without a hardcoded list. `id` matches the delivery-strategy id\n * (`in_app`, `email`, `push`, \u2026) \u2014 treat it as a FROZEN contract once shipped.\n */\nexport type NotificationChannelDefinition = {\n id: string\n /** i18n key for the channel's display name in a preferences UI. */\n labelKey: string\n /** Optional i18n key for helper text shown beside the channel. */\n descriptionKey?: string\n /** Ascending display order; entries without an order sort after ordered ones, then by id. */\n order?: number\n}\n\nexport type NotificationDto = {\n id: string\n type: string\n title: string\n body?: string | null\n titleKey?: string | null\n bodyKey?: string | null\n titleVariables?: Record<string, string> | null\n bodyVariables?: Record<string, string> | null\n icon?: string | null\n severity: string\n status: string\n actions: Array<{\n id: string\n label: string\n labelKey?: string\n variant?: string\n icon?: string\n href?: string\n }>\n primaryActionId?: string\n sourceModule?: string | null\n sourceEntityType?: string | null\n sourceEntityId?: string | null\n linkHref?: string | null\n /** Arbitrary app-readable key/values attached at create time (also delivered with the push). */\n data?: Record<string, string> | null\n /** Resolved delivery channels for this notification. `null` = all channels (legacy/untargeted). */\n channels?: string[] | null\n createdAt: string\n readAt?: string | null\n actionTaken?: string | null\n}\n\nexport type NotificationPollData = {\n unreadCount: number\n recent: NotificationDto[]\n hasNew: boolean\n lastId?: string\n}\n"],
|
|
5
|
+
"mappings": "AAUO,MAAM,kDAAkD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/shared",
|
|
3
|
-
"version": "0.9.1-develop.
|
|
3
|
+
"version": "0.9.1-develop.7543.1.4d3d24cb1e",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@mikro-orm/core": "^7.1.14",
|
|
122
122
|
"@mikro-orm/decorators": "^7.1.14",
|
|
123
123
|
"@mikro-orm/postgresql": "^7.1.14",
|
|
124
|
-
"@open-mercato/cache": "0.9.1-develop.
|
|
124
|
+
"@open-mercato/cache": "0.9.1-develop.7543.1.4d3d24cb1e",
|
|
125
125
|
"@types/html-to-text": "^9.0.4",
|
|
126
126
|
"@types/sanitize-html": "^2.16.1",
|
|
127
127
|
"dotenv": "^17.4.2",
|
|
@@ -3,6 +3,13 @@ import type { ComponentType } from 'react'
|
|
|
3
3
|
export type NotificationStatus = 'unread' | 'read' | 'actioned' | 'dismissed'
|
|
4
4
|
export type NotificationSeverity = 'info' | 'warning' | 'success' | 'error'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* `code` of the 409 body `POST /api/notifications/:id/action` answers with when the notification's
|
|
8
|
+
* action has already been executed. Lets a client tell that refusal apart from a 409 raised by
|
|
9
|
+
* the action's own command.
|
|
10
|
+
*/
|
|
11
|
+
export const NOTIFICATION_ACTION_ALREADY_EXECUTED_ERROR_CODE = 'notification_action_already_executed'
|
|
12
|
+
|
|
6
13
|
export type NotificationAction = {
|
|
7
14
|
id: string
|
|
8
15
|
label: string
|