@tolinax/ayoune-interfaces 2026.46.0 → 2026.48.0
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/interfaces/INotification.d.ts +62 -0
- package/interfaces/INotificationAction.d.ts +45 -0
- package/interfaces/INotificationAction.js +2 -0
- package/interfaces/INotificationAttachment.d.ts +157 -0
- package/interfaces/INotificationAttachment.js +25 -0
- package/interfaces/index.d.ts +2 -0
- package/interfaces/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
import { INotificationAction } from "./INotificationAction";
|
|
3
|
+
import { INotificationAttachment, INotificationSender } from "./INotificationAttachment";
|
|
2
4
|
export interface INotification extends IDefaultFields {
|
|
3
5
|
_customerID: ObjectId;
|
|
4
6
|
_clientID?: ObjectId[];
|
|
@@ -14,4 +16,64 @@ export interface INotification extends IDefaultFields {
|
|
|
14
16
|
obj?: string;
|
|
15
17
|
view?: string;
|
|
16
18
|
params?: object;
|
|
19
|
+
/**
|
|
20
|
+
* Who triggered the notification. Optional — system events pass `null`
|
|
21
|
+
* and the consumer falls back to a generic `aYOUne` header.
|
|
22
|
+
*/
|
|
23
|
+
sender?: INotificationSender;
|
|
24
|
+
/**
|
|
25
|
+
* Typed rich-content attachments — calendar entries, tasks, invoices,
|
|
26
|
+
* orders, etc. — rendered as inline preview cards in the notifications
|
|
27
|
+
* panel. See `INotificationAttachment` for the supported types and
|
|
28
|
+
* the enrichment contract (producer may provide `{ type, _id }` and the
|
|
29
|
+
* orchestrator fills `preview` via model lookup).
|
|
30
|
+
*/
|
|
31
|
+
attachments?: INotificationAttachment[];
|
|
32
|
+
/**
|
|
33
|
+
* Action buttons rendered under the notification (1-3 typical), and —
|
|
34
|
+
* where the OS supports it — as native Web-Push action buttons (first
|
|
35
|
+
* three on modern Android Chrome / Edge / Samsung Internet).
|
|
36
|
+
*/
|
|
37
|
+
actions?: INotificationAction[];
|
|
38
|
+
/**
|
|
39
|
+
* Hero image shown in the expanded native push notification (Android).
|
|
40
|
+
* Rendered as a 16:9 banner above the body. Great for order thumbnails,
|
|
41
|
+
* product photos, meeting cover images, customer logos, illustrative
|
|
42
|
+
* GIFs (animated GIFs render as stills on most push stacks — keep
|
|
43
|
+
* static / use first-frame if animated).
|
|
44
|
+
*
|
|
45
|
+
* When absent, the adapter falls back to the first `attachments[*].preview.image`
|
|
46
|
+
* so entity-bearing notifications automatically get a thumbnail.
|
|
47
|
+
*/
|
|
48
|
+
image?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Monochrome status-bar badge (Android). 24x24 SVG or PNG. Customer-
|
|
51
|
+
* branding goes here — renders as the tiny icon next to the clock.
|
|
52
|
+
* Falls back to the platform-default badge when absent.
|
|
53
|
+
*/
|
|
54
|
+
badge?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Grouping / dedupe key. Two notifications with the same `tag` replace
|
|
57
|
+
* each other on the device instead of stacking. Used for live-update
|
|
58
|
+
* flows (order status, approval decisions, running job progress) where
|
|
59
|
+
* only the latest state should be visible.
|
|
60
|
+
*
|
|
61
|
+
* When absent, the adapter auto-derives `${entityType}:${entity._id || Date.now()}`
|
|
62
|
+
* so repeated notifications about the same entity naturally group.
|
|
63
|
+
*/
|
|
64
|
+
tag?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Re-alert (sound + vibration) when a notification with the same `tag`
|
|
67
|
+
* arrives. Default true — users expect "your order is now OUT FOR
|
|
68
|
+
* DELIVERY" to buzz even if the previous "being prepared" is still on
|
|
69
|
+
* screen. Set false for silent status updates (progress bars, typing
|
|
70
|
+
* indicators).
|
|
71
|
+
*/
|
|
72
|
+
renotify?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Keep the notification on screen until the user explicitly dismisses
|
|
75
|
+
* it (Android > 7). Use for approval requests, critical alerts, or
|
|
76
|
+
* anything that must not scroll out of awareness. Default false.
|
|
77
|
+
*/
|
|
78
|
+
requireInteraction?: boolean;
|
|
17
79
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action buttons attached to a notification. Rendered both as inline buttons
|
|
3
|
+
* in the in-app notifications panel and (up to two primary actions) as native
|
|
4
|
+
* Web-Push action buttons on supporting platforms.
|
|
5
|
+
*
|
|
6
|
+
* Four dispatch modes:
|
|
7
|
+
* - `link` — internal router navigation (`href` relative to the app)
|
|
8
|
+
* - `api` — `fetch()` call to an absolute endpoint, optionally with
|
|
9
|
+
* a confirm prompt; the service-worker can execute this
|
|
10
|
+
* without the PWA being open (Bearer-token attached).
|
|
11
|
+
* - `reply` — native browser reply text field (if supported) OR a
|
|
12
|
+
* dialog in the PWA; the text is POSTed to `endpoint`.
|
|
13
|
+
* - `ai-copilot` — opens the Comm-Sidebar Copilot panel with
|
|
14
|
+
* `copilotContext` pre-populated as the first user message.
|
|
15
|
+
*/
|
|
16
|
+
export type NotificationActionType = "link" | "api" | "reply" | "ai-copilot";
|
|
17
|
+
/** Visual weight of the action button. */
|
|
18
|
+
export type NotificationActionStyle = "primary" | "secondary" | "danger";
|
|
19
|
+
export interface INotificationAction {
|
|
20
|
+
/** Stable identifier per notification — used as the Web-Push `action` id. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Button label. May be a literal or an i18n key. */
|
|
23
|
+
label: string;
|
|
24
|
+
type: NotificationActionType;
|
|
25
|
+
style?: NotificationActionStyle;
|
|
26
|
+
/** Material icon name rendered before the label. */
|
|
27
|
+
icon?: string;
|
|
28
|
+
/** For `type: "link"` — absolute or app-relative route. */
|
|
29
|
+
href?: string;
|
|
30
|
+
/** For `type: "api"` or `type: "reply"` — absolute endpoint (service-worker
|
|
31
|
+
* executable). POST is the default for mutation-ish actions. */
|
|
32
|
+
endpoint?: string;
|
|
33
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
34
|
+
/** Static payload merged with dynamic input (reply text, notification id). */
|
|
35
|
+
body?: Record<string, unknown>;
|
|
36
|
+
/** Confirmation prompt before firing (useful for destructive actions). */
|
|
37
|
+
confirmLabel?: string;
|
|
38
|
+
/** For `type: "ai-copilot"` — the prompt pre-populated into the Copilot
|
|
39
|
+
* panel when the user taps this action. Supports `{{variable}}` tokens
|
|
40
|
+
* that are rendered against the notification's `data` context before
|
|
41
|
+
* being inserted into the input. */
|
|
42
|
+
copilotContext?: string;
|
|
43
|
+
/** Should this action close/dismiss the notification after firing? */
|
|
44
|
+
dismissOnComplete?: boolean;
|
|
45
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured rich-content attachments for notifications (and — in phase 4 —
|
|
3
|
+
* chat messages). Mirrors the legacy AngularJS attachment system documented
|
|
4
|
+
* in `archive/legacy-angular1/pug/chatsidebar.pug:248-334`, where chat
|
|
5
|
+
* messages carried typed entity references (`type` + `content` + `preview`)
|
|
6
|
+
* that the renderer switched over to display inline entity cards.
|
|
7
|
+
*
|
|
8
|
+
* Producer contract:
|
|
9
|
+
* 1. The caller of `POST /notifications/send` may provide either:
|
|
10
|
+
* - a bare reference: `{ type, _id }` — the orchestrator enriches it by
|
|
11
|
+
* looking up the entity and projecting the relevant fields into
|
|
12
|
+
* `preview`, OR
|
|
13
|
+
* - a fully-formed attachment with `preview` already populated — skips
|
|
14
|
+
* the lookup (use when the caller already has the data loaded).
|
|
15
|
+
* 2. Consumers (comm-sidebar notifications-panel, mobile-app PWA) dispatch
|
|
16
|
+
* on `type` and render a type-specific preview component, falling back
|
|
17
|
+
* to a generic card for unknown types.
|
|
18
|
+
*
|
|
19
|
+
* Phase 1 ships 5 core types. Subsequent phases add the remaining 12+
|
|
20
|
+
* types from the legacy chat system (document, consumer, contract,
|
|
21
|
+
* shipping, productionorder, creditnote, internalorder, offer, assignment,
|
|
22
|
+
* question, snippet, media).
|
|
23
|
+
*/
|
|
24
|
+
export type NotificationAttachmentType = "calendarentry" | "task" | "invoice" | "permissionrequest" | "supplierorder";
|
|
25
|
+
/** Shared shape — all previews carry an optional deep-link override and
|
|
26
|
+
* an optional thumbnail image. The image is used both by the in-app
|
|
27
|
+
* preview card (rendered as a left-aligned thumbnail beside the metadata)
|
|
28
|
+
* and by the native push adapter (the first attachment with an image
|
|
29
|
+
* becomes the notification's hero banner on Android). */
|
|
30
|
+
interface INotificationAttachmentBase {
|
|
31
|
+
/** Reference to the source entity (the document `_id`). Required for
|
|
32
|
+
* enrichment and deep-linking. */
|
|
33
|
+
_id: ObjectId;
|
|
34
|
+
/** Optional router path used when the user taps the preview card.
|
|
35
|
+
* When absent, the consumer falls back to `/{type}/{_id}`. */
|
|
36
|
+
href?: string;
|
|
37
|
+
/** Optional image URL — product thumbnail, supplier logo, meeting
|
|
38
|
+
* cover, customer branding. Absolute URL (served from media CDN or
|
|
39
|
+
* customer-meta). */
|
|
40
|
+
image?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ICalendarEntryPreview extends INotificationAttachmentBase {
|
|
43
|
+
summary?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
start?: Date | string;
|
|
46
|
+
end?: Date | string;
|
|
47
|
+
typ?: string;
|
|
48
|
+
status?: string;
|
|
49
|
+
location?: string;
|
|
50
|
+
allDay?: boolean;
|
|
51
|
+
organizer?: {
|
|
52
|
+
_id?: ObjectId;
|
|
53
|
+
name?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
};
|
|
56
|
+
attendees?: Array<{
|
|
57
|
+
_id?: ObjectId;
|
|
58
|
+
name?: string;
|
|
59
|
+
email?: string;
|
|
60
|
+
rsvp?: "accepted" | "declined" | "tentative" | "pending";
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export interface ITaskPreview extends INotificationAttachmentBase {
|
|
64
|
+
title?: string;
|
|
65
|
+
ticketIdentifier?: string;
|
|
66
|
+
status?: string;
|
|
67
|
+
priority?: string;
|
|
68
|
+
type?: string;
|
|
69
|
+
due?: Date | string;
|
|
70
|
+
assignee?: {
|
|
71
|
+
_id?: ObjectId;
|
|
72
|
+
name?: string;
|
|
73
|
+
avatar?: string;
|
|
74
|
+
};
|
|
75
|
+
project?: {
|
|
76
|
+
_id?: ObjectId;
|
|
77
|
+
name?: string;
|
|
78
|
+
};
|
|
79
|
+
points?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface IInvoicePreview extends INotificationAttachmentBase {
|
|
82
|
+
nbr?: number;
|
|
83
|
+
referenceNumber?: string;
|
|
84
|
+
title?: string;
|
|
85
|
+
total?: number;
|
|
86
|
+
currency?: string;
|
|
87
|
+
dueDate?: Date | string;
|
|
88
|
+
paid?: boolean;
|
|
89
|
+
status?: string;
|
|
90
|
+
receiver?: {
|
|
91
|
+
_id?: ObjectId;
|
|
92
|
+
name?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export interface IPermissionRequestPreview extends INotificationAttachmentBase {
|
|
96
|
+
reason?: string;
|
|
97
|
+
permissionName?: string;
|
|
98
|
+
askedOn?: Date | string;
|
|
99
|
+
fromUser?: {
|
|
100
|
+
_id?: ObjectId;
|
|
101
|
+
name?: string;
|
|
102
|
+
avatar?: string;
|
|
103
|
+
};
|
|
104
|
+
valid_from?: Date | string;
|
|
105
|
+
valid_till?: Date | string;
|
|
106
|
+
approved?: boolean;
|
|
107
|
+
declined?: boolean;
|
|
108
|
+
temporary?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ISupplierOrderPreview extends INotificationAttachmentBase {
|
|
111
|
+
nbr?: string | number;
|
|
112
|
+
shopOrderNbr?: string;
|
|
113
|
+
title?: string;
|
|
114
|
+
total?: number;
|
|
115
|
+
currency?: string;
|
|
116
|
+
confirmed?: boolean;
|
|
117
|
+
needsInternalApproval?: string;
|
|
118
|
+
internalApproved?: boolean;
|
|
119
|
+
internalDeclined?: boolean;
|
|
120
|
+
supplier?: {
|
|
121
|
+
_id?: ObjectId;
|
|
122
|
+
name?: string;
|
|
123
|
+
};
|
|
124
|
+
expectedDelivery?: Date | string;
|
|
125
|
+
}
|
|
126
|
+
export type INotificationAttachment = {
|
|
127
|
+
type: "calendarentry";
|
|
128
|
+
preview: ICalendarEntryPreview;
|
|
129
|
+
} | {
|
|
130
|
+
type: "task";
|
|
131
|
+
preview: ITaskPreview;
|
|
132
|
+
} | {
|
|
133
|
+
type: "invoice";
|
|
134
|
+
preview: IInvoicePreview;
|
|
135
|
+
} | {
|
|
136
|
+
type: "permissionrequest";
|
|
137
|
+
preview: IPermissionRequestPreview;
|
|
138
|
+
} | {
|
|
139
|
+
type: "supplierorder";
|
|
140
|
+
preview: ISupplierOrderPreview;
|
|
141
|
+
};
|
|
142
|
+
/** Producer-side shape — accepts either a bare reference (orchestrator will
|
|
143
|
+
* enrich) or a fully-populated attachment. */
|
|
144
|
+
export type INotificationAttachmentInput = {
|
|
145
|
+
type: NotificationAttachmentType;
|
|
146
|
+
_id: ObjectId;
|
|
147
|
+
} | INotificationAttachment;
|
|
148
|
+
/** Sender metadata carried on the notification document so the in-app panel
|
|
149
|
+
* can show "Alice assigned you a task" with the avatar of the triggering
|
|
150
|
+
* actor rather than a faceless system row. */
|
|
151
|
+
export interface INotificationSender {
|
|
152
|
+
_userId?: ObjectId;
|
|
153
|
+
name?: string;
|
|
154
|
+
avatar?: string;
|
|
155
|
+
email?: string;
|
|
156
|
+
}
|
|
157
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Structured rich-content attachments for notifications (and — in phase 4 —
|
|
4
|
+
* chat messages). Mirrors the legacy AngularJS attachment system documented
|
|
5
|
+
* in `archive/legacy-angular1/pug/chatsidebar.pug:248-334`, where chat
|
|
6
|
+
* messages carried typed entity references (`type` + `content` + `preview`)
|
|
7
|
+
* that the renderer switched over to display inline entity cards.
|
|
8
|
+
*
|
|
9
|
+
* Producer contract:
|
|
10
|
+
* 1. The caller of `POST /notifications/send` may provide either:
|
|
11
|
+
* - a bare reference: `{ type, _id }` — the orchestrator enriches it by
|
|
12
|
+
* looking up the entity and projecting the relevant fields into
|
|
13
|
+
* `preview`, OR
|
|
14
|
+
* - a fully-formed attachment with `preview` already populated — skips
|
|
15
|
+
* the lookup (use when the caller already has the data loaded).
|
|
16
|
+
* 2. Consumers (comm-sidebar notifications-panel, mobile-app PWA) dispatch
|
|
17
|
+
* on `type` and render a type-specific preview component, falling back
|
|
18
|
+
* to a generic card for unknown types.
|
|
19
|
+
*
|
|
20
|
+
* Phase 1 ships 5 core types. Subsequent phases add the remaining 12+
|
|
21
|
+
* types from the legacy chat system (document, consumer, contract,
|
|
22
|
+
* shipping, productionorder, creditnote, internalorder, offer, assignment,
|
|
23
|
+
* question, snippet, media).
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/interfaces/index.d.ts
CHANGED
|
@@ -462,6 +462,8 @@ export * from "./INewsletterType";
|
|
|
462
462
|
export * from "./INewsSource";
|
|
463
463
|
export * from "./INormalizedSerp";
|
|
464
464
|
export * from "./INotification";
|
|
465
|
+
export * from "./INotificationAction";
|
|
466
|
+
export * from "./INotificationAttachment";
|
|
465
467
|
export * from "./INotificationPolicy";
|
|
466
468
|
export * from "./INotificationPreference";
|
|
467
469
|
export * from "./IOffer";
|
package/interfaces/index.js
CHANGED
|
@@ -478,6 +478,8 @@ __exportStar(require("./INewsletterType"), exports);
|
|
|
478
478
|
__exportStar(require("./INewsSource"), exports);
|
|
479
479
|
__exportStar(require("./INormalizedSerp"), exports);
|
|
480
480
|
__exportStar(require("./INotification"), exports);
|
|
481
|
+
__exportStar(require("./INotificationAction"), exports);
|
|
482
|
+
__exportStar(require("./INotificationAttachment"), exports);
|
|
481
483
|
__exportStar(require("./INotificationPolicy"), exports);
|
|
482
484
|
__exportStar(require("./INotificationPreference"), exports);
|
|
483
485
|
__exportStar(require("./IOffer"), exports);
|