feat: compose stable product surfaces
Module Package Release / publish-packages (push) Successful in 13s
Module Package Release / publish-packages (push) Successful in 13s
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
visibleRoutesForProjection
|
||||
} from "../src/platform/views";
|
||||
import { groupNavigationItems } from "../src/platform/productAreas";
|
||||
import { composeProductSurfaces } from "../src/platform/productSurfaces";
|
||||
import { hasAnyScope, scopeGrants } from "../src/utils/permissions";
|
||||
|
||||
function assert(condition: unknown, message: string): void {
|
||||
@@ -193,6 +194,72 @@ assert(
|
||||
"flat navigation should retain every authorized destination"
|
||||
);
|
||||
|
||||
const productSurfaceExplanation = {
|
||||
reason: "authorization" as const,
|
||||
title: "Messages are unavailable",
|
||||
description: "No message source is available for the current responsibility.",
|
||||
resolution: "Ask the responsible administrator to review the assignment."
|
||||
};
|
||||
const messageSurfaceModules: PlatformWebModule[] = [
|
||||
{
|
||||
id: "mail",
|
||||
label: "Mail",
|
||||
version: "test",
|
||||
productSurfaces: [{
|
||||
contractVersion: "1",
|
||||
id: "communication.messages",
|
||||
moduleId: "mail",
|
||||
label: "Messages",
|
||||
description: "Read messages without merging channel custody.",
|
||||
iconName: "mail",
|
||||
entryPath: "/messages",
|
||||
routePath: "/mail",
|
||||
surfaceIds: ["mail.route.mail"],
|
||||
presentations: ["task", "reader"],
|
||||
capabilityIds: [],
|
||||
searchSourceIds: ["mail.mailbox_messages"],
|
||||
helpContextIds: ["mail.quick_access.messages"],
|
||||
documentationTopicIds: ["mail.quick-access-and-product-area"],
|
||||
allOf: [],
|
||||
anyOf: ["mail:mailbox:read"],
|
||||
aliases: ["/inbox"],
|
||||
order: 10,
|
||||
unavailable: productSurfaceExplanation
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: "postbox",
|
||||
label: "Postbox",
|
||||
version: "test",
|
||||
productSurfaceMetadata: [{
|
||||
contract_version: "1",
|
||||
id: "communication.messages",
|
||||
module_id: "postbox",
|
||||
label: "Messages",
|
||||
description: "Read messages without merging channel custody.",
|
||||
icon: "mail",
|
||||
entry_path: "/messages",
|
||||
route_path: "/postbox",
|
||||
surface_ids: ["postbox.route.postbox"],
|
||||
presentations: ["task", "reader"],
|
||||
capability_ids: [],
|
||||
search_source_ids: ["postbox.messages"],
|
||||
help_context_ids: ["postbox.quick_access.messages"],
|
||||
documentation_topic_ids: ["postbox.quick-access-and-product-area"],
|
||||
required_all: [],
|
||||
required_any: ["postbox:message:read"],
|
||||
aliases: ["/inbox"],
|
||||
order: 20,
|
||||
unavailable: productSurfaceExplanation
|
||||
}]
|
||||
}
|
||||
];
|
||||
const composedMessages = composeProductSurfaces(messageSurfaceModules);
|
||||
assert(composedMessages.length === 1, "related owner routes should compose into one product identity");
|
||||
assert(composedMessages[0]?.entryPath === "/messages", "the composed identity should keep its stable entry path");
|
||||
assert(composedMessages[0]?.contributors.map((item) => item.moduleId).join(",") === "mail,postbox", "composition should retain ordered technical provenance");
|
||||
assert(composedMessages[0]?.aliases.join(",") === "/inbox", "migration aliases should be de-duplicated across owners");
|
||||
|
||||
const viewAwareFiles: PlatformWebModule = {
|
||||
...files,
|
||||
navItems: [{ to: "/files", label: "Files", order: 20, anyOf: ["files:file:read"] }],
|
||||
|
||||
Reference in New Issue
Block a user