@nocobase/plugin-notification-in-app-message 1.8.14 → 1.8.15
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/externalVersion.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
|
-
"@nocobase/client": "1.8.
|
|
13
|
-
"@nocobase/plugin-notification-manager": "1.8.
|
|
14
|
-
"@nocobase/plugin-mobile": "1.8.
|
|
15
|
-
"@nocobase/utils": "1.8.
|
|
12
|
+
"@nocobase/client": "1.8.15",
|
|
13
|
+
"@nocobase/plugin-notification-manager": "1.8.15",
|
|
14
|
+
"@nocobase/plugin-mobile": "1.8.15",
|
|
15
|
+
"@nocobase/utils": "1.8.15",
|
|
16
16
|
"react-i18next": "11.18.6",
|
|
17
|
-
"@nocobase/server": "1.8.
|
|
17
|
+
"@nocobase/server": "1.8.15",
|
|
18
18
|
"sequelize": "6.35.2",
|
|
19
|
-
"@nocobase/actions": "1.8.
|
|
20
|
-
"@nocobase/database": "1.8.
|
|
19
|
+
"@nocobase/actions": "1.8.15",
|
|
20
|
+
"@nocobase/database": "1.8.15",
|
|
21
21
|
"antd": "5.24.2",
|
|
22
22
|
"@formily/reactive-react": "2.3.0",
|
|
23
23
|
"antd-style": "3.7.1",
|
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
|
26
26
|
"react-router-dom": "6.28.1",
|
|
27
27
|
"@formily/core": "2.3.0",
|
|
28
28
|
"@ant-design/icons": "5.6.1",
|
|
29
|
-
"@nocobase/plugin-workflow": "1.8.
|
|
29
|
+
"@nocobase/plugin-workflow": "1.8.15",
|
|
30
30
|
"@formily/reactive": "2.3.0",
|
|
31
31
|
"@formily/shared": "2.3.2"
|
|
32
32
|
};
|
|
@@ -10,7 +10,8 @@ import { SendFnType, BaseNotificationChannel } from '@nocobase/plugin-notificati
|
|
|
10
10
|
import { InAppMessageFormValues } from '../types';
|
|
11
11
|
export default class InAppNotificationChannel extends BaseNotificationChannel {
|
|
12
12
|
load(): Promise<void>;
|
|
13
|
-
|
|
13
|
+
onMessageCreated: (model: any, options: any) => Promise<void>;
|
|
14
|
+
onMessageUpdated: (model: any, options: any) => Promise<void>;
|
|
14
15
|
saveMessageToDB: ({ content, status, userId, title, channelName, receiveTimestamp, options, }: {
|
|
15
16
|
content: string;
|
|
16
17
|
userId: number;
|
|
@@ -51,10 +51,22 @@ class InAppNotificationChannel extends import_plugin_notification_manager.BaseNo
|
|
|
51
51
|
// this.userClientsMap = {};
|
|
52
52
|
// }
|
|
53
53
|
async load() {
|
|
54
|
-
this.app.db.on(`${import_types2.InAppMessagesDefinition.name}.
|
|
54
|
+
this.app.db.on(`${import_types2.InAppMessagesDefinition.name}.afterCreate`, this.onMessageCreated);
|
|
55
|
+
this.app.db.on(`${import_types2.InAppMessagesDefinition.name}.afterUpdate`, this.onMessageUpdated);
|
|
55
56
|
this.defineActions();
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
onMessageCreated = async (model, options) => {
|
|
59
|
+
const userId = model.userId;
|
|
60
|
+
this.app.emit("ws:sendToTag", {
|
|
61
|
+
tagKey: "userId",
|
|
62
|
+
tagValue: userId,
|
|
63
|
+
message: {
|
|
64
|
+
type: "in-app-message:created",
|
|
65
|
+
payload: model.toJSON()
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
onMessageUpdated = async (model, options) => {
|
|
58
70
|
const userId = model.userId;
|
|
59
71
|
this.app.emit("ws:sendToTag", {
|
|
60
72
|
tagKey: "userId",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-notification-in-app-message",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.15",
|
|
4
4
|
"displayName": "Notification: In-app message",
|
|
5
5
|
"displayName.zh-CN": "通知:站内信",
|
|
6
6
|
"description": "It supports users in receiving real-time message notifications within the NocoBase application.",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"@nocobase/test": "1.x",
|
|
27
27
|
"react-router-dom": "^6.x"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "6cbf5a6ef2023ebaedce11c60351df858d4832b2"
|
|
30
30
|
}
|