feat: initialize governed postbox module

This commit is contained in:
2026-07-29 14:16:29 +02:00
parent 19216e5043
commit d848a9a503
31 changed files with 9776 additions and 1 deletions
+151
View File
@@ -0,0 +1,151 @@
import { createElement, lazy } from "react";
import {
hasScope,
type AdminSectionsUiCapability,
type DashboardWidgetsUiCapability,
type PlatformWebModule
} from "@govoplan/core-webui";
import PostboxInboxWidget from "./features/postbox/PostboxInboxWidget";
import "./styles/postbox.css";
const PostboxPage = lazy(() => import("./features/postbox/PostboxPage"));
const PostboxAdminPanel = lazy(
() => import("./features/postbox/PostboxAdminPanel")
);
const readScope = ["postbox:postbox:read"];
const postboxDashboardWidgets: DashboardWidgetsUiCapability = {
widgets: [
{
id: "postbox.inbox",
surfaceId: "postbox.widget.inbox",
title: "Postbox inbox",
description: "Unread messages across accessible Postboxes.",
moduleId: "postbox",
category: "Communication",
order: 55,
defaultVisible: false,
defaultSize: "medium",
supportedSizes: ["medium", "wide"],
anyOf: readScope,
refreshIntervalMs: 30_000,
defaultConfiguration: {
maxItems: 5
},
configurationFields: [
{
id: "maxItems",
label: "Maximum messages",
kind: "number",
min: 1,
max: 12,
step: 1,
required: true
}
],
render: ({ settings, refreshKey, configuration }) =>
createElement(PostboxInboxWidget, {
settings,
refreshKey,
configuration
})
}
]
};
const postboxAdminSections: AdminSectionsUiCapability = {
sections: [
{
id: "postbox",
label: "Postboxes",
group: "TENANT",
order: 45,
surfaceId: "postbox.admin.templates",
anyOf: [
"postbox:binding:admin",
"postbox:template:admin"
],
render: ({ settings, auth }) =>
createElement(PostboxAdminPanel, {
settings,
canManageBindings: hasScope(auth, "postbox:binding:admin"),
canManageTemplates: hasScope(auth, "postbox:template:admin")
})
}
]
};
export const postboxModule: PlatformWebModule = {
id: "postbox",
label: "Postbox",
version: "0.1.0",
dependencies: ["identity", "organizations", "idm"],
optionalDependencies: [
"access",
"audit",
"campaigns",
"files",
"mail",
"notifications",
"policy",
"portal",
"views",
"workflow"
],
navItems: [
{
to: "/postbox",
label: "Postbox",
iconName: "inbox",
anyOf: readScope,
order: 58
}
],
routes: [
{
path: "/postbox",
anyOf: readScope,
order: 58,
surfaceId: "postbox.inbox.messages",
render: ({ settings, auth }) =>
createElement(PostboxPage, { settings, auth })
}
],
viewSurfaces: [
{
id: "postbox.inbox.directory",
moduleId: "postbox",
kind: "section",
label: "Postbox directory",
order: 10
},
{
id: "postbox.inbox.messages",
moduleId: "postbox",
kind: "section",
label: "Postbox messages",
order: 20
},
{
id: "postbox.widget.inbox",
moduleId: "postbox",
kind: "section",
label: "Postbox inbox widget",
order: 25
},
{
id: "postbox.admin.templates",
moduleId: "postbox",
kind: "section",
label: "Postbox templates and bindings",
order: 30
}
],
uiCapabilities: {
"admin.sections": postboxAdminSections,
"dashboard.widgets": postboxDashboardWidgets
}
};
export default postboxModule;