@contractspec/module.notifications 1.57.0 → 1.59.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/dist/browser/channels/index.js +124 -0
- package/dist/browser/contracts/index.js +340 -0
- package/dist/browser/entities/index.js +223 -0
- package/dist/browser/index.js +864 -0
- package/dist/browser/notifications.capability.js +16 -0
- package/dist/browser/notifications.feature.js +34 -0
- package/dist/browser/templates/index.js +147 -0
- package/dist/channels/index.d.ts +64 -67
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +123 -125
- package/dist/contracts/index.d.ts +571 -577
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +324 -416
- package/dist/entities/index.d.ts +145 -150
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +215 -245
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +864 -6
- package/dist/node/channels/index.js +124 -0
- package/dist/node/contracts/index.js +340 -0
- package/dist/node/entities/index.js +223 -0
- package/dist/node/index.js +864 -0
- package/dist/node/notifications.capability.js +16 -0
- package/dist/node/notifications.feature.js +34 -0
- package/dist/node/templates/index.js +147 -0
- package/dist/notifications.capability.d.ts +1 -6
- package/dist/notifications.capability.d.ts.map +1 -1
- package/dist/notifications.capability.js +17 -20
- package/dist/notifications.feature.d.ts +1 -6
- package/dist/notifications.feature.d.ts.map +1 -1
- package/dist/notifications.feature.js +33 -75
- package/dist/templates/index.d.ts +47 -50
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +127 -181
- package/package.json +102 -27
- package/dist/channels/index.js.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/notifications.capability.js.map +0 -1
- package/dist/notifications.feature.js.map +0 -1
- package/dist/templates/index.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/notifications.capability.ts
|
|
2
|
+
import { defineCapability, StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
var NotificationsCapability = defineCapability({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "notifications",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "ui",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "User notifications and alerts",
|
|
10
|
+
owners: ["@platform.messaging"],
|
|
11
|
+
tags: ["notifications", "messaging", "alerts"]
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
NotificationsCapability
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/notifications.feature.ts
|
|
2
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
3
|
+
var NotificationsFeature = defineFeature({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "notifications",
|
|
6
|
+
title: "Notifications",
|
|
7
|
+
description: "Multi-channel notification delivery with preference management",
|
|
8
|
+
domain: "platform",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
owners: ["@platform.notifications"],
|
|
11
|
+
tags: ["notifications", "email", "push", "in-app"],
|
|
12
|
+
stability: "stable"
|
|
13
|
+
},
|
|
14
|
+
operations: [
|
|
15
|
+
{ key: "notifications.send", version: "1.0.0" },
|
|
16
|
+
{ key: "notifications.markRead", version: "1.0.0" },
|
|
17
|
+
{ key: "notifications.markAllRead", version: "1.0.0" },
|
|
18
|
+
{ key: "notifications.delete", version: "1.0.0" },
|
|
19
|
+
{ key: "notifications.list", version: "1.0.0" },
|
|
20
|
+
{ key: "notifications.preferences.update", version: "1.0.0" },
|
|
21
|
+
{ key: "notifications.preferences.get", version: "1.0.0" }
|
|
22
|
+
],
|
|
23
|
+
events: [],
|
|
24
|
+
presentations: [],
|
|
25
|
+
opToPresentation: [],
|
|
26
|
+
presentationsTargets: [],
|
|
27
|
+
capabilities: {
|
|
28
|
+
provides: [{ key: "notifications", version: "1.0.0" }],
|
|
29
|
+
requires: [{ key: "identity", version: "1.0.0" }]
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
NotificationsFeature
|
|
34
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// src/templates/index.ts
|
|
2
|
+
function defineTemplate(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
5
|
+
function renderTemplate(content, variables) {
|
|
6
|
+
return content.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
|
7
|
+
const value = variables[key];
|
|
8
|
+
if (value === undefined || value === null) {
|
|
9
|
+
return match;
|
|
10
|
+
}
|
|
11
|
+
return String(value);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function renderNotificationTemplate(template, channel, variables) {
|
|
15
|
+
const channelContent = template.channels[channel];
|
|
16
|
+
if (!channelContent) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const title = channelContent.title ? renderTemplate(channelContent.title, variables) : template.name;
|
|
20
|
+
const body = renderTemplate(channelContent.body, variables);
|
|
21
|
+
const actionUrl = channelContent.actionUrl ? renderTemplate(channelContent.actionUrl, variables) : undefined;
|
|
22
|
+
const result = {
|
|
23
|
+
title,
|
|
24
|
+
body,
|
|
25
|
+
actionUrl
|
|
26
|
+
};
|
|
27
|
+
if (channel === "email" && channelContent.subject) {
|
|
28
|
+
result.email = {
|
|
29
|
+
subject: renderTemplate(channelContent.subject, variables),
|
|
30
|
+
html: body,
|
|
31
|
+
text: stripHtml(body)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function stripHtml(html) {
|
|
37
|
+
return html.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class TemplateRegistry {
|
|
41
|
+
templates = new Map;
|
|
42
|
+
register(template) {
|
|
43
|
+
this.templates.set(template.id, template);
|
|
44
|
+
}
|
|
45
|
+
get(templateId) {
|
|
46
|
+
return this.templates.get(templateId);
|
|
47
|
+
}
|
|
48
|
+
getAll() {
|
|
49
|
+
return Array.from(this.templates.values());
|
|
50
|
+
}
|
|
51
|
+
getByCategory(category) {
|
|
52
|
+
return this.getAll().filter((t) => t.category === category);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function createTemplateRegistry() {
|
|
56
|
+
return new TemplateRegistry;
|
|
57
|
+
}
|
|
58
|
+
var WelcomeTemplate = defineTemplate({
|
|
59
|
+
id: "welcome",
|
|
60
|
+
name: "Welcome",
|
|
61
|
+
description: "Sent when a user signs up.",
|
|
62
|
+
category: "onboarding",
|
|
63
|
+
variables: [
|
|
64
|
+
{ name: "name", type: "string", required: true },
|
|
65
|
+
{ name: "appName", type: "string", default: "ContractSpec" },
|
|
66
|
+
{ name: "actionUrl", type: "url" }
|
|
67
|
+
],
|
|
68
|
+
defaultChannels: ["EMAIL", "IN_APP"],
|
|
69
|
+
channels: {
|
|
70
|
+
email: {
|
|
71
|
+
subject: "Welcome to {{appName}}, {{name}}!",
|
|
72
|
+
body: `
|
|
73
|
+
<h1>Welcome, {{name}}!</h1>
|
|
74
|
+
<p>Thanks for joining {{appName}}. We're excited to have you on board.</p>
|
|
75
|
+
<p><a href="{{actionUrl}}">Get started now</a></p>
|
|
76
|
+
`
|
|
77
|
+
},
|
|
78
|
+
inApp: {
|
|
79
|
+
title: "Welcome to {{appName}}!",
|
|
80
|
+
body: "Thanks for joining. Click to complete your profile.",
|
|
81
|
+
actionUrl: "{{actionUrl}}"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var OrgInviteTemplate = defineTemplate({
|
|
86
|
+
id: "org-invite",
|
|
87
|
+
name: "Organization Invitation",
|
|
88
|
+
description: "Sent when a user is invited to an organization.",
|
|
89
|
+
category: "organization",
|
|
90
|
+
variables: [
|
|
91
|
+
{ name: "inviterName", type: "string", required: true },
|
|
92
|
+
{ name: "orgName", type: "string", required: true },
|
|
93
|
+
{ name: "role", type: "string", default: "member" },
|
|
94
|
+
{ name: "actionUrl", type: "url", required: true }
|
|
95
|
+
],
|
|
96
|
+
defaultChannels: ["EMAIL"],
|
|
97
|
+
channels: {
|
|
98
|
+
email: {
|
|
99
|
+
subject: "{{inviterName}} invited you to join {{orgName}}",
|
|
100
|
+
body: `
|
|
101
|
+
<h1>You've been invited!</h1>
|
|
102
|
+
<p>{{inviterName}} has invited you to join <strong>{{orgName}}</strong> as a {{role}}.</p>
|
|
103
|
+
<p><a href="{{actionUrl}}">Accept invitation</a></p>
|
|
104
|
+
`
|
|
105
|
+
},
|
|
106
|
+
inApp: {
|
|
107
|
+
title: "Invitation to {{orgName}}",
|
|
108
|
+
body: "{{inviterName}} invited you to join as {{role}}.",
|
|
109
|
+
actionUrl: "{{actionUrl}}",
|
|
110
|
+
actionText: "Accept"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var MentionTemplate = defineTemplate({
|
|
115
|
+
id: "mention",
|
|
116
|
+
name: "Mention",
|
|
117
|
+
description: "Sent when a user is mentioned.",
|
|
118
|
+
category: "social",
|
|
119
|
+
variables: [
|
|
120
|
+
{ name: "mentionerName", type: "string", required: true },
|
|
121
|
+
{ name: "context", type: "string", required: true },
|
|
122
|
+
{ name: "preview", type: "string" },
|
|
123
|
+
{ name: "actionUrl", type: "url", required: true }
|
|
124
|
+
],
|
|
125
|
+
defaultChannels: ["IN_APP", "PUSH"],
|
|
126
|
+
channels: {
|
|
127
|
+
inApp: {
|
|
128
|
+
title: "{{mentionerName}} mentioned you",
|
|
129
|
+
body: 'In {{context}}: "{{preview}}"',
|
|
130
|
+
actionUrl: "{{actionUrl}}"
|
|
131
|
+
},
|
|
132
|
+
push: {
|
|
133
|
+
title: "{{mentionerName}} mentioned you",
|
|
134
|
+
body: "{{preview}}"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
renderTemplate,
|
|
140
|
+
renderNotificationTemplate,
|
|
141
|
+
defineTemplate,
|
|
142
|
+
createTemplateRegistry,
|
|
143
|
+
WelcomeTemplate,
|
|
144
|
+
TemplateRegistry,
|
|
145
|
+
OrgInviteTemplate,
|
|
146
|
+
MentionTemplate
|
|
147
|
+
};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//#region src/notifications.capability.d.ts
|
|
4
|
-
declare const NotificationsCapability: _contractspec_lib_contracts0.CapabilitySpec;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { NotificationsCapability };
|
|
1
|
+
export declare const NotificationsCapability: import("@contractspec/lib.contracts").CapabilitySpec;
|
|
7
2
|
//# sourceMappingURL=notifications.capability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.capability.d.ts","
|
|
1
|
+
{"version":3,"file":"notifications.capability.d.ts","sourceRoot":"","sources":["../src/notifications.capability.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,sDAUlC,CAAC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { NotificationsCapability };
|
|
20
|
-
//# sourceMappingURL=notifications.capability.js.map
|
|
1
|
+
// @bun
|
|
2
|
+
// src/notifications.capability.ts
|
|
3
|
+
import { defineCapability, StabilityEnum } from "@contractspec/lib.contracts";
|
|
4
|
+
var NotificationsCapability = defineCapability({
|
|
5
|
+
meta: {
|
|
6
|
+
key: "notifications",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
kind: "ui",
|
|
9
|
+
stability: StabilityEnum.Experimental,
|
|
10
|
+
description: "User notifications and alerts",
|
|
11
|
+
owners: ["@platform.messaging"],
|
|
12
|
+
tags: ["notifications", "messaging", "alerts"]
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
NotificationsCapability
|
|
17
|
+
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
|
-
|
|
3
|
-
//#region src/notifications.feature.d.ts
|
|
4
1
|
/**
|
|
5
2
|
* Notifications feature module that bundles notification sending,
|
|
6
3
|
* listing, marking as read, and preference management capabilities.
|
|
7
4
|
*/
|
|
8
|
-
declare const NotificationsFeature:
|
|
9
|
-
//#endregion
|
|
10
|
-
export { NotificationsFeature };
|
|
5
|
+
export declare const NotificationsFeature: import("@contractspec/lib.contracts").FeatureModuleSpec;
|
|
11
6
|
//# sourceMappingURL=notifications.feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.feature.d.ts","
|
|
1
|
+
{"version":3,"file":"notifications.feature.d.ts","sourceRoot":"","sources":["../src/notifications.feature.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yDAqC/B,CAAC"}
|
|
@@ -1,77 +1,35 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/notifications.feature.ts
|
|
1
3
|
import { defineFeature } from "@contractspec/lib.contracts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
key: "notifications.send",
|
|
32
|
-
version: "1.0.0"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
key: "notifications.markRead",
|
|
36
|
-
version: "1.0.0"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: "notifications.markAllRead",
|
|
40
|
-
version: "1.0.0"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
key: "notifications.delete",
|
|
44
|
-
version: "1.0.0"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
key: "notifications.list",
|
|
48
|
-
version: "1.0.0"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: "notifications.preferences.update",
|
|
52
|
-
version: "1.0.0"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: "notifications.preferences.get",
|
|
56
|
-
version: "1.0.0"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
events: [],
|
|
60
|
-
presentations: [],
|
|
61
|
-
opToPresentation: [],
|
|
62
|
-
presentationsTargets: [],
|
|
63
|
-
capabilities: {
|
|
64
|
-
provides: [{
|
|
65
|
-
key: "notifications",
|
|
66
|
-
version: "1.0.0"
|
|
67
|
-
}],
|
|
68
|
-
requires: [{
|
|
69
|
-
key: "identity",
|
|
70
|
-
version: "1.0.0"
|
|
71
|
-
}]
|
|
72
|
-
}
|
|
4
|
+
var NotificationsFeature = defineFeature({
|
|
5
|
+
meta: {
|
|
6
|
+
key: "notifications",
|
|
7
|
+
title: "Notifications",
|
|
8
|
+
description: "Multi-channel notification delivery with preference management",
|
|
9
|
+
domain: "platform",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
owners: ["@platform.notifications"],
|
|
12
|
+
tags: ["notifications", "email", "push", "in-app"],
|
|
13
|
+
stability: "stable"
|
|
14
|
+
},
|
|
15
|
+
operations: [
|
|
16
|
+
{ key: "notifications.send", version: "1.0.0" },
|
|
17
|
+
{ key: "notifications.markRead", version: "1.0.0" },
|
|
18
|
+
{ key: "notifications.markAllRead", version: "1.0.0" },
|
|
19
|
+
{ key: "notifications.delete", version: "1.0.0" },
|
|
20
|
+
{ key: "notifications.list", version: "1.0.0" },
|
|
21
|
+
{ key: "notifications.preferences.update", version: "1.0.0" },
|
|
22
|
+
{ key: "notifications.preferences.get", version: "1.0.0" }
|
|
23
|
+
],
|
|
24
|
+
events: [],
|
|
25
|
+
presentations: [],
|
|
26
|
+
opToPresentation: [],
|
|
27
|
+
presentationsTargets: [],
|
|
28
|
+
capabilities: {
|
|
29
|
+
provides: [{ key: "notifications", version: "1.0.0" }],
|
|
30
|
+
requires: [{ key: "identity", version: "1.0.0" }]
|
|
31
|
+
}
|
|
73
32
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=notifications.feature.js.map
|
|
33
|
+
export {
|
|
34
|
+
NotificationsFeature
|
|
35
|
+
};
|
|
@@ -1,92 +1,89 @@
|
|
|
1
|
-
//#region src/templates/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Template variable definition.
|
|
4
3
|
*/
|
|
5
|
-
interface TemplateVariable {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export interface TemplateVariable {
|
|
5
|
+
name: string;
|
|
6
|
+
type: 'string' | 'number' | 'boolean' | 'date' | 'url';
|
|
7
|
+
required?: boolean;
|
|
8
|
+
default?: string | number | boolean;
|
|
9
|
+
description?: string;
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* Channel-specific template content.
|
|
14
13
|
*/
|
|
15
|
-
interface ChannelTemplateContent {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
export interface ChannelTemplateContent {
|
|
15
|
+
title?: string;
|
|
16
|
+
subject?: string;
|
|
17
|
+
body: string;
|
|
18
|
+
actionUrl?: string;
|
|
19
|
+
actionText?: string;
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Notification template definition.
|
|
24
23
|
*/
|
|
25
|
-
interface NotificationTemplateDefinition {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
export interface NotificationTemplateDefinition {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
category?: string;
|
|
29
|
+
variables?: TemplateVariable[];
|
|
30
|
+
defaultChannels?: string[];
|
|
31
|
+
channels: {
|
|
32
|
+
email?: ChannelTemplateContent;
|
|
33
|
+
inApp?: ChannelTemplateContent;
|
|
34
|
+
push?: ChannelTemplateContent;
|
|
35
|
+
webhook?: ChannelTemplateContent;
|
|
36
|
+
};
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Rendered notification content.
|
|
41
40
|
*/
|
|
42
|
-
interface RenderedNotification {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
export interface RenderedNotification {
|
|
42
|
+
title: string;
|
|
43
|
+
body: string;
|
|
44
|
+
actionUrl?: string;
|
|
45
|
+
email?: {
|
|
46
|
+
subject: string;
|
|
47
|
+
html: string;
|
|
48
|
+
text: string;
|
|
49
|
+
};
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
52
|
* Define a notification template.
|
|
54
53
|
*/
|
|
55
|
-
declare function defineTemplate(def: NotificationTemplateDefinition): NotificationTemplateDefinition;
|
|
54
|
+
export declare function defineTemplate(def: NotificationTemplateDefinition): NotificationTemplateDefinition;
|
|
56
55
|
/**
|
|
57
56
|
* Render a template with variables.
|
|
58
57
|
*/
|
|
59
|
-
declare function renderTemplate(content: string, variables: Record<string, unknown>): string;
|
|
58
|
+
export declare function renderTemplate(content: string, variables: Record<string, unknown>): string;
|
|
60
59
|
/**
|
|
61
60
|
* Render a notification template for a specific channel.
|
|
62
61
|
*/
|
|
63
|
-
declare function renderNotificationTemplate(template: NotificationTemplateDefinition, channel: keyof NotificationTemplateDefinition['channels'], variables: Record<string, unknown>): RenderedNotification | null;
|
|
62
|
+
export declare function renderNotificationTemplate(template: NotificationTemplateDefinition, channel: keyof NotificationTemplateDefinition['channels'], variables: Record<string, unknown>): RenderedNotification | null;
|
|
64
63
|
/**
|
|
65
64
|
* Template registry for managing templates.
|
|
66
65
|
*/
|
|
67
|
-
declare class TemplateRegistry {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
export declare class TemplateRegistry {
|
|
67
|
+
private templates;
|
|
68
|
+
register(template: NotificationTemplateDefinition): void;
|
|
69
|
+
get(templateId: string): NotificationTemplateDefinition | undefined;
|
|
70
|
+
getAll(): NotificationTemplateDefinition[];
|
|
71
|
+
getByCategory(category: string): NotificationTemplateDefinition[];
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
* Create a template registry.
|
|
76
75
|
*/
|
|
77
|
-
declare function createTemplateRegistry(): TemplateRegistry;
|
|
76
|
+
export declare function createTemplateRegistry(): TemplateRegistry;
|
|
78
77
|
/**
|
|
79
78
|
* Welcome email template.
|
|
80
79
|
*/
|
|
81
|
-
declare const WelcomeTemplate: NotificationTemplateDefinition;
|
|
80
|
+
export declare const WelcomeTemplate: NotificationTemplateDefinition;
|
|
82
81
|
/**
|
|
83
82
|
* Organization invite template.
|
|
84
83
|
*/
|
|
85
|
-
declare const OrgInviteTemplate: NotificationTemplateDefinition;
|
|
84
|
+
export declare const OrgInviteTemplate: NotificationTemplateDefinition;
|
|
86
85
|
/**
|
|
87
86
|
* Mention template.
|
|
88
87
|
*/
|
|
89
|
-
declare const MentionTemplate: NotificationTemplateDefinition;
|
|
90
|
-
//#endregion
|
|
91
|
-
export { ChannelTemplateContent, MentionTemplate, NotificationTemplateDefinition, OrgInviteTemplate, RenderedNotification, TemplateRegistry, TemplateVariable, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate };
|
|
88
|
+
export declare const MentionTemplate: NotificationTemplateDefinition;
|
|
92
89
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE;QACR,KAAK,CAAC,EAAE,sBAAsB,CAAC;QAC/B,KAAK,CAAC,EAAE,sBAAsB,CAAC;QAC/B,IAAI,CAAC,EAAE,sBAAsB,CAAC;QAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAC;KAClC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,8BAA8B,GAClC,8BAA8B,CAEhC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,8BAA8B,EACxC,OAAO,EAAE,MAAM,8BAA8B,CAAC,UAAU,CAAC,EACzD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,oBAAoB,GAAG,IAAI,CAgC7B;AAYD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAqD;IAEtE,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,GAAG,IAAI;IAIxD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,8BAA8B,GAAG,SAAS;IAInE,MAAM,IAAI,8BAA8B,EAAE;IAI1C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,8BAA8B,EAAE;CAGlE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD;AAID;;GAEG;AACH,eAAO,MAAM,eAAe,gCA0B1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,gCA4B5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,gCAuB1B,CAAC"}
|