@webiny/notifications-integrations 0.0.0-unstable.0156a4c312
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/LICENSE +21 -0
- package/NotificationsIntegrations.d.ts +2 -0
- package/NotificationsIntegrations.js +8 -0
- package/NotificationsIntegrations.js.map +1 -0
- package/README.md +11 -0
- package/api/Extension.d.ts +4 -0
- package/api/Extension.js +13 -0
- package/api/Extension.js.map +1 -0
- package/api/collaboration/ReplyAddedNotificationHandler.d.ts +11 -0
- package/api/collaboration/ReplyAddedNotificationHandler.js +53 -0
- package/api/collaboration/ReplyAddedNotificationHandler.js.map +1 -0
- package/api/collaboration/ThreadCreatedNotificationHandler.d.ts +11 -0
- package/api/collaboration/ThreadCreatedNotificationHandler.js +39 -0
- package/api/collaboration/ThreadCreatedNotificationHandler.js.map +1 -0
- package/api/collaboration/feature.d.ts +4 -0
- package/api/collaboration/feature.js +13 -0
- package/api/collaboration/feature.js.map +1 -0
- package/api/workflows/WorkflowApprovedNotificationHandler.d.ts +13 -0
- package/api/workflows/WorkflowApprovedNotificationHandler.js +40 -0
- package/api/workflows/WorkflowApprovedNotificationHandler.js.map +1 -0
- package/api/workflows/WorkflowRejectedNotificationHandler.d.ts +13 -0
- package/api/workflows/WorkflowRejectedNotificationHandler.js +45 -0
- package/api/workflows/WorkflowRejectedNotificationHandler.js.map +1 -0
- package/api/workflows/feature.d.ts +4 -0
- package/api/workflows/feature.js +13 -0
- package/api/workflows/feature.js.map +1 -0
- package/api/workflows/getReviewNotificationLink.d.ts +6 -0
- package/api/workflows/getReviewNotificationLink.js +15 -0
- package/api/workflows/getReviewNotificationLink.js.map +1 -0
- package/api/workflows/toNotificationActor.d.ts +8 -0
- package/api/workflows/toNotificationActor.js +15 -0
- package/api/workflows/toNotificationActor.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +37 -0
- package/shared/constants.d.ts +2 -0
- package/shared/constants.js +4 -0
- package/shared/constants.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
3
|
+
const NotificationsIntegrations = ()=>/*#__PURE__*/ react.createElement(Api.Extension, {
|
|
4
|
+
src: import.meta.dirname + "/api/Extension.js"
|
|
5
|
+
});
|
|
6
|
+
export { NotificationsIntegrations };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=NotificationsIntegrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationsIntegrations.js","sources":["../src/NotificationsIntegrations.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api } from \"@webiny/project-aws/api.js\";\n\nexport const NotificationsIntegrations = () => {\n return <Api.Extension src={import.meta.dirname + \"/api/Extension.js\"} />;\n};\n"],"names":["NotificationsIntegrations","Api"],"mappings":";;AAGO,MAAMA,4BAA4B,IAC9B,WAAP,GAAO,oBAACC,IAAI,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG"}
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @webiny/notifications-integrations
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/api/Extension.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { CollaborationNotificationsFeature } from "./collaboration/feature.js";
|
|
3
|
+
import { WorkflowNotificationsFeature } from "./workflows/feature.js";
|
|
4
|
+
const Extension = createFeature({
|
|
5
|
+
name: "NotificationsIntegrations",
|
|
6
|
+
register (container) {
|
|
7
|
+
CollaborationNotificationsFeature.register(container);
|
|
8
|
+
WorkflowNotificationsFeature.register(container);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { Extension };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=Extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/Extension.js","sources":["../../src/api/Extension.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CollaborationNotificationsFeature } from \"./collaboration/feature.js\";\nimport { WorkflowNotificationsFeature } from \"./workflows/feature.js\";\n\nexport const Extension = createFeature({\n name: \"NotificationsIntegrations\",\n register(container) {\n CollaborationNotificationsFeature.register(container);\n WorkflowNotificationsFeature.register(container);\n }\n});\n"],"names":["Extension","createFeature","container","CollaborationNotificationsFeature","WorkflowNotificationsFeature"],"mappings":";;;AAIO,MAAMA,YAAYC,cAAc;IACnC,MAAM;IACN,UAASC,SAAS;QACdC,kCAAkC,QAAQ,CAACD;QAC3CE,6BAA6B,QAAQ,CAACF;IAC1C;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CollabReplyAddedHandler } from "@webiny/collaboration/api/domain/thread/events.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
declare class ReplyAddedNotificationHandlerImpl implements CollabReplyAddedHandler.Interface {
|
|
4
|
+
private createNotification;
|
|
5
|
+
constructor(createNotification: CreateNotificationUseCase.Interface);
|
|
6
|
+
handle(event: CollabReplyAddedHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ReplyAddedNotificationHandler: typeof ReplyAddedNotificationHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/collaboration/api/domain/thread/events.js").CollabReplyAddedEvent>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CollabReplyAddedHandler } from "@webiny/collaboration/api/domain/thread/events.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { NotificationType } from "@webiny/notifications/api/domain/notification/abstractions.js";
|
|
4
|
+
import { APP_HEADLESS_CMS } from "../../shared/constants.js";
|
|
5
|
+
class ReplyAddedNotificationHandlerImpl {
|
|
6
|
+
constructor(createNotification){
|
|
7
|
+
this.createNotification = createNotification;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
const { thread, message, anchor } = event.payload;
|
|
11
|
+
const actor = message.createdBy;
|
|
12
|
+
const title = anchor.contentTitle || anchor.label || "a comment";
|
|
13
|
+
const link = {
|
|
14
|
+
app: APP_HEADLESS_CMS,
|
|
15
|
+
contentType: thread.contentType,
|
|
16
|
+
contentId: thread.contentId,
|
|
17
|
+
locator: thread.locator,
|
|
18
|
+
threadId: thread.id
|
|
19
|
+
};
|
|
20
|
+
const mentioned = new Set((message.mentions || []).filter((id)=>id && id !== actor.id));
|
|
21
|
+
const participants = new Set();
|
|
22
|
+
for (const existing of thread.messages){
|
|
23
|
+
if (existing.id === message.id || existing.deleted) continue;
|
|
24
|
+
const authorId = existing.createdBy?.id;
|
|
25
|
+
if (authorId && authorId !== actor.id && !mentioned.has(authorId)) participants.add(authorId);
|
|
26
|
+
}
|
|
27
|
+
for (const recipientId of mentioned)await this.createNotification.execute({
|
|
28
|
+
recipientId,
|
|
29
|
+
type: NotificationType.mention,
|
|
30
|
+
actor,
|
|
31
|
+
title,
|
|
32
|
+
snippet: message.body,
|
|
33
|
+
link
|
|
34
|
+
});
|
|
35
|
+
for (const recipientId of participants)await this.createNotification.execute({
|
|
36
|
+
recipientId,
|
|
37
|
+
type: NotificationType.reply,
|
|
38
|
+
actor,
|
|
39
|
+
title,
|
|
40
|
+
snippet: message.body,
|
|
41
|
+
link
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const ReplyAddedNotificationHandler = CollabReplyAddedHandler.createImplementation({
|
|
46
|
+
implementation: ReplyAddedNotificationHandlerImpl,
|
|
47
|
+
dependencies: [
|
|
48
|
+
CreateNotificationUseCase
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
export { ReplyAddedNotificationHandler };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=ReplyAddedNotificationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/collaboration/ReplyAddedNotificationHandler.js","sources":["../../../src/api/collaboration/ReplyAddedNotificationHandler.ts"],"sourcesContent":["import { CollabReplyAddedHandler } from \"@webiny/collaboration/api/domain/thread/events.js\";\nimport { CreateNotificationUseCase } from \"@webiny/notifications/api/features/CreateNotification/index.js\";\nimport { NotificationType } from \"@webiny/notifications/api/domain/notification/abstractions.js\";\nimport { APP_HEADLESS_CMS } from \"~/shared/constants.js\";\n\nclass ReplyAddedNotificationHandlerImpl implements CollabReplyAddedHandler.Interface {\n constructor(private createNotification: CreateNotificationUseCase.Interface) {}\n\n async handle(event: CollabReplyAddedHandler.Event) {\n const { thread, message, anchor } = event.payload;\n const actor = message.createdBy;\n const title = anchor.contentTitle || anchor.label || \"a comment\";\n const link = {\n app: APP_HEADLESS_CMS,\n contentType: thread.contentType,\n contentId: thread.contentId,\n locator: thread.locator,\n threadId: thread.id\n };\n\n const mentioned = new Set((message.mentions || []).filter(id => id && id !== actor.id));\n const participants = new Set<string>();\n\n for (const existing of thread.messages) {\n if (existing.id === message.id || existing.deleted) {\n continue;\n }\n const authorId = existing.createdBy?.id;\n if (authorId && authorId !== actor.id && !mentioned.has(authorId)) {\n participants.add(authorId);\n }\n }\n\n for (const recipientId of mentioned) {\n await this.createNotification.execute({\n recipientId,\n type: NotificationType.mention,\n actor,\n title,\n snippet: message.body,\n link\n });\n }\n\n for (const recipientId of participants) {\n await this.createNotification.execute({\n recipientId,\n type: NotificationType.reply,\n actor,\n title,\n snippet: message.body,\n link\n });\n }\n }\n}\n\nexport const ReplyAddedNotificationHandler = CollabReplyAddedHandler.createImplementation({\n implementation: ReplyAddedNotificationHandlerImpl,\n dependencies: [CreateNotificationUseCase]\n});\n"],"names":["ReplyAddedNotificationHandlerImpl","createNotification","event","thread","message","anchor","actor","title","link","APP_HEADLESS_CMS","mentioned","Set","id","participants","existing","authorId","recipientId","NotificationType","ReplyAddedNotificationHandler","CollabReplyAddedHandler","CreateNotificationUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,kBAAuD,CAAE;aAAzDA,kBAAkB,GAAlBA;IAA0D;IAE9E,MAAM,OAAOC,KAAoC,EAAE;QAC/C,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH,MAAM,OAAO;QACjD,MAAMI,QAAQF,QAAQ,SAAS;QAC/B,MAAMG,QAAQF,OAAO,YAAY,IAAIA,OAAO,KAAK,IAAI;QACrD,MAAMG,OAAO;YACT,KAAKC;YACL,aAAaN,OAAO,WAAW;YAC/B,WAAWA,OAAO,SAAS;YAC3B,SAASA,OAAO,OAAO;YACvB,UAAUA,OAAO,EAAE;QACvB;QAEA,MAAMO,YAAY,IAAIC,IAAKP,AAAAA,CAAAA,QAAQ,QAAQ,IAAI,EAAC,EAAG,MAAM,CAACQ,CAAAA,KAAMA,MAAMA,OAAON,MAAM,EAAE;QACrF,MAAMO,eAAe,IAAIF;QAEzB,KAAK,MAAMG,YAAYX,OAAO,QAAQ,CAAE;YACpC,IAAIW,SAAS,EAAE,KAAKV,QAAQ,EAAE,IAAIU,SAAS,OAAO,EAC9C;YAEJ,MAAMC,WAAWD,SAAS,SAAS,EAAE;YACrC,IAAIC,YAAYA,aAAaT,MAAM,EAAE,IAAI,CAACI,UAAU,GAAG,CAACK,WACpDF,aAAa,GAAG,CAACE;QAEzB;QAEA,KAAK,MAAMC,eAAeN,UACtB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAClCM;YACA,MAAMC,iBAAiB,OAAO;YAC9BX;YACAC;YACA,SAASH,QAAQ,IAAI;YACrBI;QACJ;QAGJ,KAAK,MAAMQ,eAAeH,aACtB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAClCG;YACA,MAAMC,iBAAiB,KAAK;YAC5BX;YACAC;YACA,SAASH,QAAQ,IAAI;YACrBI;QACJ;IAER;AACJ;AAEO,MAAMU,gCAAgCC,wBAAwB,oBAAoB,CAAC;IACtF,gBAAgBnB;IAChB,cAAc;QAACoB;KAA0B;AAC7C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CollabThreadCreatedHandler } from "@webiny/collaboration/api/domain/thread/events.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
declare class ThreadCreatedNotificationHandlerImpl implements CollabThreadCreatedHandler.Interface {
|
|
4
|
+
private createNotification;
|
|
5
|
+
constructor(createNotification: CreateNotificationUseCase.Interface);
|
|
6
|
+
handle(event: CollabThreadCreatedHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThreadCreatedNotificationHandler: typeof ThreadCreatedNotificationHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/collaboration/api/domain/thread/events.js").CollabThreadCreatedEvent>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CollabThreadCreatedHandler } from "@webiny/collaboration/api/domain/thread/events.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { NotificationType } from "@webiny/notifications/api/domain/notification/abstractions.js";
|
|
4
|
+
import { APP_HEADLESS_CMS } from "../../shared/constants.js";
|
|
5
|
+
class ThreadCreatedNotificationHandlerImpl {
|
|
6
|
+
constructor(createNotification){
|
|
7
|
+
this.createNotification = createNotification;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
const { thread, message, anchor } = event.payload;
|
|
11
|
+
const actor = message.createdBy;
|
|
12
|
+
const title = anchor.contentTitle || anchor.label || "a comment";
|
|
13
|
+
const link = {
|
|
14
|
+
app: APP_HEADLESS_CMS,
|
|
15
|
+
contentType: thread.contentType,
|
|
16
|
+
contentId: thread.contentId,
|
|
17
|
+
locator: thread.locator,
|
|
18
|
+
threadId: thread.id
|
|
19
|
+
};
|
|
20
|
+
const recipients = new Set((message.mentions || []).filter((id)=>id && id !== actor.id));
|
|
21
|
+
for (const recipientId of recipients)await this.createNotification.execute({
|
|
22
|
+
recipientId,
|
|
23
|
+
type: NotificationType.mention,
|
|
24
|
+
actor,
|
|
25
|
+
title,
|
|
26
|
+
snippet: message.body,
|
|
27
|
+
link
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const ThreadCreatedNotificationHandler = CollabThreadCreatedHandler.createImplementation({
|
|
32
|
+
implementation: ThreadCreatedNotificationHandlerImpl,
|
|
33
|
+
dependencies: [
|
|
34
|
+
CreateNotificationUseCase
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
export { ThreadCreatedNotificationHandler };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=ThreadCreatedNotificationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/collaboration/ThreadCreatedNotificationHandler.js","sources":["../../../src/api/collaboration/ThreadCreatedNotificationHandler.ts"],"sourcesContent":["import { CollabThreadCreatedHandler } from \"@webiny/collaboration/api/domain/thread/events.js\";\nimport { CreateNotificationUseCase } from \"@webiny/notifications/api/features/CreateNotification/index.js\";\nimport { NotificationType } from \"@webiny/notifications/api/domain/notification/abstractions.js\";\nimport { APP_HEADLESS_CMS } from \"~/shared/constants.js\";\n\nclass ThreadCreatedNotificationHandlerImpl implements CollabThreadCreatedHandler.Interface {\n constructor(private createNotification: CreateNotificationUseCase.Interface) {}\n\n async handle(event: CollabThreadCreatedHandler.Event) {\n const { thread, message, anchor } = event.payload;\n const actor = message.createdBy;\n const title = anchor.contentTitle || anchor.label || \"a comment\";\n const link = {\n app: APP_HEADLESS_CMS,\n contentType: thread.contentType,\n contentId: thread.contentId,\n locator: thread.locator,\n threadId: thread.id\n };\n\n const recipients = new Set((message.mentions || []).filter(id => id && id !== actor.id));\n\n for (const recipientId of recipients) {\n await this.createNotification.execute({\n recipientId,\n type: NotificationType.mention,\n actor,\n title,\n snippet: message.body,\n link\n });\n }\n }\n}\n\nexport const ThreadCreatedNotificationHandler = CollabThreadCreatedHandler.createImplementation({\n implementation: ThreadCreatedNotificationHandlerImpl,\n dependencies: [CreateNotificationUseCase]\n});\n"],"names":["ThreadCreatedNotificationHandlerImpl","createNotification","event","thread","message","anchor","actor","title","link","APP_HEADLESS_CMS","recipients","Set","id","recipientId","NotificationType","ThreadCreatedNotificationHandler","CollabThreadCreatedHandler","CreateNotificationUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,kBAAuD,CAAE;aAAzDA,kBAAkB,GAAlBA;IAA0D;IAE9E,MAAM,OAAOC,KAAuC,EAAE;QAClD,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH,MAAM,OAAO;QACjD,MAAMI,QAAQF,QAAQ,SAAS;QAC/B,MAAMG,QAAQF,OAAO,YAAY,IAAIA,OAAO,KAAK,IAAI;QACrD,MAAMG,OAAO;YACT,KAAKC;YACL,aAAaN,OAAO,WAAW;YAC/B,WAAWA,OAAO,SAAS;YAC3B,SAASA,OAAO,OAAO;YACvB,UAAUA,OAAO,EAAE;QACvB;QAEA,MAAMO,aAAa,IAAIC,IAAKP,AAAAA,CAAAA,QAAQ,QAAQ,IAAI,EAAC,EAAG,MAAM,CAACQ,CAAAA,KAAMA,MAAMA,OAAON,MAAM,EAAE;QAEtF,KAAK,MAAMO,eAAeH,WACtB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAClCG;YACA,MAAMC,iBAAiB,OAAO;YAC9BR;YACAC;YACA,SAASH,QAAQ,IAAI;YACrBI;QACJ;IAER;AACJ;AAEO,MAAMO,mCAAmCC,2BAA2B,oBAAoB,CAAC;IAC5F,gBAAgBhB;IAChB,cAAc;QAACiB;KAA0B;AAC7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ThreadCreatedNotificationHandler } from "./ThreadCreatedNotificationHandler.js";
|
|
3
|
+
import { ReplyAddedNotificationHandler } from "./ReplyAddedNotificationHandler.js";
|
|
4
|
+
const CollaborationNotificationsFeature = createFeature({
|
|
5
|
+
name: "NotificationsIntegrations/Collaboration",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(ThreadCreatedNotificationHandler);
|
|
8
|
+
container.register(ReplyAddedNotificationHandler);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { CollaborationNotificationsFeature };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/collaboration/feature.js","sources":["../../../src/api/collaboration/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ThreadCreatedNotificationHandler } from \"./ThreadCreatedNotificationHandler.js\";\nimport { ReplyAddedNotificationHandler } from \"./ReplyAddedNotificationHandler.js\";\n\nexport const CollaborationNotificationsFeature = createFeature({\n name: \"NotificationsIntegrations/Collaboration\",\n register(container) {\n container.register(ThreadCreatedNotificationHandler);\n container.register(ReplyAddedNotificationHandler);\n }\n});\n"],"names":["CollaborationNotificationsFeature","createFeature","container","ThreadCreatedNotificationHandler","ReplyAddedNotificationHandler"],"mappings":";;;AAIO,MAAMA,oCAAoCC,cAAc;IAC3D,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReviewApprovedEventHandler } from "@webiny/api-workflows/features/review/ApproveReviewStep/index.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { WorkflowModelParserService } from "@webiny/api-workflows/features/model/WorkflowModelParserService/index.js";
|
|
4
|
+
declare class WorkflowApprovedNotificationHandlerImpl implements ReviewApprovedEventHandler.Interface {
|
|
5
|
+
private createNotification;
|
|
6
|
+
private modelParser;
|
|
7
|
+
constructor(createNotification: CreateNotificationUseCase.Interface, modelParser: WorkflowModelParserService.Interface);
|
|
8
|
+
handle(event: ReviewApprovedEventHandler.Event): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const WorkflowApprovedNotificationHandler: typeof WorkflowApprovedNotificationHandlerImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-workflows/features/review/ApproveReviewStep/events.js").ReviewApprovedEvent>>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReviewApprovedEventHandler } from "@webiny/api-workflows/features/review/ApproveReviewStep/index.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { NotificationType } from "@webiny/notifications/api/domain/notification/abstractions.js";
|
|
4
|
+
import { WorkflowModelParserService } from "@webiny/api-workflows/features/model/WorkflowModelParserService/index.js";
|
|
5
|
+
import { buildApprovedMessage } from "@webiny/api-workflows/domain/notifications/messages/buildApprovedMessage.js";
|
|
6
|
+
import { getReviewNotificationLink } from "./getReviewNotificationLink.js";
|
|
7
|
+
import { toNotificationActor } from "./toNotificationActor.js";
|
|
8
|
+
class WorkflowApprovedNotificationHandlerImpl {
|
|
9
|
+
constructor(createNotification, modelParser){
|
|
10
|
+
this.createNotification = createNotification;
|
|
11
|
+
this.modelParser = modelParser;
|
|
12
|
+
}
|
|
13
|
+
async handle(event) {
|
|
14
|
+
const review = event.payload.review;
|
|
15
|
+
const recipientId = review.createdBy?.id;
|
|
16
|
+
const actor = event.payload.fact.actor;
|
|
17
|
+
if (!recipientId || "user" === actor.type && actor.id === recipientId) return;
|
|
18
|
+
const step = review.steps[review.steps.length - 1];
|
|
19
|
+
await this.createNotification.execute({
|
|
20
|
+
recipientId,
|
|
21
|
+
type: NotificationType.approved,
|
|
22
|
+
actor: toNotificationActor(actor, step?.title ?? ""),
|
|
23
|
+
title: review.title,
|
|
24
|
+
snippet: buildApprovedMessage({
|
|
25
|
+
contentTitle: review.title
|
|
26
|
+
}).body,
|
|
27
|
+
link: getReviewNotificationLink(this.modelParser.parse(review.model), review.targetId)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const WorkflowApprovedNotificationHandler = ReviewApprovedEventHandler.createImplementation({
|
|
32
|
+
implementation: WorkflowApprovedNotificationHandlerImpl,
|
|
33
|
+
dependencies: [
|
|
34
|
+
CreateNotificationUseCase,
|
|
35
|
+
WorkflowModelParserService
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
export { WorkflowApprovedNotificationHandler };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=WorkflowApprovedNotificationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/workflows/WorkflowApprovedNotificationHandler.js","sources":["../../../src/api/workflows/WorkflowApprovedNotificationHandler.ts"],"sourcesContent":["import { ReviewApprovedEventHandler } from \"@webiny/api-workflows/features/review/ApproveReviewStep/index.js\";\nimport { CreateNotificationUseCase } from \"@webiny/notifications/api/features/CreateNotification/index.js\";\nimport { NotificationType } from \"@webiny/notifications/api/domain/notification/abstractions.js\";\nimport { WorkflowModelParserService } from \"@webiny/api-workflows/features/model/WorkflowModelParserService/index.js\";\nimport { buildApprovedMessage } from \"@webiny/api-workflows/domain/notifications/messages/buildApprovedMessage.js\";\nimport { getReviewNotificationLink } from \"./getReviewNotificationLink.js\";\nimport { toNotificationActor } from \"./toNotificationActor.js\";\n\n// Tells the requester in the inbox that every step of their review approved it. Single steps are\n// not announced: the design has no per-step approval notice.\nclass WorkflowApprovedNotificationHandlerImpl implements ReviewApprovedEventHandler.Interface {\n constructor(\n private createNotification: CreateNotificationUseCase.Interface,\n private modelParser: WorkflowModelParserService.Interface\n ) {}\n\n async handle(event: ReviewApprovedEventHandler.Event) {\n const review = event.payload.review;\n const recipientId = review.createdBy?.id;\n // Who decided comes from the fact, not the current identity: an AI or automation step\n // decides while running as the requester (R149), and must still notify them. Only a\n // requester deciding the last step themselves is not told.\n const actor = event.payload.fact.actor;\n if (!recipientId || (actor.type === \"user\" && actor.id === recipientId)) {\n return;\n }\n // The last step is the one that approved the review.\n const step = review.steps[review.steps.length - 1];\n\n await this.createNotification.execute({\n recipientId,\n type: NotificationType.approved,\n actor: toNotificationActor(actor, step?.title ?? \"\"),\n title: review.title,\n snippet: buildApprovedMessage({ contentTitle: review.title }).body,\n link: getReviewNotificationLink(this.modelParser.parse(review.model), review.targetId)\n });\n }\n}\n\nexport const WorkflowApprovedNotificationHandler = ReviewApprovedEventHandler.createImplementation({\n implementation: WorkflowApprovedNotificationHandlerImpl,\n dependencies: [CreateNotificationUseCase, WorkflowModelParserService]\n});\n"],"names":["WorkflowApprovedNotificationHandlerImpl","createNotification","modelParser","event","review","recipientId","actor","step","NotificationType","toNotificationActor","buildApprovedMessage","getReviewNotificationLink","WorkflowApprovedNotificationHandler","ReviewApprovedEventHandler","CreateNotificationUseCase","WorkflowModelParserService"],"mappings":";;;;;;;AAUA,MAAMA;IACF,YACYC,kBAAuD,EACvDC,WAAiD,CAC3D;aAFUD,kBAAkB,GAAlBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,OAAOC,KAAuC,EAAE;QAClD,MAAMC,SAASD,MAAM,OAAO,CAAC,MAAM;QACnC,MAAME,cAAcD,OAAO,SAAS,EAAE;QAItC,MAAME,QAAQH,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK;QACtC,IAAI,CAACE,eAAgBC,AAAe,WAAfA,MAAM,IAAI,IAAeA,MAAM,EAAE,KAAKD,aACvD;QAGJ,MAAME,OAAOH,OAAO,KAAK,CAACA,OAAO,KAAK,CAAC,MAAM,GAAG,EAAE;QAElD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAClCC;YACA,MAAMG,iBAAiB,QAAQ;YAC/B,OAAOC,oBAAoBH,OAAOC,MAAM,SAAS;YACjD,OAAOH,OAAO,KAAK;YACnB,SAASM,qBAAqB;gBAAE,cAAcN,OAAO,KAAK;YAAC,GAAG,IAAI;YAClE,MAAMO,0BAA0B,IAAI,CAAC,WAAW,CAAC,KAAK,CAACP,OAAO,KAAK,GAAGA,OAAO,QAAQ;QACzF;IACJ;AACJ;AAEO,MAAMQ,sCAAsCC,2BAA2B,oBAAoB,CAAC;IAC/F,gBAAgBb;IAChB,cAAc;QAACc;QAA2BC;KAA2B;AACzE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReviewStepRejectedEventHandler } from "@webiny/api-workflows/features/review/RejectReviewStep/index.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { WorkflowModelParserService } from "@webiny/api-workflows/features/model/WorkflowModelParserService/index.js";
|
|
4
|
+
declare class WorkflowRejectedNotificationHandlerImpl implements ReviewStepRejectedEventHandler.Interface {
|
|
5
|
+
private createNotification;
|
|
6
|
+
private modelParser;
|
|
7
|
+
constructor(createNotification: CreateNotificationUseCase.Interface, modelParser: WorkflowModelParserService.Interface);
|
|
8
|
+
handle(event: ReviewStepRejectedEventHandler.Event): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const WorkflowRejectedNotificationHandler: typeof WorkflowRejectedNotificationHandlerImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-workflows/features/review/RejectReviewStep/events.js").ReviewStepRejectedEvent>>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReviewStepRejectedEventHandler } from "@webiny/api-workflows/features/review/RejectReviewStep/index.js";
|
|
2
|
+
import { CreateNotificationUseCase } from "@webiny/notifications/api/features/CreateNotification/index.js";
|
|
3
|
+
import { NotificationType } from "@webiny/notifications/api/domain/notification/abstractions.js";
|
|
4
|
+
import { WorkflowModelParserService } from "@webiny/api-workflows/features/model/WorkflowModelParserService/index.js";
|
|
5
|
+
import { buildRejectedMessage } from "@webiny/api-workflows/domain/notifications/messages/buildRejectedMessage.js";
|
|
6
|
+
import { getActorName } from "@webiny/api-workflows/domain/notifications/getActorName.js";
|
|
7
|
+
import { getReviewNotificationLink } from "./getReviewNotificationLink.js";
|
|
8
|
+
import { toNotificationActor } from "./toNotificationActor.js";
|
|
9
|
+
class WorkflowRejectedNotificationHandlerImpl {
|
|
10
|
+
constructor(createNotification, modelParser){
|
|
11
|
+
this.createNotification = createNotification;
|
|
12
|
+
this.modelParser = modelParser;
|
|
13
|
+
}
|
|
14
|
+
async handle(event) {
|
|
15
|
+
const review = event.payload.review;
|
|
16
|
+
const recipientId = review.createdBy?.id;
|
|
17
|
+
const actor = event.payload.fact.actor;
|
|
18
|
+
if (!recipientId || "user" === actor.type && actor.id === recipientId) return;
|
|
19
|
+
const step = review.steps.find((item)=>item.id === event.payload.fact.change.stepId);
|
|
20
|
+
const stepTitle = step?.title ?? "";
|
|
21
|
+
await this.createNotification.execute({
|
|
22
|
+
recipientId,
|
|
23
|
+
type: NotificationType.rejected,
|
|
24
|
+
actor: toNotificationActor(actor, stepTitle),
|
|
25
|
+
title: review.title,
|
|
26
|
+
snippet: buildRejectedMessage({
|
|
27
|
+
contentTitle: review.title,
|
|
28
|
+
stepTitle,
|
|
29
|
+
decider: getActorName(actor, stepTitle),
|
|
30
|
+
comment: event.payload.fact.comment
|
|
31
|
+
}).body,
|
|
32
|
+
link: getReviewNotificationLink(this.modelParser.parse(review.model), review.targetId)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const WorkflowRejectedNotificationHandler = ReviewStepRejectedEventHandler.createImplementation({
|
|
37
|
+
implementation: WorkflowRejectedNotificationHandlerImpl,
|
|
38
|
+
dependencies: [
|
|
39
|
+
CreateNotificationUseCase,
|
|
40
|
+
WorkflowModelParserService
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
export { WorkflowRejectedNotificationHandler };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=WorkflowRejectedNotificationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/workflows/WorkflowRejectedNotificationHandler.js","sources":["../../../src/api/workflows/WorkflowRejectedNotificationHandler.ts"],"sourcesContent":["import { ReviewStepRejectedEventHandler } from \"@webiny/api-workflows/features/review/RejectReviewStep/index.js\";\nimport { CreateNotificationUseCase } from \"@webiny/notifications/api/features/CreateNotification/index.js\";\nimport { NotificationType } from \"@webiny/notifications/api/domain/notification/abstractions.js\";\nimport { WorkflowModelParserService } from \"@webiny/api-workflows/features/model/WorkflowModelParserService/index.js\";\nimport { buildRejectedMessage } from \"@webiny/api-workflows/domain/notifications/messages/buildRejectedMessage.js\";\nimport { getActorName } from \"@webiny/api-workflows/domain/notifications/getActorName.js\";\nimport { getReviewNotificationLink } from \"./getReviewNotificationLink.js\";\nimport { toNotificationActor } from \"./toNotificationActor.js\";\n\n// Tells the requester in the inbox that a step of their review was rejected.\nclass WorkflowRejectedNotificationHandlerImpl implements ReviewStepRejectedEventHandler.Interface {\n constructor(\n private createNotification: CreateNotificationUseCase.Interface,\n private modelParser: WorkflowModelParserService.Interface\n ) {}\n\n async handle(event: ReviewStepRejectedEventHandler.Event) {\n const review = event.payload.review;\n const recipientId = review.createdBy?.id;\n // Who decided comes from the fact, not the current identity: an AI or automation step\n // decides while running as the requester (R149), and must still notify them. Only a\n // requester deciding their own step is not told.\n const actor = event.payload.fact.actor;\n if (!recipientId || (actor.type === \"user\" && actor.id === recipientId)) {\n return;\n }\n const step = review.steps.find(item => item.id === event.payload.fact.change.stepId);\n const stepTitle = step?.title ?? \"\";\n\n await this.createNotification.execute({\n recipientId,\n type: NotificationType.rejected,\n actor: toNotificationActor(actor, stepTitle),\n title: review.title,\n // The design's in-app body: who rejected it and why (D107, D126).\n snippet: buildRejectedMessage({\n contentTitle: review.title,\n stepTitle,\n decider: getActorName(actor, stepTitle),\n comment: event.payload.fact.comment\n }).body,\n link: getReviewNotificationLink(this.modelParser.parse(review.model), review.targetId)\n });\n }\n}\n\nexport const WorkflowRejectedNotificationHandler =\n ReviewStepRejectedEventHandler.createImplementation({\n implementation: WorkflowRejectedNotificationHandlerImpl,\n dependencies: [CreateNotificationUseCase, WorkflowModelParserService]\n });\n"],"names":["WorkflowRejectedNotificationHandlerImpl","createNotification","modelParser","event","review","recipientId","actor","step","item","stepTitle","NotificationType","toNotificationActor","buildRejectedMessage","getActorName","getReviewNotificationLink","WorkflowRejectedNotificationHandler","ReviewStepRejectedEventHandler","CreateNotificationUseCase","WorkflowModelParserService"],"mappings":";;;;;;;;AAUA,MAAMA;IACF,YACYC,kBAAuD,EACvDC,WAAiD,CAC3D;aAFUD,kBAAkB,GAAlBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,OAAOC,KAA2C,EAAE;QACtD,MAAMC,SAASD,MAAM,OAAO,CAAC,MAAM;QACnC,MAAME,cAAcD,OAAO,SAAS,EAAE;QAItC,MAAME,QAAQH,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK;QACtC,IAAI,CAACE,eAAgBC,AAAe,WAAfA,MAAM,IAAI,IAAeA,MAAM,EAAE,KAAKD,aACvD;QAEJ,MAAME,OAAOH,OAAO,KAAK,CAAC,IAAI,CAACI,CAAAA,OAAQA,KAAK,EAAE,KAAKL,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;QACnF,MAAMM,YAAYF,MAAM,SAAS;QAEjC,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YAClCF;YACA,MAAMK,iBAAiB,QAAQ;YAC/B,OAAOC,oBAAoBL,OAAOG;YAClC,OAAOL,OAAO,KAAK;YAEnB,SAASQ,qBAAqB;gBAC1B,cAAcR,OAAO,KAAK;gBAC1BK;gBACA,SAASI,aAAaP,OAAOG;gBAC7B,SAASN,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO;YACvC,GAAG,IAAI;YACP,MAAMW,0BAA0B,IAAI,CAAC,WAAW,CAAC,KAAK,CAACV,OAAO,KAAK,GAAGA,OAAO,QAAQ;QACzF;IACJ;AACJ;AAEO,MAAMW,sCACTC,+BAA+B,oBAAoB,CAAC;IAChD,gBAAgBhB;IAChB,cAAc;QAACiB;QAA2BC;KAA2B;AACzE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { WorkflowApprovedNotificationHandler } from "./WorkflowApprovedNotificationHandler.js";
|
|
3
|
+
import { WorkflowRejectedNotificationHandler } from "./WorkflowRejectedNotificationHandler.js";
|
|
4
|
+
const WorkflowNotificationsFeature = createFeature({
|
|
5
|
+
name: "NotificationsIntegrations/Workflows",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(WorkflowApprovedNotificationHandler);
|
|
8
|
+
container.register(WorkflowRejectedNotificationHandler);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { WorkflowNotificationsFeature };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/workflows/feature.js","sources":["../../../src/api/workflows/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { WorkflowApprovedNotificationHandler } from \"./WorkflowApprovedNotificationHandler.js\";\nimport { WorkflowRejectedNotificationHandler } from \"./WorkflowRejectedNotificationHandler.js\";\n\nexport const WorkflowNotificationsFeature = createFeature({\n name: \"NotificationsIntegrations/Workflows\",\n register(container) {\n container.register(WorkflowApprovedNotificationHandler);\n container.register(WorkflowRejectedNotificationHandler);\n }\n});\n"],"names":["WorkflowNotificationsFeature","createFeature","container","WorkflowApprovedNotificationHandler","WorkflowRejectedNotificationHandler"],"mappings":";;;AAIO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WorkflowModelParser } from "@webiny/api-workflows/features/model/WorkflowModelParser/index.js";
|
|
2
|
+
export interface ReviewNotificationLink {
|
|
3
|
+
app: string;
|
|
4
|
+
contentId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getReviewNotificationLink: (parsed: WorkflowModelParser.Parsed | null, targetId: string) => ReviewNotificationLink | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { APP_HEADLESS_CMS } from "../../shared/constants.js";
|
|
2
|
+
const getReviewNotificationLink = (parsed, targetId)=>{
|
|
3
|
+
if (!parsed) return null;
|
|
4
|
+
if (parsed.app === APP_HEADLESS_CMS) return {
|
|
5
|
+
app: parsed.app,
|
|
6
|
+
contentId: `${parsed.modelId}:${targetId}`
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
app: parsed.app,
|
|
10
|
+
contentId: targetId
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export { getReviewNotificationLink };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=getReviewNotificationLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/workflows/getReviewNotificationLink.js","sources":["../../../src/api/workflows/getReviewNotificationLink.ts"],"sourcesContent":["import type { WorkflowModelParser } from \"@webiny/api-workflows/features/model/WorkflowModelParser/index.js\";\nimport { APP_HEADLESS_CMS } from \"~/shared/constants.js\";\n\nexport interface ReviewNotificationLink {\n app: string;\n contentId: string;\n}\n\n/*\n * A CMS entry link carries \"<modelId>:<entryId>\", which the inbox opens. Any other app gets its app\n * id and the bare target id; the inbox does not open those yet. A model no app knows gets no link.\n */\nexport const getReviewNotificationLink = (\n parsed: WorkflowModelParser.Parsed | null,\n targetId: string\n): ReviewNotificationLink | null => {\n if (!parsed) {\n return null;\n }\n if (parsed.app === APP_HEADLESS_CMS) {\n return { app: parsed.app, contentId: `${parsed.modelId}:${targetId}` };\n }\n return { app: parsed.app, contentId: targetId };\n};\n"],"names":["getReviewNotificationLink","parsed","targetId","APP_HEADLESS_CMS"],"mappings":";AAYO,MAAMA,4BAA4B,CACrCC,QACAC;IAEA,IAAI,CAACD,QACD,OAAO;IAEX,IAAIA,OAAO,GAAG,KAAKE,kBACf,OAAO;QAAE,KAAKF,OAAO,GAAG;QAAE,WAAW,GAAGA,OAAO,OAAO,CAAC,CAAC,EAAEC,UAAU;IAAC;IAEzE,OAAO;QAAE,KAAKD,OAAO,GAAG;QAAE,WAAWC;IAAS;AAClD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Actor } from "@webiny/api-workflows/domain/review/types.js";
|
|
2
|
+
import type { NotificationIdentity } from "@webiny/notifications/api/domain/notification/abstractions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Who the inbox names as having decided a step. An AI or automation actor carries the requester's
|
|
5
|
+
* id and name (D58), so it is named by the step title instead (D107): the requester did not
|
|
6
|
+
* decide.
|
|
7
|
+
*/
|
|
8
|
+
export declare const toNotificationActor: (actor: Actor, stepTitle: string) => NotificationIdentity;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const toNotificationActor = (actor, stepTitle)=>{
|
|
2
|
+
if ("user" === actor.type) return {
|
|
3
|
+
id: actor.id,
|
|
4
|
+
displayName: actor.displayName,
|
|
5
|
+
type: actor.identityType ?? "admin"
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
id: actor.id,
|
|
9
|
+
displayName: stepTitle,
|
|
10
|
+
type: actor.type
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export { toNotificationActor };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=toNotificationActor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/workflows/toNotificationActor.js","sources":["../../../src/api/workflows/toNotificationActor.ts"],"sourcesContent":["import type { Actor } from \"@webiny/api-workflows/domain/review/types.js\";\nimport type { NotificationIdentity } from \"@webiny/notifications/api/domain/notification/abstractions.js\";\n\n/**\n * Who the inbox names as having decided a step. An AI or automation actor carries the requester's\n * id and name (D58), so it is named by the step title instead (D107): the requester did not\n * decide.\n */\nexport const toNotificationActor = (actor: Actor, stepTitle: string): NotificationIdentity => {\n if (actor.type === \"user\") {\n return {\n id: actor.id,\n displayName: actor.displayName,\n type: actor.identityType ?? \"admin\"\n };\n }\n return { id: actor.id, displayName: stepTitle, type: actor.type };\n};\n"],"names":["toNotificationActor","actor","stepTitle"],"mappings":"AAQO,MAAMA,sBAAsB,CAACC,OAAcC;IAC9C,IAAID,AAAe,WAAfA,MAAM,IAAI,EACV,OAAO;QACH,IAAIA,MAAM,EAAE;QACZ,aAAaA,MAAM,WAAW;QAC9B,MAAMA,MAAM,YAAY,IAAI;IAChC;IAEJ,OAAO;QAAE,IAAIA,MAAM,EAAE;QAAE,aAAaC;QAAW,MAAMD,MAAM,IAAI;IAAC;AACpE"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NotificationsIntegrations } from "./NotificationsIntegrations.js";
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NotificationsIntegrations } from "./NotificationsIntegrations.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/notifications-integrations",
|
|
3
|
+
"version": "0.0.0-unstable.0156a4c312",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./*": "./*"
|
|
9
|
+
},
|
|
10
|
+
"description": "Notification integrations: feeds the notifications inbox from Workflows and Collaboration",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/webiny/webiny-js.git",
|
|
14
|
+
"directory": "packages/notifications-integrations"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@webiny/api-workflows": "0.0.0-unstable.0156a4c312",
|
|
19
|
+
"@webiny/collaboration": "0.0.0-unstable.0156a4c312",
|
|
20
|
+
"@webiny/feature": "0.0.0-unstable.0156a4c312",
|
|
21
|
+
"@webiny/notifications": "0.0.0-unstable.0156a4c312",
|
|
22
|
+
"@webiny/project-aws": "0.0.0-unstable.0156a4c312",
|
|
23
|
+
"react": "19.3.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/react": "19.3.0",
|
|
27
|
+
"@webiny/build-tools": "0.0.0-unstable.0156a4c312",
|
|
28
|
+
"typescript": "7.0.2",
|
|
29
|
+
"vitest": "5.0.5"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"webiny": {
|
|
35
|
+
"publishFrom": "dist"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared/constants.js","sources":["../../src/shared/constants.ts"],"sourcesContent":["/** Routing hints stored on a notification's link, used by the admin to navigate on click. */\nexport const APP_HEADLESS_CMS = \"cms\";\n"],"names":["APP_HEADLESS_CMS"],"mappings":"AACO,MAAMA,mBAAmB"}
|