feat: contribute governed campaign reports

This commit is contained in:
2026-08-02 05:29:34 +02:00
parent 2afdd38128
commit 4eeba62bbc
7 changed files with 404 additions and 29 deletions
-2
View File
@@ -24,7 +24,6 @@ const reportRead = ["campaigns:report:read"];
const campaignModuleRead = [...campaignRead, ...reportRead];
// Preserve the former /operator route identity for saved View projections.
const operatorQueueSurface = "campaigns.route.operator";
// Preserve the former /reports route identity for saved View projections.
const reportsSurface = "campaigns.route.reports";
const translations = {
en: generatedTranslations.en,
@@ -99,7 +98,6 @@ export const campaignModule: PlatformWebModule = {
{ path: "/campaigns", anyOf: campaignModuleRead, order: 20, render: ({ settings, auth }) => createElement(CampaignModuleLandingRoute, { settings, auth }) },
{ path: "/operator", anyOf: OPERATOR_QUEUE_ROUTE_SCOPES, allOf: campaignRead, order: 21, surfaceId: operatorQueueSurface, render: () => createElement(Navigate, { to: "/campaigns/queue", replace: true }) },
{ path: "/campaigns/queue", anyOf: OPERATOR_QUEUE_ROUTE_SCOPES, allOf: campaignRead, order: 21, surfaceId: operatorQueueSurface, render: ({ settings, auth }) => createElement(CampaignModulePage, { active: "queue", settings, auth }) },
{ path: "/reports", anyOf: reportRead, order: 22, surfaceId: reportsSurface, render: () => createElement(Navigate, { to: "/campaigns/reports", replace: true }) },
{ path: "/campaigns/reports", anyOf: reportRead, order: 22, surfaceId: reportsSurface, render: ({ settings, auth }) => createElement(CampaignModulePage, { active: "reports", settings, auth }) },
{ path: "/campaigns/:campaignId/*", anyOf: campaignRead, order: 22, render: ({ settings, auth }) => createElement(CampaignResourceRoute, { settings, auth }) },
{ path: "/templates", order: 90, render: () => createElement(TemplatesPage) }],
@@ -77,7 +77,7 @@ assert.match(campaignModulePage, /active === "reports"[\s\S]*<AggregateReportsPa
assert.match(moduleSource, /path: "\/campaigns\/queue"/);
assert.match(moduleSource, /path: "\/operator"[\s\S]*createElement\(Navigate, \{ to: "\/campaigns\/queue", replace: true \}\)/);
assert.match(moduleSource, /path: "\/campaigns\/reports"/);
assert.match(moduleSource, /path: "\/reports"[\s\S]*createElement\(Navigate, \{ to: "\/campaigns\/reports", replace: true \}\)/);
assert.doesNotMatch(moduleSource, /path: "\/reports"/);
assert.doesNotMatch(moduleSource, /to: "\/operator"/);
assert.doesNotMatch(moduleSource, /to: "\/reports"/);
assert.ok(
@@ -89,14 +89,10 @@ assert.equal(
2,
"the legacy redirect and canonical queue route share one configurable view surface"
);
assert.ok(
moduleSource.indexOf('{ path: "/reports"') < moduleSource.indexOf('{ path: "/campaigns/reports"'),
"the canonical Campaign reports route must replace the legacy alias in the shared view-surface catalogue"
);
assert.equal(
moduleSource.split("surfaceId: reportsSurface").length - 1,
2,
"the legacy redirect and canonical reports route share one configurable view surface"
1,
"Campaign contributes only its module-owned report route; Reporting owns /reports"
);
assert.equal(
moduleSource.split("anyOf: campaignModuleRead").length - 1,