@nocobase/plugin-notification-in-app-message 1.4.0-alpha.20241027230531
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.txt +159 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/MessageManagerProvider.d.ts +10 -0
- package/dist/client/components/ContentConfigForm.d.ts +12 -0
- package/dist/client/components/Inbox.d.ts +18 -0
- package/dist/client/components/InboxContent.d.ts +10 -0
- package/dist/client/components/MessageConfigForm.d.ts +12 -0
- package/dist/client/components/MessageList.d.ts +10 -0
- package/dist/client/components/UsersAddition.d.ts +10 -0
- package/dist/client/components/UsersSelect.d.ts +18 -0
- package/dist/client/components/hooks/useChat.d.ts +36 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.js +24 -0
- package/dist/client/observables/channel.d.ts +37 -0
- package/dist/client/observables/inbox.d.ts +11 -0
- package/dist/client/observables/index.d.ts +13 -0
- package/dist/client/observables/message.d.ts +33 -0
- package/dist/client/observables/sse.d.ts +5 -0
- package/dist/client/observables/user.d.ts +11 -0
- package/dist/client/utils.d.ts +11 -0
- package/dist/externalVersion.js +29 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +22 -0
- package/dist/locale/index.d.ts +12 -0
- package/dist/locale/index.js +55 -0
- package/dist/locale/zh-CN.json +21 -0
- package/dist/server/InAppNotificationChannel.d.ts +41 -0
- package/dist/server/InAppNotificationChannel.js +162 -0
- package/dist/server/collections/messages.d.ts +10 -0
- package/dist/server/collections/messages.js +33 -0
- package/dist/server/defineMyInAppChannels.d.ts +12 -0
- package/dist/server/defineMyInAppChannels.js +159 -0
- package/dist/server/defineMyInAppMessages.d.ts +15 -0
- package/dist/server/defineMyInAppMessages.js +123 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/parseUserSelectionConf.d.ts +10 -0
- package/dist/server/parseUserSelectionConf.js +51 -0
- package/dist/server/plugin.d.ts +19 -0
- package/dist/server/plugin.js +72 -0
- package/dist/types/channels.d.ts +18 -0
- package/dist/types/channels.js +93 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.js +62 -0
- package/dist/types/messages.d.ts +10 -0
- package/dist/types/messages.js +129 -0
- package/dist/types/sse.d.ts +20 -0
- package/dist/types/sse.js +24 -0
- package/package.json +25 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var server_exports = {};
|
|
38
|
+
__export(server_exports, {
|
|
39
|
+
default: () => import_plugin.default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(server_exports);
|
|
42
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Repository } from '@nocobase/database';
|
|
10
|
+
export declare function parseUserSelectionConf(userSelectionConfig: Array<Record<any, any> | string>, UserRepo: Repository): Promise<string[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var parseUserSelectionConf_exports = {};
|
|
28
|
+
__export(parseUserSelectionConf_exports, {
|
|
29
|
+
parseUserSelectionConf: () => parseUserSelectionConf
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(parseUserSelectionConf_exports);
|
|
32
|
+
async function parseUserSelectionConf(userSelectionConfig, UserRepo) {
|
|
33
|
+
const SelectionConfigs = userSelectionConfig.flat().filter(Boolean);
|
|
34
|
+
const users = /* @__PURE__ */ new Set();
|
|
35
|
+
for (const item of SelectionConfigs) {
|
|
36
|
+
if (typeof item === "object") {
|
|
37
|
+
const result = await UserRepo.find({
|
|
38
|
+
...item,
|
|
39
|
+
fields: ["id"]
|
|
40
|
+
});
|
|
41
|
+
result.forEach((item2) => users.add(item2.id));
|
|
42
|
+
} else {
|
|
43
|
+
users.add(item);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...users];
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
parseUserSelectionConf
|
|
51
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from '@nocobase/server';
|
|
10
|
+
export declare class PluginNotificationInAppServer extends Plugin {
|
|
11
|
+
afterAdd(): Promise<void>;
|
|
12
|
+
beforeLoad(): Promise<void>;
|
|
13
|
+
load(): Promise<void>;
|
|
14
|
+
install(): Promise<void>;
|
|
15
|
+
afterEnable(): Promise<void>;
|
|
16
|
+
afterDisable(): Promise<void>;
|
|
17
|
+
remove(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export default PluginNotificationInAppServer;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var plugin_exports = {};
|
|
38
|
+
__export(plugin_exports, {
|
|
39
|
+
PluginNotificationInAppServer: () => PluginNotificationInAppServer,
|
|
40
|
+
default: () => plugin_default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
43
|
+
var import_server = require("@nocobase/server");
|
|
44
|
+
var import_types = require("../types");
|
|
45
|
+
var import_plugin_notification_manager = __toESM(require("@nocobase/plugin-notification-manager"));
|
|
46
|
+
var import_InAppNotificationChannel = __toESM(require("./InAppNotificationChannel"));
|
|
47
|
+
const NAMESPACE = "notification-in-app";
|
|
48
|
+
class PluginNotificationInAppServer extends import_server.Plugin {
|
|
49
|
+
async afterAdd() {
|
|
50
|
+
}
|
|
51
|
+
async beforeLoad() {
|
|
52
|
+
}
|
|
53
|
+
async load() {
|
|
54
|
+
const notificationServer = this.pm.get(import_plugin_notification_manager.default);
|
|
55
|
+
const instance = new import_InAppNotificationChannel.default(this.app);
|
|
56
|
+
instance.load();
|
|
57
|
+
notificationServer.registerChannelType({ type: import_types.inAppTypeName, Channel: import_InAppNotificationChannel.default });
|
|
58
|
+
}
|
|
59
|
+
async install() {
|
|
60
|
+
}
|
|
61
|
+
async afterEnable() {
|
|
62
|
+
}
|
|
63
|
+
async afterDisable() {
|
|
64
|
+
}
|
|
65
|
+
async remove() {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var plugin_default = PluginNotificationInAppServer;
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
PluginNotificationInAppServer
|
|
72
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CollectionOptions } from '@nocobase/client';
|
|
10
|
+
export declare const channelsCollection: CollectionOptions;
|
|
11
|
+
export type MsgGroup = {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
unreadMsgCnt: number;
|
|
16
|
+
lastMessageReceiveTime: string;
|
|
17
|
+
lastMessageTitle: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var channels_exports = {};
|
|
28
|
+
__export(channels_exports, {
|
|
29
|
+
channelsCollection: () => channelsCollection
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(channels_exports);
|
|
32
|
+
var import__ = require(".");
|
|
33
|
+
const channelsCollection = {
|
|
34
|
+
name: import__.ChannelsDefinition.name,
|
|
35
|
+
title: "in-app messages",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
name: import__.ChannelsDefinition.fieldNameMap.id,
|
|
39
|
+
type: "uuid",
|
|
40
|
+
primaryKey: true,
|
|
41
|
+
allowNull: false,
|
|
42
|
+
interface: "uuid",
|
|
43
|
+
uiSchema: {
|
|
44
|
+
type: "string",
|
|
45
|
+
title: '{{t("ID")}}',
|
|
46
|
+
"x-component": "Input",
|
|
47
|
+
"x-read-pretty": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: import__.ChannelsDefinition.fieldNameMap.senderId,
|
|
52
|
+
type: "uuid",
|
|
53
|
+
allowNull: false,
|
|
54
|
+
interface: "uuid",
|
|
55
|
+
uiSchema: {
|
|
56
|
+
type: "string",
|
|
57
|
+
title: '{{t("Sender ID")}}',
|
|
58
|
+
"x-component": "Input",
|
|
59
|
+
"x-read-pretty": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "userId",
|
|
64
|
+
type: "bigInt",
|
|
65
|
+
uiSchema: {
|
|
66
|
+
type: "number",
|
|
67
|
+
"x-component": "Input",
|
|
68
|
+
title: '{{t("User ID")}}',
|
|
69
|
+
required: true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: import__.ChannelsDefinition.fieldNameMap.title,
|
|
74
|
+
type: "text",
|
|
75
|
+
interface: "input",
|
|
76
|
+
uiSchema: {
|
|
77
|
+
type: "string",
|
|
78
|
+
"x-component": "Input",
|
|
79
|
+
title: '{{t("Title")}}',
|
|
80
|
+
required: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "latestMsgId",
|
|
85
|
+
type: "string",
|
|
86
|
+
interface: "input"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
};
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
channelsCollection
|
|
93
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export interface Channel {
|
|
10
|
+
name: string;
|
|
11
|
+
title: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
unreadMsgCnt: number;
|
|
14
|
+
totalMsgCnt: number;
|
|
15
|
+
latestMsgReceiveTimestamp: number;
|
|
16
|
+
latestMsgTitle: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Message {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
userId: string;
|
|
22
|
+
channelName: string;
|
|
23
|
+
content: string;
|
|
24
|
+
receiveTimestamp: number;
|
|
25
|
+
status: 'read' | 'unread';
|
|
26
|
+
url: string;
|
|
27
|
+
options: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export type SSEData = {
|
|
30
|
+
type: 'message:created';
|
|
31
|
+
data: Message;
|
|
32
|
+
};
|
|
33
|
+
export interface InAppMessageFormValues {
|
|
34
|
+
receivers: string[];
|
|
35
|
+
content: string;
|
|
36
|
+
senderName: string;
|
|
37
|
+
senderId: string;
|
|
38
|
+
url: string;
|
|
39
|
+
title: string;
|
|
40
|
+
options: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
export declare const InAppMessagesDefinition: {
|
|
43
|
+
readonly name: "notificationInAppMessages";
|
|
44
|
+
readonly fieldNameMap: {
|
|
45
|
+
readonly id: "id";
|
|
46
|
+
readonly channelName: "channelName";
|
|
47
|
+
readonly userId: "userId";
|
|
48
|
+
readonly content: "content";
|
|
49
|
+
readonly status: "status";
|
|
50
|
+
readonly title: "title";
|
|
51
|
+
readonly receiveTimestamp: "receiveTimestamp";
|
|
52
|
+
readonly options: "options";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const ChannelsDefinition: {
|
|
56
|
+
readonly name: "notificationInAppChannels";
|
|
57
|
+
readonly fieldNameMap: {
|
|
58
|
+
readonly id: "id";
|
|
59
|
+
readonly senderId: "senderId";
|
|
60
|
+
readonly title: "title";
|
|
61
|
+
readonly lastMsgId: "lastMsgId";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const inAppTypeName = "in-app-message";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var types_exports = {};
|
|
28
|
+
__export(types_exports, {
|
|
29
|
+
ChannelsDefinition: () => ChannelsDefinition,
|
|
30
|
+
InAppMessagesDefinition: () => InAppMessagesDefinition,
|
|
31
|
+
inAppTypeName: () => inAppTypeName
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(types_exports);
|
|
34
|
+
const InAppMessagesDefinition = {
|
|
35
|
+
name: "notificationInAppMessages",
|
|
36
|
+
fieldNameMap: {
|
|
37
|
+
id: "id",
|
|
38
|
+
channelName: "channelName",
|
|
39
|
+
userId: "userId",
|
|
40
|
+
content: "content",
|
|
41
|
+
status: "status",
|
|
42
|
+
title: "title",
|
|
43
|
+
receiveTimestamp: "receiveTimestamp",
|
|
44
|
+
options: "options"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const ChannelsDefinition = {
|
|
48
|
+
name: "notificationInAppChannels",
|
|
49
|
+
fieldNameMap: {
|
|
50
|
+
id: "id",
|
|
51
|
+
senderId: "senderId",
|
|
52
|
+
title: "title",
|
|
53
|
+
lastMsgId: "lastMsgId"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const inAppTypeName = "in-app-message";
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
ChannelsDefinition,
|
|
60
|
+
InAppMessagesDefinition,
|
|
61
|
+
inAppTypeName
|
|
62
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CollectionOptions } from '@nocobase/client';
|
|
10
|
+
export declare const messageCollection: CollectionOptions;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var messages_exports = {};
|
|
28
|
+
__export(messages_exports, {
|
|
29
|
+
messageCollection: () => messageCollection
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(messages_exports);
|
|
32
|
+
var import_index = require("./index");
|
|
33
|
+
const messageCollection = {
|
|
34
|
+
name: import_index.InAppMessagesDefinition.name,
|
|
35
|
+
title: "in-app messages",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.id,
|
|
39
|
+
type: "uuid",
|
|
40
|
+
primaryKey: true,
|
|
41
|
+
allowNull: false,
|
|
42
|
+
interface: "uuid",
|
|
43
|
+
uiSchema: {
|
|
44
|
+
type: "string",
|
|
45
|
+
title: '{{t("ID")}}',
|
|
46
|
+
"x-component": "Input",
|
|
47
|
+
"x-read-pretty": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.userId,
|
|
52
|
+
type: "bigInt",
|
|
53
|
+
uiSchema: {
|
|
54
|
+
type: "number",
|
|
55
|
+
"x-component": "Input",
|
|
56
|
+
title: '{{t("User ID")}}',
|
|
57
|
+
required: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "channel",
|
|
62
|
+
type: "belongsTo",
|
|
63
|
+
interface: "m2o",
|
|
64
|
+
target: "notificationChannels",
|
|
65
|
+
targetKey: "name",
|
|
66
|
+
foreignKey: import_index.InAppMessagesDefinition.fieldNameMap.channelName,
|
|
67
|
+
uiSchema: {
|
|
68
|
+
type: "string",
|
|
69
|
+
"x-component": "AssociationField",
|
|
70
|
+
title: '{{t("Channel")}}'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.title,
|
|
75
|
+
type: "text",
|
|
76
|
+
uiSchema: {
|
|
77
|
+
type: "string",
|
|
78
|
+
"x-component": "Input",
|
|
79
|
+
title: '{{t("Title")}}',
|
|
80
|
+
required: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.content,
|
|
85
|
+
type: "text",
|
|
86
|
+
interface: "string",
|
|
87
|
+
uiSchema: {
|
|
88
|
+
type: "string",
|
|
89
|
+
title: '{{t("Content")}}',
|
|
90
|
+
"x-component": "Input"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.status,
|
|
95
|
+
type: "string",
|
|
96
|
+
uiSchema: {
|
|
97
|
+
type: "string",
|
|
98
|
+
"x-component": "Input",
|
|
99
|
+
title: '{{t("Status")}}',
|
|
100
|
+
required: true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "createdAt",
|
|
105
|
+
type: "date",
|
|
106
|
+
interface: "createdAt",
|
|
107
|
+
field: "createdAt",
|
|
108
|
+
uiSchema: {
|
|
109
|
+
type: "datetime",
|
|
110
|
+
title: '{{t("Created at")}}',
|
|
111
|
+
"x-component": "DatePicker",
|
|
112
|
+
"x-component-props": {},
|
|
113
|
+
"x-read-pretty": true
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.receiveTimestamp,
|
|
118
|
+
type: "bigInt"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: import_index.InAppMessagesDefinition.fieldNameMap.options,
|
|
122
|
+
type: "json"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
};
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
messageCollection
|
|
129
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export type SSEData = {
|
|
10
|
+
type: 'message:created';
|
|
11
|
+
data: {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
content: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
receiveTimestamp: number;
|
|
17
|
+
channelName: string;
|
|
18
|
+
status: 'read' | 'unread';
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var sse_exports = {};
|
|
24
|
+
module.exports = __toCommonJS(sse_exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nocobase/plugin-notification-in-app-message",
|
|
3
|
+
"version": "1.4.0-alpha.20241027230531",
|
|
4
|
+
"displayName": "Notification: In-app message",
|
|
5
|
+
"displayName.zh-CN": "通知:站内信",
|
|
6
|
+
"description": "It supports users in receiving real-time message notifications within the NocoBase application.",
|
|
7
|
+
"description.zh-CN": "支持用户在 NocoBase 应用内实时接收消息通知。",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"Notification"
|
|
10
|
+
],
|
|
11
|
+
"main": "dist/server/index.js",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"immer": "^10.1.1"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@formily/reactive": "^2",
|
|
17
|
+
"@formily/reactive-react": "^2",
|
|
18
|
+
"@nocobase/client": "1.x",
|
|
19
|
+
"@nocobase/plugin-notification-manager": "1.x",
|
|
20
|
+
"@nocobase/server": "1.x",
|
|
21
|
+
"@nocobase/test": "1.x",
|
|
22
|
+
"react-router-dom": "^6.x"
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "6f363bf299af23580d68c8b0659e4d31d70f4687"
|
|
25
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|