Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -7,7 +7,10 @@ const MAX_EXPORT_PAGE_SIZE = 100000;
|
||||
const PAGE_SIZE_OPTIONS = [5, 10, 25, 50, 100];
|
||||
const VERSION = "1.7.0";
|
||||
|
||||
export const DARK_MODE_IN_APP = true;
|
||||
// HiveGrid ships without a dark theme for now: disabling this hides the
|
||||
// light/dark toggle in the profile dropdowns (SubframeAppShell + nav-user)
|
||||
// and keeps the app/admin area from applying the `dark` root class (root.tsx).
|
||||
export const DARK_MODE_IN_APP = false;
|
||||
// export const DARK_SIDEBAR_IN_LIGHT_MODE = true;
|
||||
|
||||
export default {
|
||||
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { repoPathExists } from "~/utils/testing/repoPaths";
|
||||
|
||||
type FeatureManifest = {
|
||||
id: string;
|
||||
classification: string;
|
||||
pruning: {
|
||||
action: string;
|
||||
};
|
||||
};
|
||||
|
||||
const rootDir = process.cwd();
|
||||
const docs = {
|
||||
migrationStatus: "docs/architecture-migration-status.md",
|
||||
featureInventory: "docs/feature-inventory.md",
|
||||
manifestReadme: "docs/feature-manifests/README.md",
|
||||
agentEntrypoints: "docs/agent-entrypoints.md",
|
||||
} as const;
|
||||
|
||||
const requiredArchitectureClosureSources = [
|
||||
"docs/architecture-migration-status.md",
|
||||
"docs/feature-inventory.md",
|
||||
"docs/feature-manifests/",
|
||||
];
|
||||
|
||||
const documentedS04Evidence = ["apps/web/app/utils/build/bundleScan.ts", "apps/web/app/utils/build/manualChunks.ts"];
|
||||
|
||||
const requiredS04Evidence = [...documentedS04Evidence, "apps/web/app/utils/build/viteConfigIntegration.test.ts"];
|
||||
|
||||
function readProjectFile(filePath: string) {
|
||||
return fs.readFileSync(path.join(rootDir, filePath), "utf8");
|
||||
}
|
||||
|
||||
function readManifest(fileName: string) {
|
||||
return JSON.parse(readProjectFile(path.join("docs/feature-manifests", fileName))) as FeatureManifest;
|
||||
}
|
||||
|
||||
describe("Architecture Closure closure documentation", () => {
|
||||
it("keeps architecture status anchored to boundaries, pruning manifests and S04 evidence", () => {
|
||||
const status = readProjectFile(docs.migrationStatus);
|
||||
|
||||
expect(status).toContain("## Architecture Closure final closure status");
|
||||
expect(status).toMatch(/handoff contract/i);
|
||||
expect(status).toContain("apps/api");
|
||||
expect(status).toContain("apps/worker");
|
||||
expect(status).toContain("packages/db");
|
||||
expect(status).toContain("packages/mail");
|
||||
expect(status).toContain("docs/feature-manifests/");
|
||||
expect(status).toContain("docs/feature-inventory.md");
|
||||
expect(status).toContain("core`, `plugin-candidate`, `remove-candidate");
|
||||
documentedS04Evidence.forEach((evidencePath) => {
|
||||
expect(status, evidencePath).toContain(evidencePath);
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the feature inventory aligned with Architecture Closure status and pruning actions", () => {
|
||||
const inventory = readProjectFile(docs.featureInventory);
|
||||
|
||||
expect(inventory).toContain("docs/architecture-migration-status.md");
|
||||
expect(inventory).toContain("docs/feature-manifests/");
|
||||
expect(inventory).toContain("`core` bleibt die aktive Boilerplate-Basis");
|
||||
expect(inventory).toContain("`product-core` beschreibt Blueprint-, Plan-, Custom-Plan-, Tenant-Override- und Tenant-Rollen-Gates");
|
||||
expect(inventory).toContain("`plugin-candidate` beschreibt nur noch Extraktionsvertraege");
|
||||
expect(inventory).toContain("`remove-candidate` beschreibt Loesch- oder Review-Vertraege");
|
||||
expect(inventory).toContain("API-Split");
|
||||
expect(inventory).toContain("Worker/API/Mail-Split");
|
||||
});
|
||||
|
||||
it("documents the executor-facing manifest contract and source alignment", () => {
|
||||
const readme = readProjectFile(docs.manifestReadme);
|
||||
|
||||
requiredArchitectureClosureSources.forEach((sourcePath) => {
|
||||
expect(readme, sourcePath).toContain(sourcePath);
|
||||
});
|
||||
expect(readme).toContain("current API, worker, package, pruning, and bundle handoff status");
|
||||
expect(readme).toContain("machine-readable Core/Plugin/Removal contract");
|
||||
expect(readme).toContain("ownership, dependencies, configuration, provider, worker, UAT, and pruning boundaries");
|
||||
expect(readme).toContain("pruning.action");
|
||||
expect(readme).toContain("keep`, `extract-plugin`, `remove`, or `review");
|
||||
});
|
||||
|
||||
it("points agents at every canonical Architecture Closure planning source before feature work", () => {
|
||||
const entrypoints = readProjectFile(docs.agentEntrypoints);
|
||||
|
||||
expect(entrypoints).toContain("Architecture Closure closure/status contract");
|
||||
expect(entrypoints).toContain("docs/architecture-migration-status.md");
|
||||
expect(entrypoints).toContain("docs/feature-inventory.md");
|
||||
expect(entrypoints).toContain("docs/feature-manifests/*.json");
|
||||
expect(entrypoints).toContain("before planning implementation, extraction, or removal work");
|
||||
});
|
||||
|
||||
it("keeps the complete S04 bundle evidence set present for future verification", () => {
|
||||
requiredS04Evidence.forEach((evidencePath) => {
|
||||
expect(repoPathExists(evidencePath), evidencePath).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Architecture Closure feature manifest pruning contract", () => {
|
||||
const manifestDir = path.join(rootDir, "docs/feature-manifests");
|
||||
const manifestFiles = fs
|
||||
.readdirSync(manifestDir)
|
||||
.filter((file) => file.endsWith(".json") && file !== "schema.json")
|
||||
.sort();
|
||||
|
||||
it("keeps every non-schema feature manifest JSON-parseable", () => {
|
||||
expect(manifestFiles.length).toBeGreaterThan(0);
|
||||
|
||||
manifestFiles.forEach((file) => {
|
||||
expect(() => JSON.parse(readProjectFile(path.join("docs/feature-manifests", file))), file).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes the canonical core/plugin/removal pruning actions", () => {
|
||||
expect(readManifest("core.json")).toMatchObject({
|
||||
id: "core",
|
||||
classification: "core",
|
||||
pruning: { action: "keep" },
|
||||
});
|
||||
expect(readManifest("plugin-candidates.json")).toMatchObject({
|
||||
id: "plugin-candidates",
|
||||
classification: "plugin-candidate",
|
||||
pruning: { action: "extract-plugin" },
|
||||
});
|
||||
expect(readManifest("remove-candidates.json")).toMatchObject({
|
||||
id: "remove-candidates",
|
||||
classification: "remove-candidate",
|
||||
pruning: { action: "remove" },
|
||||
});
|
||||
});
|
||||
});
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const rootDir = process.cwd();
|
||||
const docs = {
|
||||
handoffSummary: "docs/archive/architecture-handoff-summary.md",
|
||||
agentEntrypoints: "docs/agent-entrypoints.md",
|
||||
} as const;
|
||||
|
||||
const requiredCanonicalSources = [
|
||||
"docs/architecture-migration-status.md",
|
||||
"docs/feature-inventory.md",
|
||||
"docs/feature-manifests/README.md",
|
||||
"docs/feature-manifests/*.json",
|
||||
"docs/agent-entrypoints.md",
|
||||
"apps/web/app/application/architectureClosureDocs.test.ts",
|
||||
"apps/web/app/application/featureManifests.test.ts",
|
||||
];
|
||||
|
||||
const requiredGateCommands = [
|
||||
"pnpm exec vitest run apps/web/app/application/architectureClosureDocs.test.ts apps/web/app/application/featureManifests.test.ts",
|
||||
"pnpm exec eslint --ext .tsx,.ts",
|
||||
"pnpm typecheck",
|
||||
];
|
||||
|
||||
function readProjectFile(filePath: string) {
|
||||
return fs.readFileSync(path.join(rootDir, filePath), "utf8");
|
||||
}
|
||||
|
||||
describe("Architecture Closure handoff summary contract", () => {
|
||||
it("keeps the executor-facing handoff summary present", () => {
|
||||
expect(fs.existsSync(path.join(rootDir, docs.handoffSummary))).toBe(true);
|
||||
});
|
||||
|
||||
it("anchors the handoff to every canonical closure source", () => {
|
||||
const handoff = readProjectFile(docs.handoffSummary);
|
||||
|
||||
requiredCanonicalSources.forEach((sourcePath) => {
|
||||
expect(handoff, sourcePath).toContain(sourcePath);
|
||||
});
|
||||
});
|
||||
|
||||
it("documents Architecture Closure requirement coverage and prior-slice closure continuity", () => {
|
||||
const handoff = readProjectFile(docs.handoffSummary);
|
||||
|
||||
expect(handoff).toContain("R001");
|
||||
expect(handoff).toContain("R002");
|
||||
expect(handoff).toMatch(/S04 bundle\/performance continuity/i);
|
||||
expect(handoff).toMatch(/sequential follow-up order/i);
|
||||
expect(handoff).toMatch(/avoiding any assumption that downstream feature slices can run in parallel/i);
|
||||
});
|
||||
|
||||
it("preserves the non-E2E full gate and manual build follow-up wording", () => {
|
||||
const handoff = readProjectFile(docs.handoffSummary);
|
||||
|
||||
requiredGateCommands.forEach((command) => {
|
||||
expect(handoff, command).toContain(command);
|
||||
});
|
||||
expect(handoff).toMatch(/No E2E, browser, Cypress, or Playwright execution/i);
|
||||
expect(handoff).toMatch(/pnpm build.*optional manual follow-up/i);
|
||||
expect(handoff).toMatch(/not an Auto-Mode completion gate/i);
|
||||
});
|
||||
|
||||
it("keeps the agent entrypoint pointed at the Architecture Closure handoff in closure/status context", () => {
|
||||
const entrypoints = readProjectFile(docs.agentEntrypoints);
|
||||
|
||||
expect(entrypoints).toContain("Architecture Closure closure/status contract");
|
||||
expect(entrypoints).toContain(docs.handoffSummary);
|
||||
});
|
||||
});
|
||||
+29
-1
@@ -5,11 +5,39 @@ import { CookieCategory } from "./CookieCategory";
|
||||
const allApplicationCookies: ApplicationCookie[] = [
|
||||
{
|
||||
category: CookieCategory.REQUIRED,
|
||||
name: "hivegrid_session",
|
||||
name: "__Host-hivegrid_app_session",
|
||||
expiry: "1 month",
|
||||
expiryKey: "cookies.expiry.oneMonth",
|
||||
descriptionKey: "cookies.items.session.description",
|
||||
},
|
||||
{
|
||||
category: CookieCategory.REQUIRED,
|
||||
name: "__Host-hivegrid_admin_session",
|
||||
expiry: "1 month",
|
||||
expiryKey: "cookies.expiry.oneMonth",
|
||||
descriptionKey: "cookies.items.session.description",
|
||||
},
|
||||
{
|
||||
category: CookieCategory.REQUIRED,
|
||||
name: "__Host-hivegrid_trusted_device",
|
||||
expiry: "1 month",
|
||||
expiryKey: "cookies.expiry.oneMonth",
|
||||
descriptionKey: "cookies.items.trustedDevice.description",
|
||||
},
|
||||
{
|
||||
category: CookieCategory.REQUIRED,
|
||||
name: "__Host-hivegrid_admin_sso_challenge",
|
||||
expiry: "10 minutes",
|
||||
expiryKey: "cookies.expiry.tenMinutes",
|
||||
descriptionKey: "cookies.items.adminSsoChallenge.description",
|
||||
},
|
||||
{
|
||||
category: CookieCategory.REQUIRED,
|
||||
name: "__Host-hivegrid_admin_sso_id_token",
|
||||
expiry: "15 minutes",
|
||||
expiryKey: "cookies.expiry.fifteenMinutes",
|
||||
descriptionKey: "cookies.items.adminSsoIdToken.description",
|
||||
},
|
||||
{
|
||||
category: CookieCategory.FUNCTIONAL,
|
||||
name: "crisp-client/*",
|
||||
|
||||
+2
-4
@@ -1,6 +1,4 @@
|
||||
import { UserWithoutPassword } from "~/utils/db/users.db.server";
|
||||
|
||||
export type ImpersonatingSessionDto = {
|
||||
fromUser: UserWithoutPassword;
|
||||
toUser: UserWithoutPassword;
|
||||
fromUser: { id: string; email: string };
|
||||
toUser: { id: string; email: string };
|
||||
};
|
||||
+70
-8
@@ -7,10 +7,6 @@ export const DefaultPermissions = [
|
||||
"admin.account.users",
|
||||
"admin.account.subscription",
|
||||
"admin.account.delete",
|
||||
"admin.accountTypes.view",
|
||||
"admin.accountTypes.create",
|
||||
"admin.accountTypes.update",
|
||||
"admin.accountTypes.delete",
|
||||
"admin.users.view",
|
||||
"admin.users.impersonate",
|
||||
"admin.users.changePassword",
|
||||
@@ -51,6 +47,10 @@ export const DefaultPermissions = [
|
||||
"admin.featureFlags.manage",
|
||||
"admin.marketing.leads.view",
|
||||
"admin.marketing.leads.manage",
|
||||
"admin.leads.read_own",
|
||||
"admin.leads.read_all",
|
||||
"admin.leads.write",
|
||||
"admin.leads.admin",
|
||||
"admin.marketing.integrations.view",
|
||||
"admin.marketing.integrations.manage",
|
||||
"admin.marketing.funnels.view",
|
||||
@@ -65,9 +65,6 @@ export const DefaultPermissions = [
|
||||
"admin.kb.create",
|
||||
"admin.kb.update",
|
||||
"admin.kb.delete",
|
||||
"admin.settings.cookies.view",
|
||||
"admin.settings.cookies.create",
|
||||
"admin.settings.cookies.update",
|
||||
"admin.settings.general.view",
|
||||
"admin.settings.general.update",
|
||||
"admin.settings.authentication.view",
|
||||
@@ -113,6 +110,15 @@ export const DefaultPermissions = [
|
||||
"app.settings.auditTrails.view",
|
||||
"app.plugins.use",
|
||||
"app.plugins.manage",
|
||||
// P26 Customer Portal (VA-P26a/b) — tenant-side portal management only.
|
||||
// PortalUser identities never receive workspace permissions.
|
||||
"portal.read",
|
||||
"portal.manage_users",
|
||||
"portal.manage_access",
|
||||
"portal.delete_user",
|
||||
"portal.activity.read",
|
||||
"portal.activity.manage",
|
||||
"portal.admin",
|
||||
// P4 Files (AK-P4a) — see packages/db permissions-seed (same list).
|
||||
"files.read_own",
|
||||
"files.read_all",
|
||||
@@ -147,6 +153,10 @@ export const DefaultPermissions = [
|
||||
"projects.manage_members",
|
||||
"projects.delete",
|
||||
"projects.admin",
|
||||
// WF-P8 S02-N: read notes marked "Nur Innendienst".
|
||||
"projects.read_internal_notes",
|
||||
// WF-P8 M04: hand a project over into the successor pipeline.
|
||||
"projects.handover",
|
||||
// P9 Plantafel + Abnahme (R-P9b) — see packages/db permissions-seed.
|
||||
"plantafel.read_own",
|
||||
"plantafel.read_all",
|
||||
@@ -164,6 +174,7 @@ export const DefaultPermissions = [
|
||||
"hr.write",
|
||||
"hr.admin",
|
||||
"hr.passwordsafe.use",
|
||||
"hr.passwordsafe.export",
|
||||
"hr.passwordsafe.admin",
|
||||
// P17 HR-Hub workflows (AK-P17b) — see packages/db permissions-seed (same list).
|
||||
"hr.leave.approve",
|
||||
@@ -189,6 +200,21 @@ export const DefaultPermissions = [
|
||||
"integrations.manual_sync",
|
||||
"integrations.view_logs",
|
||||
"integrations.admin",
|
||||
// P15 Telephony (AK-P15a) — see packages/db permissions-seed (same list).
|
||||
// read_own/call are user capabilities; read_all/manage are tenant-admin
|
||||
// capabilities for call history, OAuth setup, bindings and match overrides.
|
||||
"telephony.read_own",
|
||||
"telephony.read_all",
|
||||
"telephony.call",
|
||||
"telephony.manage",
|
||||
// P15 Team-Chat (AK-P15b) — membership-scoped collaboration plus explicit
|
||||
// tenant-wide channel administration and audited read access.
|
||||
"chat.read_own_channels",
|
||||
"chat.write",
|
||||
"chat.create_channel",
|
||||
"chat.create_dm",
|
||||
"chat.admin",
|
||||
"chat.read_all_channels",
|
||||
// P16 Calendar-Sync (AK-P16a) — see packages/db permissions-seed (same list).
|
||||
// connect_own: connect/manage your OWN calendar; admin: tenant-wide oversight
|
||||
// + force-disconnect on user offboarding (M25 Block I).
|
||||
@@ -213,7 +239,7 @@ export const DefaultPermissions = [
|
||||
"signature.send",
|
||||
"signature.revoke",
|
||||
"signature.admin",
|
||||
// P11 Global Search (R-P11a) — search.use opens Cmd+K and full search;
|
||||
// P11 Global Search (R-P11a) — search.use opens the desktop/mobile Spotlight search;
|
||||
// search.admin is reserved for reindex/admin controls.
|
||||
"search.use",
|
||||
"search.admin",
|
||||
@@ -224,6 +250,42 @@ export const DefaultPermissions = [
|
||||
"privacy.avv.read",
|
||||
"privacy.avv.accept",
|
||||
"privacy.subprocessors.read",
|
||||
// P28 Admin identity and platform-sales workspace.
|
||||
"admin_identity.users.read",
|
||||
"admin_identity.users.manage",
|
||||
"admin_identity.roles.read",
|
||||
"admin_identity.roles.manage",
|
||||
"admin_identity.sessions.read",
|
||||
"admin_identity.sessions.revoke",
|
||||
"admin_identity.audit.read",
|
||||
"admin_identity.audit.export",
|
||||
"admin_identity.impersonation.start",
|
||||
"admin_identity.tenants.manage",
|
||||
"admin_sales.crm.read",
|
||||
"admin_sales.crm.read_all",
|
||||
"admin_sales.crm.write",
|
||||
"admin_sales.crm.write_all",
|
||||
"admin_sales.crm.assign",
|
||||
"admin_sales.crm.merge",
|
||||
"admin_sales.crm.export",
|
||||
"admin_sales.communication.read_all",
|
||||
"admin_sales.email.connect",
|
||||
"admin_sales.email.send",
|
||||
"admin_sales.email.track",
|
||||
"admin_sales.email.bulk_send",
|
||||
"admin_sales.phone.call",
|
||||
"admin_sales.phone.recording",
|
||||
"admin_sales.sequence.manage",
|
||||
"admin_sales.sequence.enroll",
|
||||
"admin_sales.booking.manage",
|
||||
"admin_sales.quote.manage",
|
||||
"admin_sales.quote.approve",
|
||||
"admin_sales.signature.manage",
|
||||
"admin_sales.reporting.read",
|
||||
"admin_sales.reporting.read_all",
|
||||
"admin_sales.reporting.manage",
|
||||
"admin_sales.automation.manage",
|
||||
"admin_sales.integrations.manage",
|
||||
// "entity.{name}.view",
|
||||
// "entity.{name}.read",
|
||||
// "entity.{name}.create",
|
||||
|
||||
+5
-2
@@ -2,7 +2,7 @@ import { SubscriptionPriceDto } from "./SubscriptionPriceDto";
|
||||
import { SubscriptionFeatureDto } from "./SubscriptionFeatureDto";
|
||||
import { PricingModel } from "~/application/enums/subscriptions/PricingModel";
|
||||
import { SubscriptionUsageBasedPriceDto } from "./SubscriptionUsageBasedPriceDto";
|
||||
import { TenantSubscriptionProduct, TenantType } from "@hivegrid/db/prisma-browser";
|
||||
import { TenantSubscriptionProduct } from "@hivegrid/db/prisma-browser";
|
||||
|
||||
export interface SubscriptionProductDto {
|
||||
id?: string;
|
||||
@@ -21,8 +21,11 @@ export interface SubscriptionProductDto {
|
||||
translatedTitle?: string;
|
||||
usageBasedPrices?: SubscriptionUsageBasedPriceDto[];
|
||||
tenantProducts?: TenantSubscriptionProduct[];
|
||||
assignsTenantTypes?: TenantType[];
|
||||
tenantProductCount?: number;
|
||||
billingAddressCollection?: string | null;
|
||||
hasQuantity?: boolean;
|
||||
canBuyAgain?: boolean;
|
||||
kind?: "base_plan" | "recurring_add_on" | "one_time_setup" | "contract_override";
|
||||
code?: string | null;
|
||||
lagoPlanCode?: string | null;
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
export type TenantTypeDto = {
|
||||
id?: string;
|
||||
title: string;
|
||||
titlePlural: string;
|
||||
description: string | null;
|
||||
isDefault?: boolean;
|
||||
subscriptionProducts?: { id?: string; title: string }[];
|
||||
_count?: { tenants: number };
|
||||
};
|
||||
-142
@@ -1,142 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getEnvVariableDefinition } from "@hivegrid/config";
|
||||
import { loadFeatureManifests } from "@hivegrid/plugins";
|
||||
import { queueNames } from "@hivegrid/queue";
|
||||
|
||||
const manifestLoad = await loadFeatureManifests();
|
||||
const manifests = manifestLoad.manifests;
|
||||
|
||||
const requiredPlaybooks = [
|
||||
"docs/agent-entrypoints.md",
|
||||
"docs/agent-playbooks/feature-integration.md",
|
||||
"docs/agent-playbooks/mvp-intake.md",
|
||||
"docs/agent-playbooks/admin-managed-features.md",
|
||||
"docs/agent-playbooks/worker-backed-features.md",
|
||||
];
|
||||
|
||||
function expectStringArray(value: unknown) {
|
||||
expect(Array.isArray(value)).toBe(true);
|
||||
expect((value as unknown[]).every((item) => typeof item === "string")).toBe(true);
|
||||
}
|
||||
|
||||
describe("agent feature planning docs", () => {
|
||||
it("provides the required agent entrypoint and playbooks", () => {
|
||||
requiredPlaybooks.forEach((file) => {
|
||||
expect(fs.existsSync(path.join(process.cwd(), file)), file).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("documents the key concepts agents need before implementation", () => {
|
||||
const entrypoint = fs.readFileSync(path.join(process.cwd(), "docs/agent-entrypoints.md"), "utf8");
|
||||
const featureIntegration = fs.readFileSync(path.join(process.cwd(), "docs/agent-playbooks/feature-integration.md"), "utf8");
|
||||
const adminManaged = fs.readFileSync(path.join(process.cwd(), "docs/agent-playbooks/admin-managed-features.md"), "utf8");
|
||||
const workerBacked = fs.readFileSync(path.join(process.cwd(), "docs/agent-playbooks/worker-backed-features.md"), "utf8");
|
||||
|
||||
expect(entrypoint).toContain("MVP import");
|
||||
expect(featureIntegration).toContain("Feature Integration Playbook");
|
||||
expect(featureIntegration).toContain("Do not expose provider secrets");
|
||||
expect(adminManaged).toContain("admin-managed");
|
||||
expect(adminManaged).toContain("Provider keys must not be sent to tenant loaders");
|
||||
expect(workerBacked).toContain("Browser-backed features require extra constraints");
|
||||
});
|
||||
});
|
||||
|
||||
describe("feature manifests", () => {
|
||||
it("keeps every manifest on the integration-aware schema", () => {
|
||||
manifests.forEach((manifest) => {
|
||||
expect(manifest.schemaVersion).toBe("1.0");
|
||||
expect(manifest.id).toMatch(/^[a-z0-9][a-z0-9-]*$/);
|
||||
expect(manifest.title).toEqual(expect.any(String));
|
||||
expect(["core", "plugin-candidate", "remove-candidate", "mixed"]).toContain(manifest.classification);
|
||||
expect(["active", "proposed", "review-needed"]).toContain(manifest.status);
|
||||
expectStringArray(manifest.rationale);
|
||||
expectStringArray(manifest.codeAreas);
|
||||
expectStringArray(manifest.dependencies);
|
||||
expectStringArray(manifest.consumers);
|
||||
expectStringArray(manifest.boundaries.mustKeep);
|
||||
expectStringArray(manifest.boundaries.mayMoveToPlugin);
|
||||
expectStringArray(manifest.boundaries.mustNotTouch);
|
||||
expectStringArray(manifest.pruning.notes);
|
||||
expectStringArray(manifest.validation.source);
|
||||
expect(manifest.validation.lastReviewed).toMatch(/^\d{4}-\d{2}-\d{2}$/);
|
||||
});
|
||||
});
|
||||
|
||||
it("requires explicit ownership, surfaces, configuration, workers and UAT", () => {
|
||||
manifests.forEach((manifest) => {
|
||||
expect(["tenant-owned", "admin-managed", "hybrid", "system-only"]).toContain(manifest.integration.ownership);
|
||||
expectStringArray(manifest.integration.surfaces.adminRoutes);
|
||||
expectStringArray(manifest.integration.surfaces.tenantRoutes);
|
||||
expectStringArray(manifest.integration.surfaces.publicRoutes);
|
||||
expectStringArray(manifest.integration.surfaces.apiRoutes);
|
||||
expectStringArray(manifest.integration.configuration.admin);
|
||||
expectStringArray(manifest.integration.configuration.tenant);
|
||||
expectStringArray(manifest.integration.configuration.environment);
|
||||
expectStringArray(manifest.integration.configuration.secrets);
|
||||
expect(typeof manifest.integration.workers.required).toBe("boolean");
|
||||
expectStringArray(manifest.integration.workers.queues);
|
||||
expectStringArray(manifest.integration.workers.jobs);
|
||||
expectStringArray(manifest.integration.workers.notes);
|
||||
expectStringArray(manifest.integration.externalProviders);
|
||||
expectStringArray(manifest.integration.permissions);
|
||||
expectStringArray(manifest.integration.auditEvents);
|
||||
expectStringArray(manifest.integration.billingImpacts);
|
||||
expectStringArray(manifest.integration.uat);
|
||||
expect(manifest.integration.uat.length, manifest.id).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("loads real docs manifests without loader diagnostics", () => {
|
||||
expect(manifestLoad.ok).toBe(true);
|
||||
expect(manifestLoad.diagnostics).toEqual([]);
|
||||
});
|
||||
|
||||
it("guards the Feature Manifest manifest decision contract in docs", () => {
|
||||
const inventory = fs.readFileSync(path.join(process.cwd(), "docs/feature-inventory.md"), "utf8");
|
||||
const manifestReadme = fs.readFileSync(path.join(process.cwd(), "docs/feature-manifests/README.md"), "utf8");
|
||||
|
||||
["Manifest-Decision", "Pruned Core", "Full-Boilerplate", "plugin-candidate", "remove-candidate"].forEach((anchor) => {
|
||||
expect(inventory, `inventory missing ${anchor}`).toContain(anchor);
|
||||
expect(manifestReadme, `manifest README missing ${anchor}`).toContain(anchor);
|
||||
});
|
||||
|
||||
["core", "plugin-candidates", "remove-candidates"].forEach((manifestIdAnchor) => {
|
||||
expect(manifestReadme, `manifest README missing ${manifestIdAnchor}`).toContain(manifestIdAnchor);
|
||||
});
|
||||
});
|
||||
|
||||
it("guards admin-managed secret ownership and worker-backed declarations", () => {
|
||||
manifests
|
||||
.filter((manifest) => manifest.integration.ownership === "admin-managed")
|
||||
.forEach((manifest) => {
|
||||
expect(manifest.integration.configuration.admin.length, manifest.id).toBeGreaterThan(0);
|
||||
expect(manifest.integration.configuration.secrets.join(" ").toLowerCase(), manifest.id).toMatch(/admin|platform/);
|
||||
expect(manifest.integration.permissions.some((permission) => permission.startsWith("admin.")), manifest.id).toBe(true);
|
||||
expect(manifest.integration.auditEvents.length, manifest.id).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
manifests
|
||||
.filter((manifest) => manifest.integration.workers.required)
|
||||
.forEach((manifest) => {
|
||||
expect(manifest.integration.workers.queues.length, manifest.id).toBeGreaterThan(0);
|
||||
expect(manifest.integration.workers.jobs.length, manifest.id).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps admin-managed browser feature contracts backed by config and queue packages", () => {
|
||||
[
|
||||
"BULLMQ_REDIS_URL",
|
||||
"BROWSER_RUNTIME_URL",
|
||||
"BROWSER_RUNTIME_API_KEY",
|
||||
"BROWSER_SESSION_TIMEOUT_MS",
|
||||
].forEach((name) => {
|
||||
const definition = getEnvVariableDefinition(name);
|
||||
expect(definition?.classification, name).toBe("optional-provider");
|
||||
expect(definition?.targets.some((target) => target === "api" || target === "worker"), name).toBe(true);
|
||||
});
|
||||
|
||||
expect(queueNames.browserAutomation).toBe("hivegrid.browser-automation");
|
||||
});
|
||||
});
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { SubscriptionBillingPeriod } from "~/application/enums/subscriptions/SubscriptionBillingPeriod";
|
||||
import {
|
||||
deriveAdminCatalogProductKind,
|
||||
isManagedBillingCatalogProduct,
|
||||
} from "./adminCatalogPolicy";
|
||||
|
||||
describe("admin billing catalog policy", () => {
|
||||
it("protects every canonical base-plan identity and every base-plan row", () => {
|
||||
for (const code of [
|
||||
"starter",
|
||||
"starter_annual_sepa",
|
||||
"pro",
|
||||
"pro_annual_sepa",
|
||||
"business",
|
||||
"business_annual_sepa",
|
||||
]) {
|
||||
expect(isManagedBillingCatalogProduct({ code })).toBe(true);
|
||||
}
|
||||
expect(isManagedBillingCatalogProduct({ kind: "base_plan", code: "legacy" })).toBe(true);
|
||||
expect(
|
||||
isManagedBillingCatalogProduct({
|
||||
kind: "recurring_add_on",
|
||||
code: "customer_portal_monthly",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("creates only separate recurring add-ons or one-time setup products", () => {
|
||||
expect(
|
||||
deriveAdminCatalogProductKind([
|
||||
{ billingPeriod: SubscriptionBillingPeriod.MONTHLY },
|
||||
]),
|
||||
).toBe("recurring_add_on");
|
||||
expect(
|
||||
deriveAdminCatalogProductKind([
|
||||
{ billingPeriod: SubscriptionBillingPeriod.ONCE },
|
||||
]),
|
||||
).toBe("one_time_setup");
|
||||
expect(
|
||||
deriveAdminCatalogProductKind([
|
||||
{ billingPeriod: SubscriptionBillingPeriod.ONCE },
|
||||
{ billingPeriod: SubscriptionBillingPeriod.MONTHLY },
|
||||
]),
|
||||
).toBeNull();
|
||||
expect(deriveAdminCatalogProductKind([])).toBeNull();
|
||||
});
|
||||
});
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { hiveGridBasePlans } from "@hivegrid/entitlements";
|
||||
|
||||
import { SubscriptionBillingPeriod } from "~/application/enums/subscriptions/SubscriptionBillingPeriod";
|
||||
|
||||
export type AdminCatalogProductKind =
|
||||
| "base_plan"
|
||||
| "recurring_add_on"
|
||||
| "one_time_setup"
|
||||
| "contract_override";
|
||||
|
||||
type AdminCatalogProductIdentity = {
|
||||
readonly kind?: AdminCatalogProductKind | null;
|
||||
readonly code?: string | null;
|
||||
readonly lagoPlanCode?: string | null;
|
||||
};
|
||||
|
||||
const managedBasePlanCodes = new Set(
|
||||
hiveGridBasePlans.flatMap((plan) => [
|
||||
plan.technicalCode,
|
||||
...plan.variants.map((variant) => variant.code),
|
||||
]),
|
||||
);
|
||||
|
||||
export function isManagedBillingCatalogProduct(
|
||||
product: AdminCatalogProductIdentity,
|
||||
): boolean {
|
||||
if (product.kind === "base_plan") return true;
|
||||
return [product.code, product.lagoPlanCode].some(
|
||||
(code) => Boolean(code?.trim() && managedBasePlanCodes.has(code.trim())),
|
||||
);
|
||||
}
|
||||
|
||||
export function deriveAdminCatalogProductKind(
|
||||
prices: readonly { readonly billingPeriod: SubscriptionBillingPeriod }[],
|
||||
): Exclude<AdminCatalogProductKind, "base_plan" | "contract_override"> | null {
|
||||
if (prices.length === 0) return null;
|
||||
const oneTimeCount = prices.filter(
|
||||
(price) => price.billingPeriod === SubscriptionBillingPeriod.ONCE,
|
||||
).length;
|
||||
if (oneTimeCount === prices.length) return "one_time_setup";
|
||||
if (oneTimeCount === 0) return "recurring_add_on";
|
||||
return null;
|
||||
}
|
||||
-325
@@ -1,325 +0,0 @@
|
||||
import { SubscriptionBillingPeriod } from "~/application/enums/subscriptions/SubscriptionBillingPeriod";
|
||||
import { SubscriptionPriceType } from "~/application/enums/subscriptions/SubscriptionPriceType";
|
||||
import { DefaultFeatures } from "../dtos/shared/DefaultFeatures";
|
||||
import { SubscriptionPriceDto } from "../dtos/subscriptions/SubscriptionPriceDto";
|
||||
import { SubscriptionProductDto } from "../dtos/subscriptions/SubscriptionProductDto";
|
||||
import { SubscriptionUsageBasedPriceDto } from "../dtos/subscriptions/SubscriptionUsageBasedPriceDto";
|
||||
import { SubscriptionUsageBasedTierDto } from "../dtos/subscriptions/SubscriptionUsageBasedTierDto";
|
||||
import { PricingModel } from "../enums/subscriptions/PricingModel";
|
||||
import { SubscriptionFeatureLimitType } from "../enums/subscriptions/SubscriptionFeatureLimitType";
|
||||
|
||||
const UNIT_API_CALL = {
|
||||
name: "api",
|
||||
title: "API Call",
|
||||
titlePlural: "API Calls",
|
||||
};
|
||||
|
||||
function generatePrice(currency: string, price: number, billingPeriod: SubscriptionBillingPeriod): SubscriptionPriceDto {
|
||||
return {
|
||||
billingProviderId: "",
|
||||
subscriptionProductId: "",
|
||||
type: billingPeriod === SubscriptionBillingPeriod.ONCE ? SubscriptionPriceType.ONE_TIME : SubscriptionPriceType.RECURRING,
|
||||
billingPeriod,
|
||||
price: Math.round(price * 100) / 100,
|
||||
currency,
|
||||
trialDays: 0,
|
||||
active: true,
|
||||
usageBasedPrices: [],
|
||||
};
|
||||
}
|
||||
|
||||
function generateUsageBasedPrice(
|
||||
currency: string,
|
||||
unit: {
|
||||
name: string;
|
||||
title: string;
|
||||
titlePlural: string;
|
||||
},
|
||||
usageType: "licensed" | "metered",
|
||||
aggregateUsage: "last_during_period" | "last_ever" | "max" | "sum",
|
||||
tiersMode: "graduated" | "volume",
|
||||
billingScheme: "per_unit" | "tiered",
|
||||
tiers: {
|
||||
from: number;
|
||||
to: undefined | number;
|
||||
perUnitPrice: number | undefined;
|
||||
flatFeePrice: number | undefined;
|
||||
}[]
|
||||
): SubscriptionUsageBasedPriceDto {
|
||||
const usageBasedPriceTiers: SubscriptionUsageBasedTierDto[] = [];
|
||||
tiers.forEach((tier) => {
|
||||
usageBasedPriceTiers.push({
|
||||
id: "",
|
||||
subscriptionUsageBasedPriceId: "",
|
||||
...tier,
|
||||
});
|
||||
});
|
||||
return {
|
||||
id: "",
|
||||
billingProviderId: "",
|
||||
subscriptionProductId: "",
|
||||
billingPeriod: SubscriptionBillingPeriod.MONTHLY,
|
||||
currency,
|
||||
unit: unit.name,
|
||||
unitTitle: unit.title,
|
||||
unitTitlePlural: unit.titlePlural,
|
||||
usageType,
|
||||
aggregateUsage,
|
||||
tiersMode,
|
||||
billingScheme,
|
||||
tiers: usageBasedPriceTiers,
|
||||
};
|
||||
}
|
||||
|
||||
function generateCommonPlan(order: number, model: PricingModel) {
|
||||
if (order === 1) {
|
||||
return {
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan1.title",
|
||||
description: "pricing.products.plan1.description",
|
||||
model,
|
||||
public: true,
|
||||
features: [
|
||||
{
|
||||
order: 1,
|
||||
title: "pricing.features.users.max",
|
||||
name: DefaultFeatures.Users,
|
||||
value: 2,
|
||||
type: SubscriptionFeatureLimitType.MAX,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
title: "pricing.features.apiCalls.units",
|
||||
name: DefaultFeatures.API,
|
||||
value: 0,
|
||||
type: SubscriptionFeatureLimitType.NOT_INCLUDED,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
title: "pricing.features.prioritySupport.none",
|
||||
name: DefaultFeatures.PrioritySupport,
|
||||
value: 0,
|
||||
type: SubscriptionFeatureLimitType.NOT_INCLUDED,
|
||||
accumulate: false,
|
||||
},
|
||||
],
|
||||
badge: "",
|
||||
active: true,
|
||||
prices: [],
|
||||
};
|
||||
} else if (order === 2) {
|
||||
return {
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan2.title",
|
||||
description: "pricing.products.plan2.description",
|
||||
public: true,
|
||||
model,
|
||||
features: [
|
||||
{
|
||||
order: 1,
|
||||
title: "pricing.features.users.max",
|
||||
name: DefaultFeatures.Users,
|
||||
value: 5,
|
||||
type: SubscriptionFeatureLimitType.MAX,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
title: "pricing.features.apiCalls.monthly",
|
||||
name: DefaultFeatures.API,
|
||||
value: 100,
|
||||
type: SubscriptionFeatureLimitType.MONTHLY,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
title: "pricing.features.prioritySupport.basic",
|
||||
name: DefaultFeatures.PrioritySupport,
|
||||
value: 0,
|
||||
type: SubscriptionFeatureLimitType.INCLUDED,
|
||||
accumulate: false,
|
||||
},
|
||||
],
|
||||
badge: "pricing.recommended",
|
||||
active: true,
|
||||
};
|
||||
} else if (order === 3) {
|
||||
return {
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan3.title",
|
||||
description: "pricing.products.plan3.description",
|
||||
public: true,
|
||||
model,
|
||||
features: [
|
||||
{
|
||||
order: 1,
|
||||
title: "pricing.features.users.max",
|
||||
name: DefaultFeatures.Users,
|
||||
value: 12,
|
||||
type: SubscriptionFeatureLimitType.MAX,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
title: "pricing.features.apiCalls.unlimited",
|
||||
name: DefaultFeatures.API,
|
||||
value: 0,
|
||||
type: SubscriptionFeatureLimitType.UNLIMITED,
|
||||
accumulate: false,
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
title: "pricing.features.prioritySupport.priority",
|
||||
name: DefaultFeatures.PrioritySupport,
|
||||
value: 0,
|
||||
type: SubscriptionFeatureLimitType.INCLUDED,
|
||||
accumulate: false,
|
||||
},
|
||||
],
|
||||
badge: "",
|
||||
active: true,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
billingProviderId: "",
|
||||
order,
|
||||
title: "pricing.products.plan1.title",
|
||||
description: "pricing.products.plan1.description",
|
||||
model,
|
||||
public: true,
|
||||
features: [
|
||||
{
|
||||
order: 1,
|
||||
title: "pricing.features.users.one",
|
||||
name: DefaultFeatures.Users,
|
||||
value: 1,
|
||||
type: SubscriptionFeatureLimitType.MAX,
|
||||
accumulate: false,
|
||||
},
|
||||
],
|
||||
badge: "",
|
||||
active: true,
|
||||
};
|
||||
}
|
||||
|
||||
const FLAT_RATE_PRICES: SubscriptionProductDto[] = [
|
||||
{
|
||||
...generateCommonPlan(1, PricingModel.FLAT_RATE),
|
||||
prices: [
|
||||
generatePrice("usd", 9, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("usd", 90, SubscriptionBillingPeriod.YEARLY),
|
||||
generatePrice("mxn", 199, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("mxn", 1990, SubscriptionBillingPeriod.YEARLY),
|
||||
],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(2, PricingModel.FLAT_RATE),
|
||||
prices: [
|
||||
generatePrice("usd", 199, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("usd", 1990, SubscriptionBillingPeriod.YEARLY),
|
||||
generatePrice("mxn", 3999, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("mxn", 39990, SubscriptionBillingPeriod.YEARLY),
|
||||
],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(3, PricingModel.FLAT_RATE),
|
||||
prices: [
|
||||
generatePrice("usd", 399, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("usd", 3990, SubscriptionBillingPeriod.YEARLY),
|
||||
generatePrice("mxn", 7999, SubscriptionBillingPeriod.MONTHLY),
|
||||
generatePrice("mxn", 79990, SubscriptionBillingPeriod.YEARLY),
|
||||
],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
];
|
||||
|
||||
const USAGE_BASED_PRICES: SubscriptionProductDto[] = [
|
||||
{
|
||||
...generateCommonPlan(1, PricingModel.USAGE_BASED),
|
||||
prices: [],
|
||||
usageBasedPrices: [
|
||||
generateUsageBasedPrice("usd", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 0.02, flatFeePrice: 5 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.01, flatFeePrice: 10 },
|
||||
]),
|
||||
generateUsageBasedPrice("mxn", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 0.4, flatFeePrice: 100 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.2, flatFeePrice: 200 },
|
||||
]),
|
||||
],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(2, PricingModel.USAGE_BASED),
|
||||
prices: [],
|
||||
usageBasedPrices: [
|
||||
generateUsageBasedPrice("usd", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 0.04, flatFeePrice: 10 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.02, flatFeePrice: 20 },
|
||||
]),
|
||||
generateUsageBasedPrice("mxn", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 0.8, flatFeePrice: 200 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.4, flatFeePrice: 400 },
|
||||
]),
|
||||
],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(3, PricingModel.USAGE_BASED),
|
||||
prices: [],
|
||||
usageBasedPrices: [
|
||||
generateUsageBasedPrice("usd", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 0.06, flatFeePrice: 15 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.03, flatFeePrice: 30 },
|
||||
]),
|
||||
generateUsageBasedPrice("mxn", UNIT_API_CALL, "metered", "sum", "volume", "tiered", [
|
||||
{ from: 0, to: 10, perUnitPrice: 0.0, flatFeePrice: undefined },
|
||||
{ from: 11, to: 20, perUnitPrice: 1.2, flatFeePrice: 300 },
|
||||
{ from: 21, to: undefined, perUnitPrice: 0.6, flatFeePrice: 600 },
|
||||
]),
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const FLAT_RATE_PLUS_USAGE_BASED_PRICES: SubscriptionProductDto[] = [
|
||||
...FLAT_RATE_PRICES.map((flatRate) => {
|
||||
const usageBasedPrices = USAGE_BASED_PRICES.find((f) => f.order === flatRate.order)?.usageBasedPrices ?? [];
|
||||
return {
|
||||
...flatRate,
|
||||
usageBasedPrices,
|
||||
model: PricingModel.FLAT_RATE_USAGE_BASED,
|
||||
};
|
||||
}),
|
||||
];
|
||||
|
||||
const ONE_TIME_PRICES: SubscriptionProductDto[] = [
|
||||
{
|
||||
...generateCommonPlan(1, PricingModel.ONCE),
|
||||
prices: [generatePrice("usd", 99 * 2, SubscriptionBillingPeriod.ONCE), generatePrice("mxn", 1999 * 2, SubscriptionBillingPeriod.ONCE)],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(2, PricingModel.ONCE),
|
||||
prices: [generatePrice("usd", 499 * 2, SubscriptionBillingPeriod.ONCE), generatePrice("mxn", 9999 * 2, SubscriptionBillingPeriod.ONCE)],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
{
|
||||
...generateCommonPlan(3, PricingModel.ONCE),
|
||||
prices: [generatePrice("usd", 1999 * 2, SubscriptionBillingPeriod.ONCE), generatePrice("mxn", 4999 * 2, SubscriptionBillingPeriod.ONCE)],
|
||||
usageBasedPrices: [],
|
||||
},
|
||||
];
|
||||
|
||||
const plans = [...FLAT_RATE_PRICES, ...USAGE_BASED_PRICES, ...FLAT_RATE_PLUS_USAGE_BASED_PRICES, ...ONE_TIME_PRICES];
|
||||
export default plans;
|
||||
+15
-5
@@ -1,17 +1,27 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import plans from "~/application/pricing/plans.server";
|
||||
import { PricingModel } from "~/application/enums/subscriptions/PricingModel";
|
||||
import { HIVEGRID_SUBSCRIPTION_PRICING_MODELS, isHiveGridSubscriptionPricingModel } from "./pricingModelPolicy";
|
||||
|
||||
describe("HiveGrid subscription pricing model policy", () => {
|
||||
it("does not allow seat-type pricing models", () => {
|
||||
it("allows only fixed recurring and one-time products", () => {
|
||||
expect(HIVEGRID_SUBSCRIPTION_PRICING_MODELS).toEqual([PricingModel.FLAT_RATE, PricingModel.ONCE]);
|
||||
expect(HIVEGRID_SUBSCRIPTION_PRICING_MODELS).not.toContain(PricingModel.PER_SEAT);
|
||||
expect(HIVEGRID_SUBSCRIPTION_PRICING_MODELS).not.toContain(PricingModel.USAGE_BASED);
|
||||
expect(HIVEGRID_SUBSCRIPTION_PRICING_MODELS).not.toContain(PricingModel.FLAT_RATE_USAGE_BASED);
|
||||
expect(isHiveGridSubscriptionPricingModel(PricingModel.PER_SEAT)).toBe(false);
|
||||
expect(isHiveGridSubscriptionPricingModel(PricingModel.USAGE_BASED)).toBe(false);
|
||||
expect(isHiveGridSubscriptionPricingModel(PricingModel.FLAT_RATE_USAGE_BASED)).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps generated admin pricing seeds free of seat-type plans", () => {
|
||||
expect(plans).not.toHaveLength(0);
|
||||
expect(plans.map((plan) => plan.model)).not.toContain(PricingModel.PER_SEAT);
|
||||
it("does not expose the removed demo-plan generator from the admin route", () => {
|
||||
const route = fs.readFileSync(path.join(process.cwd(), "apps/web/app/routes/admin/settings/pricing.tsx"), "utf8");
|
||||
|
||||
expect(route).not.toContain("plans.server");
|
||||
expect(route).not.toContain("create-all-plans");
|
||||
expect(route).not.toContain("generateFromFiles");
|
||||
expect(route).toContain("admin.pricing.catalogManaged");
|
||||
});
|
||||
});
|
||||
+1
-7
@@ -1,13 +1,7 @@
|
||||
import { PricingModel } from "~/application/enums/subscriptions/PricingModel";
|
||||
|
||||
export const HIVEGRID_SUBSCRIPTION_PRICING_MODELS = [
|
||||
PricingModel.FLAT_RATE,
|
||||
PricingModel.USAGE_BASED,
|
||||
PricingModel.FLAT_RATE_USAGE_BASED,
|
||||
PricingModel.ONCE,
|
||||
] as const;
|
||||
export const HIVEGRID_SUBSCRIPTION_PRICING_MODELS = [PricingModel.FLAT_RATE, PricingModel.ONCE] as const;
|
||||
|
||||
export function isHiveGridSubscriptionPricingModel(model: PricingModel) {
|
||||
return HIVEGRID_SUBSCRIPTION_PRICING_MODELS.includes(model as (typeof HIVEGRID_SUBSCRIPTION_PRICING_MODELS)[number]);
|
||||
}
|
||||
|
||||
+160
-8
@@ -3,7 +3,8 @@ import * as path from "node:path";
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { AdminSidebar } from "./AdminSidebar";
|
||||
import type { SideBarItem } from "./SidebarItem";
|
||||
import { canonicalAdminRouteSlugs, disabledPluginRouteSlugs } from "~/utils/app/PublicRouteSegments";
|
||||
import { UI_NAV_IDS } from "~/application/ui/uiRegistry";
|
||||
import { canonicalAdminRouteExactPaths, canonicalAdminRouteSlugs, disabledPluginRouteSlugs } from "~/utils/app/PublicRouteSegments";
|
||||
import { resolveRepoPath } from "~/utils/testing/repoPaths";
|
||||
|
||||
function flattenSidebarItems(items: SideBarItem[]): SideBarItem[] {
|
||||
@@ -84,15 +85,14 @@ describe("AdminSidebar", () => {
|
||||
expect(serialized).toContain("/accounts");
|
||||
expect(serialized).toContain("/audit-trails");
|
||||
expect(serialized).toContain("/notifications/messages");
|
||||
expect(serialized).toContain("/feature-flags/flags");
|
||||
expect(serialized).toContain("/settings/profile");
|
||||
expect(serialized).not.toContain("/feature-flags");
|
||||
expect(serialized).toContain("/settings/security");
|
||||
expect(serialized).not.toContain("/settings/profile");
|
||||
expect(serialized).not.toContain("/metrics");
|
||||
expect(sidebar).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
items: expect.arrayContaining([
|
||||
expect.objectContaining({ id: "ui.nav.admin.dashboard", path: "/dashboard" }),
|
||||
]),
|
||||
items: expect.arrayContaining([expect.objectContaining({ id: "ui.nav.admin.dashboard", path: "/dashboard" })]),
|
||||
}),
|
||||
])
|
||||
);
|
||||
@@ -113,12 +113,15 @@ describe("AdminSidebar", () => {
|
||||
expect(serialized).not.toContain("/portals");
|
||||
expect(serialized).not.toContain("/prompts");
|
||||
expect(serialized).not.toContain("/workflow-engine");
|
||||
expect(serialized).not.toContain("\"path\":\"/crm\"");
|
||||
expect(serialized).not.toContain('"path":"/crm"');
|
||||
expect(serialized).not.toContain("ui.nav.admin.crm");
|
||||
expect(allPaths.map((path) => path.split("/").filter(Boolean)[0])).not.toEqual(expect.arrayContaining([...disabledPluginRouteSlugs]));
|
||||
expect(allPaths.map((path) => path.split("/").filter(Boolean)[0])).toEqual(expect.arrayContaining(["dashboard", "accounts", "settings"]));
|
||||
allPaths.forEach((path) => {
|
||||
expect(canonicalAdminRouteSlugs).toContain(path.split("/").filter(Boolean)[0] as any);
|
||||
const firstSlug = path.split("/").filter(Boolean)[0] ?? "";
|
||||
const isCanonicalSlug = (canonicalAdminRouteSlugs as readonly string[]).includes(firstSlug);
|
||||
const isCanonicalExactPath = (canonicalAdminRouteExactPaths as readonly string[]).includes(path);
|
||||
expect(isCanonicalSlug || isCanonicalExactPath, path).toBe(true);
|
||||
});
|
||||
|
||||
sidebar.forEach((item) => {
|
||||
@@ -136,6 +139,155 @@ describe("AdminSidebar", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("consolidates platform operations and support without exposing feature flags", () => {
|
||||
const sidebar = AdminSidebar({ t, appConfiguration: null });
|
||||
const platform = sidebar.find((item) => item.id === "ui.nav.admin.platform");
|
||||
const platformItems = platform?.items ?? [];
|
||||
const operations = platformItems.find((item) => item.id === "ui.nav.admin.platform.operations");
|
||||
const support = platformItems.find((item) => item.id === "ui.nav.admin.platform.support");
|
||||
|
||||
expect(platformItems.map((item) => item.id)).toEqual(["ui.nav.admin.platform.operations", "ui.nav.admin.platform.support", UI_NAV_IDS.adminApi]);
|
||||
expect(operations).toMatchObject({
|
||||
title: "admin.platformNavigation.operations",
|
||||
path: "/system",
|
||||
isCollapsible: false,
|
||||
activePaths: ["/system", "/system/health", "/system/deploys", "/system/jobs", "/system/webhooks", "/system/billing"],
|
||||
anyPermissions: ["admin.metrics.view", "admin.events.view", "admin.account.subscription"],
|
||||
});
|
||||
expect(operations?.items?.map((item) => item.path)).toEqual([
|
||||
"/system",
|
||||
"/system/health",
|
||||
"/system/deploys",
|
||||
"/system/jobs",
|
||||
"/system/webhooks",
|
||||
"/system/billing",
|
||||
]);
|
||||
const accounts = flattenSidebarItems(sidebar).find((item) => item.id === UI_NAV_IDS.adminAccounts);
|
||||
const audit = flattenSidebarItems(sidebar).find((item) => item.id === UI_NAV_IDS.adminAudit);
|
||||
expect(accounts?.items?.map((item) => item.path)).not.toContain("/accounts/billing");
|
||||
expect(accounts?.excludePaths).toContain("/accounts/billing");
|
||||
expect(audit?.items?.map((item) => item.path)).not.toContain("/webhooks");
|
||||
expect(support).toMatchObject({
|
||||
title: "admin.platformNavigation.support",
|
||||
path: "/support",
|
||||
anyPermissions: ["admin_identity.impersonation.start", "admin.metrics.view"],
|
||||
isCollapsible: false,
|
||||
activePaths: ["/support", "/support/kwp-contracts"],
|
||||
});
|
||||
expect(support?.items?.map((item) => item.path)).toEqual(["/support", "/support/kwp-contracts"]);
|
||||
expect(platformItems.at(-1)).toMatchObject({
|
||||
id: UI_NAV_IDS.adminApi,
|
||||
title: "admin.platformNavigation.apiAccess",
|
||||
path: "/api",
|
||||
});
|
||||
expect(flattenSidebarItems(sidebar).map((item) => item.id)).not.toContain(UI_NAV_IDS.adminFeatureFlags);
|
||||
});
|
||||
|
||||
it("gates platform leads only by the sales CRM read permission", () => {
|
||||
const leadInbox = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null })).find((item) => item.id === "ui.nav.admin.platformLeads");
|
||||
expect(leadInbox).toMatchObject({
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps sales work and communication separate while nesting configuration under settings", () => {
|
||||
const sidebar = AdminSidebar({ t, appConfiguration: null });
|
||||
const salesGroups = sidebar.filter((item) => ["ui.nav.admin.sales", "ui.nav.admin.salesCommunication"].includes(item.id ?? ""));
|
||||
const settings = flattenSidebarItems(sidebar).find((item) => item.id === UI_NAV_IDS.adminSettings);
|
||||
|
||||
expect(salesGroups.map((group) => group.id)).toEqual(["ui.nav.admin.sales", "ui.nav.admin.salesCommunication"]);
|
||||
expect(salesGroups.map((group) => group.title)).toEqual(["admin.sales.navigation.title", "admin.sales.navigation.communicationSection"]);
|
||||
expect(salesGroups[0]?.items?.map((item) => item.id)).toEqual([
|
||||
"ui.nav.admin.sales.today",
|
||||
"ui.nav.admin.platformLeads",
|
||||
"ui.nav.admin.sales.deals",
|
||||
"ui.nav.admin.sales.contacts",
|
||||
"ui.nav.admin.sales.companies",
|
||||
UI_NAV_IDS.adminSalesImportExport,
|
||||
]);
|
||||
expect(salesGroups[1]?.items?.map((item) => item.id)).toEqual(["ui.nav.admin.sales.email", "ui.nav.admin.sales.calls", "ui.nav.admin.sales.bookings"]);
|
||||
expect(salesGroups.flatMap((group) => group.items ?? []).every((item) => item.icon)).toBe(true);
|
||||
expect(settings?.items?.slice(-4).map((item) => item.id)).toEqual([
|
||||
UI_NAV_IDS.adminSalesPipelineSettings,
|
||||
UI_NAV_IDS.adminSalesLeadSettings,
|
||||
UI_NAV_IDS.adminSalesFieldsTags,
|
||||
UI_NAV_IDS.adminSalesTelephonySettings,
|
||||
]);
|
||||
expect(settings).toMatchObject({
|
||||
isCollapsible: false,
|
||||
activePaths: ["/settings"],
|
||||
anyPermissions: expect.arrayContaining(["admin_identity.sessions.read", "admin.settings.general.view", "admin.settings.danger.reset"]),
|
||||
});
|
||||
expect(settings?.items?.slice(0, 3).map((item) => item.id)).toEqual([
|
||||
"ui.nav.admin.settings.profile",
|
||||
"ui.nav.admin.settings.adminUsers",
|
||||
"ui.nav.admin.settings.adminRoles",
|
||||
]);
|
||||
expect(flattenSidebarItems(sidebar).map((item) => item.id)).not.toContain("ui.nav.admin.adminUsers");
|
||||
expect(flattenSidebarItems(sidebar).map((item) => item.id)).not.toContain("ui.nav.admin.salesConfiguration");
|
||||
});
|
||||
|
||||
it("gates lead automation settings with the smallest assignment permission", () => {
|
||||
const settings = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null })).find((item) => item.id === "ui.nav.admin.sales.leadSettings");
|
||||
|
||||
expect(settings).toMatchObject({
|
||||
path: "/settings/leads",
|
||||
permission: "admin_sales.crm.assign",
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes the personal today list with CRM read permission", () => {
|
||||
const today = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null })).find((item) => item.id === "ui.nav.admin.sales.today");
|
||||
|
||||
expect(today).toMatchObject({
|
||||
path: "/sales/tasks/today",
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes telephony workspace and settings with their smallest permissions", () => {
|
||||
const items = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null }));
|
||||
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.calls")).toMatchObject({
|
||||
path: "/sales/calls",
|
||||
permission: "admin_sales.phone.call",
|
||||
});
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.telephonySettings")).toMatchObject({
|
||||
path: "/settings/telephony",
|
||||
permission: "admin_sales.integrations.manage",
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes tenantless platform contacts with CRM read permission", () => {
|
||||
const contacts = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null })).find((item) => item.id === "ui.nav.admin.sales.contacts");
|
||||
|
||||
expect(contacts).toMatchObject({
|
||||
path: "/sales/contacts",
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes every VA-P28b data screen through its smallest permission", () => {
|
||||
const items = flattenSidebarItems(AdminSidebar({ t, appConfiguration: null }));
|
||||
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.companies")).toMatchObject({
|
||||
path: "/sales/companies",
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.pipelineSettings")).toMatchObject({
|
||||
path: "/settings/pipelines",
|
||||
permission: "admin_sales.crm.write",
|
||||
});
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.fieldsTags")).toMatchObject({
|
||||
path: "/settings/fields-tags",
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
expect(items.find((item) => item.id === "ui.nav.admin.sales.importExport")).toMatchObject({
|
||||
path: "/sales/import-export",
|
||||
permission: "admin_sales.crm.read",
|
||||
});
|
||||
});
|
||||
|
||||
it("only emits canonical admin sidebar paths backed by route files", () => {
|
||||
const routePaths = collectAdminRoutePaths();
|
||||
const sidebar = AdminSidebar({
|
||||
|
||||
+313
-66
@@ -1,4 +1,15 @@
|
||||
import { SideBarItem } from "./SidebarItem";
|
||||
import {
|
||||
FeatherBuilding2,
|
||||
FeatherCalendarDays,
|
||||
FeatherDatabase,
|
||||
FeatherKanbanSquare,
|
||||
FeatherListTodo,
|
||||
FeatherMail,
|
||||
FeatherPhone,
|
||||
FeatherTarget,
|
||||
FeatherUsers,
|
||||
} from "@subframe/core";
|
||||
import { TFunction } from "i18next";
|
||||
import IconDashboard from "~/components/layouts/icons/IconDashboard";
|
||||
import MembershipCardIcon from "~/components/ui/icons/MembershipCardIcon";
|
||||
@@ -7,17 +18,15 @@ import IconSettings from "~/components/layouts/icons/IconSettings";
|
||||
import IconApp from "~/components/layouts/icons/IconApp";
|
||||
import IconKeys from "~/components/layouts/icons/IconKeys";
|
||||
import IconAnalytics from "~/components/layouts/icons/IconAnalytics";
|
||||
import IconDocs from "~/components/layouts/icons/IconDocs";
|
||||
import IconEmails from "~/components/layouts/icons/IconEmails";
|
||||
import IconEvents from "~/components/layouts/icons/IconEvents";
|
||||
import IconFeatureFlags from "~/components/layouts/icons/IconFeatureFlags";
|
||||
import IconHelpDesk from "~/components/layouts/icons/IconHelpDesk";
|
||||
import IconMetrics from "~/components/layouts/icons/IconMetrics";
|
||||
import IconNotifications from "~/components/layouts/icons/IconNotifications";
|
||||
import { UI_NAV_IDS } from "~/application/ui/uiRegistry";
|
||||
import { adminPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import type { PublicDomainRoutingConfig } from "~/utils/app/CrossHostUrls";
|
||||
import { disabledPluginRouteSlugs } from "~/utils/app/PublicRouteSegments";
|
||||
import { ADMIN_AREA_ACCESS } from "~/services/admin/admin-access-contract";
|
||||
|
||||
const adminSidebarPath = (path?: string) => adminPath(path, { mode: "host-aware" });
|
||||
const disabledAdminRouteSlugs = new Set<string>(disabledPluginRouteSlugs);
|
||||
@@ -36,6 +45,23 @@ type Props = {
|
||||
routing?: PublicDomainRoutingConfig;
|
||||
};
|
||||
|
||||
function consolidatedPlatformItem(input: {
|
||||
id: string;
|
||||
title: string;
|
||||
path: string;
|
||||
icon: SideBarItem["icon"];
|
||||
permission?: SideBarItem["permission"];
|
||||
anyPermissions?: SideBarItem["anyPermissions"];
|
||||
contextItems: SideBarItem[];
|
||||
}): SideBarItem {
|
||||
return {
|
||||
...input,
|
||||
activePaths: input.contextItems.map((item) => item.path),
|
||||
isCollapsible: false,
|
||||
items: input.contextItems,
|
||||
};
|
||||
}
|
||||
|
||||
export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
{
|
||||
id: "ui.nav.admin.primary",
|
||||
@@ -47,6 +73,7 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
title: t("app.sidebar.dashboard"),
|
||||
path: adminSidebarPath("dashboard"),
|
||||
icon: <IconDashboard />,
|
||||
permission: ADMIN_AREA_ACCESS.dashboard,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -86,13 +113,6 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
items: [],
|
||||
permission: "admin.accounts.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.accounts.billing",
|
||||
title: t("admin.billing.title"),
|
||||
path: adminSidebarPath("accounts/billing"),
|
||||
items: [],
|
||||
permission: "admin.account.subscription",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.accounts.rolesAndPermissions",
|
||||
title: t("app.sidebar.rolesAndPermissions"),
|
||||
@@ -116,6 +136,7 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
},
|
||||
],
|
||||
permission: "admin.accounts.view",
|
||||
excludePaths: [adminSidebarPath("accounts/billing")],
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminAudit,
|
||||
@@ -124,11 +145,16 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
icon: <IconEvents />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.audit.viewer", title: t("app.sidebar.audit"), path: adminSidebarPath("audit"), permission: "admin.auditTrails.view" },
|
||||
{ id: "ui.nav.admin.audit.trails", title: t("app.sidebar.auditTrails"), path: adminSidebarPath("audit-trails"), permission: "admin.auditTrails.view" },
|
||||
{ id: "ui.nav.admin.audit.viewer", title: t("app.sidebar.audit"), path: adminSidebarPath("audit"), permission: "admin_identity.audit.read" },
|
||||
{
|
||||
id: "ui.nav.admin.audit.trails",
|
||||
title: t("app.sidebar.auditTrails"),
|
||||
path: adminSidebarPath("audit-trails"),
|
||||
permission: "admin.auditTrails.view",
|
||||
},
|
||||
{ id: "ui.nav.admin.audit.events", title: t("models.event.plural"), path: adminSidebarPath("events"), permission: "admin.events.view" },
|
||||
],
|
||||
permission: "admin.auditTrails.view",
|
||||
anyPermissions: ["admin.auditTrails.view", "admin_identity.audit.read"],
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminNotifications,
|
||||
@@ -137,9 +163,24 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
icon: <IconNotifications />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.notifications.messages", title: t("app.sidebar.messages"), path: adminSidebarPath("notifications/messages"), permission: "admin.notifications.view" },
|
||||
{ id: "ui.nav.admin.notifications.channels", title: t("app.sidebar.channels"), path: adminSidebarPath("notifications/channels"), permission: "admin.notifications.view" },
|
||||
{ id: "ui.nav.admin.notifications.subscribers", title: t("app.sidebar.subscribers"), path: adminSidebarPath("notifications/subscribers"), permission: "admin.notifications.view" },
|
||||
{
|
||||
id: "ui.nav.admin.notifications.messages",
|
||||
title: t("app.sidebar.messages"),
|
||||
path: adminSidebarPath("notifications/messages"),
|
||||
permission: "admin.notifications.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.notifications.channels",
|
||||
title: t("app.sidebar.channels"),
|
||||
path: adminSidebarPath("notifications/channels"),
|
||||
permission: "admin.notifications.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.notifications.subscribers",
|
||||
title: t("app.sidebar.subscribers"),
|
||||
path: adminSidebarPath("notifications/subscribers"),
|
||||
permission: "admin.notifications.view",
|
||||
},
|
||||
],
|
||||
permission: "admin.notifications.view",
|
||||
},
|
||||
@@ -150,33 +191,175 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
title: t("segments.platform"),
|
||||
path: "",
|
||||
items: [
|
||||
consolidatedPlatformItem({
|
||||
id: "ui.nav.admin.platform.operations",
|
||||
title: t("admin.platformNavigation.operations"),
|
||||
path: adminSidebarPath("system"),
|
||||
icon: <IconMetrics />,
|
||||
anyPermissions: [ADMIN_AREA_ACCESS.health, "admin.events.view", "admin.account.subscription"],
|
||||
contextItems: [
|
||||
{
|
||||
id: "ui.nav.admin.health",
|
||||
title: t("admin.health.title"),
|
||||
path: adminSidebarPath("system"),
|
||||
permission: ADMIN_AREA_ACCESS.health,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.system",
|
||||
title: t("admin.system.title"),
|
||||
path: adminSidebarPath("system/health"),
|
||||
permission: ADMIN_AREA_ACCESS.system,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.deploys",
|
||||
title: t("admin.deploys.title"),
|
||||
path: adminSidebarPath("system/deploys"),
|
||||
permission: ADMIN_AREA_ACCESS.deploys,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.jobs",
|
||||
title: t("admin.jobs.title"),
|
||||
path: adminSidebarPath("system/jobs"),
|
||||
permission: ADMIN_AREA_ACCESS.jobs,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.webhooks",
|
||||
title: t("admin.webhooks.title"),
|
||||
path: adminSidebarPath("system/webhooks"),
|
||||
permission: "admin.events.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.billingSync",
|
||||
title: t("admin.health.subsystems.billing.label"),
|
||||
path: adminSidebarPath("system/billing"),
|
||||
permission: "admin.account.subscription",
|
||||
},
|
||||
],
|
||||
}),
|
||||
consolidatedPlatformItem({
|
||||
id: "ui.nav.admin.platform.support",
|
||||
title: t("admin.platformNavigation.support"),
|
||||
path: adminSidebarPath("support"),
|
||||
icon: <IconEmails />,
|
||||
anyPermissions: [ADMIN_AREA_ACCESS.support, "admin.metrics.view"],
|
||||
contextItems: [
|
||||
{
|
||||
id: UI_NAV_IDS.adminHelpDesk,
|
||||
title: t("admin.supportInbox.title"),
|
||||
path: adminSidebarPath("support"),
|
||||
permission: ADMIN_AREA_ACCESS.support,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.kwpContracts",
|
||||
title: t("admin.kwpContracts.title"),
|
||||
path: adminSidebarPath("support/kwp-contracts"),
|
||||
permission: "admin.metrics.view",
|
||||
},
|
||||
],
|
||||
}),
|
||||
{
|
||||
id: UI_NAV_IDS.adminApi,
|
||||
title: t("settings.api.title"),
|
||||
title: t("admin.platformNavigation.apiAccess"),
|
||||
path: adminSidebarPath("api"),
|
||||
icon: <IconKeys />,
|
||||
permission: "admin.apiKeys.view",
|
||||
hidden: !appConfiguration?.app.features.tenantApiKeys,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.api.overview", title: t("shared.overview"), path: adminSidebarPath("api"), permission: "admin.apiKeys.view" },
|
||||
{ id: "ui.nav.admin.api.keys", title: t("app.sidebar.apiKeys"), path: adminSidebarPath("api/keys"), permission: "admin.apiKeys.view" },
|
||||
{ id: "ui.nav.admin.api.logs", title: t("app.sidebar.logs"), path: adminSidebarPath("api/logs"), permission: "admin.apiKeys.view" },
|
||||
{ id: "ui.nav.admin.api.clients", title: t("admin.apiAdmin.tabs.clients"), path: adminSidebarPath("api/clients"), permission: "admin.apiKeys.view" },
|
||||
{
|
||||
id: "ui.nav.admin.api.inbound",
|
||||
title: t("admin.apiAdmin.tabs.inbound"),
|
||||
path: adminSidebarPath("api/inbound-registrations"),
|
||||
permission: "admin.apiKeys.view",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminFeatureFlags,
|
||||
title: t("app.sidebar.featureFlags"),
|
||||
path: adminSidebarPath("feature-flags"),
|
||||
icon: <IconFeatureFlags />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.featureFlags.flags", title: t("app.sidebar.flags"), path: adminSidebarPath("feature-flags/flags"), permission: "admin.featureFlags.view" },
|
||||
{ id: "ui.nav.admin.featureFlags.settings", title: t("app.sidebar.settings"), path: adminSidebarPath("feature-flags/settings"), permission: "admin.featureFlags.view" },
|
||||
],
|
||||
permission: "admin.featureFlags.view",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSales,
|
||||
title: t("admin.sales.navigation.title"),
|
||||
path: adminSidebarPath("sales/tasks/today"),
|
||||
icon: <IconAnalytics />,
|
||||
items: [
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesToday,
|
||||
title: t("admin.sales.navigation.today"),
|
||||
path: adminSidebarPath("sales/tasks/today"),
|
||||
icon: <FeatherListTodo />,
|
||||
permission: ADMIN_AREA_ACCESS.sales,
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminPlatformLeads,
|
||||
title: t("admin.sales.navigation.leads"),
|
||||
path: adminSidebarPath("leads"),
|
||||
icon: <FeatherTarget />,
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesDeals,
|
||||
title: t("admin.sales.navigation.deals"),
|
||||
path: adminSidebarPath("sales/deals"),
|
||||
icon: <FeatherKanbanSquare />,
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesContacts,
|
||||
title: t("admin.sales.navigation.contacts"),
|
||||
path: adminSidebarPath("sales/contacts"),
|
||||
icon: <FeatherUsers />,
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesCompanies,
|
||||
title: t("admin.sales.navigation.companies"),
|
||||
path: adminSidebarPath("sales/companies"),
|
||||
icon: <FeatherBuilding2 />,
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesImportExport,
|
||||
title: t("admin.sales.navigation.importExport"),
|
||||
path: adminSidebarPath("sales/import-export"),
|
||||
icon: <FeatherDatabase />,
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
],
|
||||
anyPermissions: [ADMIN_AREA_ACCESS.sales],
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesCommunication,
|
||||
title: t("admin.sales.navigation.communicationSection"),
|
||||
path: adminSidebarPath("sales/email/inbox"),
|
||||
items: [
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesEmail,
|
||||
title: t("admin.sales.navigation.email"),
|
||||
path: adminSidebarPath("sales/email/inbox"),
|
||||
icon: <FeatherMail />,
|
||||
permission: "admin_sales.email.send",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesCalls,
|
||||
title: t("admin.sales.navigation.calls"),
|
||||
path: adminSidebarPath("sales/calls"),
|
||||
icon: <FeatherPhone />,
|
||||
permission: "admin_sales.phone.call",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesBookings,
|
||||
title: t("admin.sales.navigation.bookings"),
|
||||
path: adminSidebarPath("sales/bookings"),
|
||||
icon: <FeatherCalendarDays />,
|
||||
permission: "admin_sales.booking.manage",
|
||||
},
|
||||
],
|
||||
anyPermissions: ["admin_sales.email.send", "admin_sales.phone.call", "admin_sales.booking.manage"],
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.market",
|
||||
title: t("segments.market"),
|
||||
@@ -189,48 +372,49 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
icon: <IconEmails />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.emailMarketing.campaigns", title: t("app.sidebar.campaigns"), path: adminSidebarPath("email-marketing/campaigns"), permission: "admin.emails.view" },
|
||||
{ id: "ui.nav.admin.emailMarketing.senders", title: t("app.sidebar.senders"), path: adminSidebarPath("email-marketing/senders"), permission: "admin.emails.view" },
|
||||
{ id: "ui.nav.admin.emailMarketing.activity", title: t("app.sidebar.activity"), path: adminSidebarPath("email-marketing/activity"), permission: "admin.emails.view" },
|
||||
{
|
||||
id: "ui.nav.admin.emailMarketing.campaigns",
|
||||
title: t("app.sidebar.campaigns"),
|
||||
path: adminSidebarPath("email-marketing/campaigns"),
|
||||
permission: "admin.emails.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.emailMarketing.senders",
|
||||
title: t("app.sidebar.senders"),
|
||||
path: adminSidebarPath("email-marketing/senders"),
|
||||
permission: "admin.emails.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.emailMarketing.activity",
|
||||
title: t("app.sidebar.activity"),
|
||||
path: adminSidebarPath("email-marketing/activity"),
|
||||
permission: "admin.emails.view",
|
||||
},
|
||||
],
|
||||
permission: "admin.emails.view",
|
||||
}),
|
||||
{
|
||||
id: UI_NAV_IDS.adminMarketing,
|
||||
title: t("app.sidebar.marketing"),
|
||||
path: adminSidebarPath("marketing-leads"),
|
||||
path: adminSidebarPath("marketing-integrations"),
|
||||
icon: <IconAnalytics />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.marketing.leads", title: t("app.sidebar.leads"), path: adminSidebarPath("marketing-leads"), permission: "admin.marketing.leads.view" },
|
||||
{ id: "ui.nav.admin.marketing.funnels", title: t("app.sidebar.funnels"), path: adminSidebarPath("marketing-funnels"), permission: "admin.marketing.funnels.view" },
|
||||
{ id: "ui.nav.admin.marketing.integrations", title: t("app.sidebar.integrations"), path: adminSidebarPath("marketing-integrations"), permission: "admin.marketing.integrations.view" },
|
||||
{ id: "ui.nav.admin.marketing.emailSequences", title: t("app.sidebar.emailSequences"), path: adminSidebarPath("email-sequences"), permission: "admin.marketing.leads.view" },
|
||||
{
|
||||
id: "ui.nav.admin.marketing.integrations",
|
||||
title: t("app.sidebar.integrations"),
|
||||
path: adminSidebarPath("marketing-integrations"),
|
||||
permission: "admin.marketing.integrations.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.marketing.emailSequences",
|
||||
title: t("app.sidebar.emailSequences"),
|
||||
path: adminSidebarPath("email-sequences"),
|
||||
permission: "admin.marketing.leads.view",
|
||||
},
|
||||
],
|
||||
permission: "admin.marketing.leads.view",
|
||||
},
|
||||
...enabledAdminRouteItem("knowledge-base", {
|
||||
id: UI_NAV_IDS.adminKnowledgeBase,
|
||||
title: t("app.sidebar.knowledgeBase"),
|
||||
path: adminSidebarPath("knowledge-base"),
|
||||
icon: <IconDocs className="size-4" />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.knowledgeBase.bases", title: t("app.sidebar.bases"), path: adminSidebarPath("knowledge-base/bases"), permission: "admin.kb.view" },
|
||||
{ id: "ui.nav.admin.knowledgeBase.articles", title: t("app.sidebar.articles"), path: adminSidebarPath("knowledge-base/articles"), permission: "admin.kb.view" },
|
||||
],
|
||||
permission: "admin.kb.view",
|
||||
}),
|
||||
...enabledAdminRouteItem("help-desk", {
|
||||
id: UI_NAV_IDS.adminHelpDesk,
|
||||
title: t("app.sidebar.helpDesk"),
|
||||
path: adminSidebarPath("help-desk"),
|
||||
icon: <IconHelpDesk className="size-4" />,
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ id: "ui.nav.admin.helpDesk.feedback", title: t("app.sidebar.feedback"), path: adminSidebarPath("help-desk/feedback") },
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -244,11 +428,53 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
title: t("app.sidebar.settings"),
|
||||
icon: <IconSettings />,
|
||||
path: adminSidebarPath("settings"),
|
||||
isCollapsible: true,
|
||||
anyPermissions: [
|
||||
"admin_identity.sessions.read",
|
||||
"admin_identity.users.read",
|
||||
"admin_identity.roles.read",
|
||||
"admin.settings.general.view",
|
||||
"admin.pricing.view",
|
||||
"admin.settings.authentication.view",
|
||||
"admin.emails.view",
|
||||
"admin_sales.crm.write",
|
||||
"admin_sales.crm.assign",
|
||||
"admin_sales.crm.read",
|
||||
"admin_sales.integrations.manage",
|
||||
"admin.settings.danger.reset",
|
||||
],
|
||||
isCollapsible: false,
|
||||
activePaths: [adminSidebarPath("settings")],
|
||||
items: [
|
||||
{ id: "ui.nav.admin.settings.profile", title: t("settings.admin.profile.title"), path: adminSidebarPath("settings/profile") },
|
||||
{ id: "ui.nav.admin.settings.general", title: t("settings.admin.general.title"), path: adminSidebarPath("settings/general"), permission: "admin.settings.general.view" },
|
||||
{ id: "ui.nav.admin.settings.pricing", title: t("settings.admin.pricing.title"), path: adminSidebarPath("settings/pricing"), permission: "admin.pricing.view" },
|
||||
{
|
||||
id: "ui.nav.admin.settings.profile",
|
||||
title: t("admin.sales.security.title"),
|
||||
path: adminSidebarPath("settings/security"),
|
||||
permission: "admin_identity.sessions.read",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.settings.adminUsers",
|
||||
title: t("admin.sales.adminUsers.title"),
|
||||
path: adminSidebarPath("settings/admin-users"),
|
||||
permission: ADMIN_AREA_ACCESS.employees,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.settings.adminRoles",
|
||||
title: t("admin.sales.adminRoles.title"),
|
||||
path: adminSidebarPath("settings/admin-roles"),
|
||||
permission: ADMIN_AREA_ACCESS.roles,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.settings.general",
|
||||
title: t("settings.admin.general.title"),
|
||||
path: adminSidebarPath("settings/general"),
|
||||
permission: "admin.settings.general.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.settings.pricing",
|
||||
title: t("settings.admin.pricing.title"),
|
||||
path: adminSidebarPath("settings/pricing"),
|
||||
permission: "admin.pricing.view",
|
||||
},
|
||||
{
|
||||
id: "ui.nav.admin.settings.authentication",
|
||||
title: t("settings.admin.authentication.title"),
|
||||
@@ -261,9 +487,30 @@ export const AdminSidebar = ({ t, appConfiguration }: Props): SideBarItem[] => [
|
||||
path: adminSidebarPath("settings/transactional-emails"),
|
||||
permission: "admin.emails.view",
|
||||
},
|
||||
{ id: "ui.nav.admin.settings.accountTypes", title: t("settings.admin.tenants.types.title"), path: adminSidebarPath("settings/accounts/types"), permission: "admin.accountTypes.view" },
|
||||
{ id: "ui.nav.admin.settings.cookies", title: t("settings.admin.cookies.title"), path: adminSidebarPath("settings/cookies"), permission: "admin.settings.cookies.view" },
|
||||
{ id: "ui.nav.admin.settings.cache", title: t("settings.admin.cache.title"), path: adminSidebarPath("settings/cache"), permission: "admin.settings.general.update" },
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesPipelineSettings,
|
||||
title: t("admin.sales.navigation.pipelineSettings"),
|
||||
path: adminSidebarPath("settings/pipelines"),
|
||||
permission: "admin_sales.crm.write",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesLeadSettings,
|
||||
title: t("admin.sales.navigation.leadSettings"),
|
||||
path: adminSidebarPath("settings/leads"),
|
||||
permission: "admin_sales.crm.assign",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesFieldsTags,
|
||||
title: t("admin.sales.navigation.fieldsTags"),
|
||||
path: adminSidebarPath("settings/fields-tags"),
|
||||
permission: "admin_sales.crm.read",
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.adminSalesTelephonySettings,
|
||||
title: t("admin.sales.navigation.telephonySettings"),
|
||||
path: adminSidebarPath("settings/telephony"),
|
||||
permission: "admin_sales.integrations.manage",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
+169
-19
@@ -41,6 +41,17 @@ describe("AppSidebar", () => {
|
||||
"workflow-engine": { allowed: true },
|
||||
"ai-credits": { allowed: true },
|
||||
};
|
||||
const fullProductAccess = {
|
||||
...businessProductAccess,
|
||||
leads: { allowed: true },
|
||||
tasks: { allowed: true },
|
||||
files: { allowed: true },
|
||||
hr: { allowed: true },
|
||||
forms: { allowed: true },
|
||||
booking: { allowed: true },
|
||||
integrations: { allowed: true },
|
||||
chat: { allowed: true },
|
||||
};
|
||||
|
||||
it("returns the expected static sidebar items", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
@@ -48,7 +59,9 @@ describe("AppSidebar", () => {
|
||||
|
||||
const result = AppSidebar({ t, i18n, tenantId: "test-user", appConfiguration: null });
|
||||
const serialized = JSON.stringify(result);
|
||||
const secondary = result.find((group) => group.isSecondary);
|
||||
|
||||
expect(result).toEqual(expect.arrayContaining([expect.objectContaining({ id: "ui.nav.app.overview", title: "" })]));
|
||||
expect(result[0].items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -56,14 +69,9 @@ describe("AppSidebar", () => {
|
||||
title: "app.sidebar.dashboard",
|
||||
path: "/test-user/dashboard",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: UI_NAV_IDS.appNotifications,
|
||||
title: "app.sidebar.notifications",
|
||||
path: "/test-user/notifications",
|
||||
}),
|
||||
])
|
||||
);
|
||||
expect(result[1]).toMatchObject({
|
||||
expect(secondary).toMatchObject({
|
||||
title: "",
|
||||
path: "",
|
||||
isSecondary: true,
|
||||
@@ -88,6 +96,8 @@ describe("AppSidebar", () => {
|
||||
expect(serialized).not.toContain("/admin/");
|
||||
expect(serialized).not.toContain("/blog");
|
||||
expect(serialized).not.toContain("/pricing");
|
||||
expect(serialized).not.toContain("/search");
|
||||
expect(serialized).not.toContain("/notifications");
|
||||
expect(serialized).not.toContain("/email-marketing");
|
||||
expect(serialized).not.toContain("/workflow-engine");
|
||||
expect(serialized).not.toContain("/widgets");
|
||||
@@ -95,13 +105,48 @@ describe("AppSidebar", () => {
|
||||
expect(serialized).not.toContain("/sites/");
|
||||
});
|
||||
|
||||
it("groups plan-backed product links into clear app navigation sections", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
|
||||
const result = AppSidebar({ t, i18n, tenantId: "business", appConfiguration: null, productAccess: businessProductAccess });
|
||||
|
||||
expect(result).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ id: "ui.nav.app.overview", title: "" }),
|
||||
expect.objectContaining({ id: "ui.nav.app.customers", title: "app.sidebar.sections.customers" }),
|
||||
expect.objectContaining({ id: "ui.nav.app.projects", title: "app.sidebar.sections.projects" }),
|
||||
expect.objectContaining({ id: "ui.nav.app.communication", title: "app.sidebar.sections.communication" }),
|
||||
expect.objectContaining({ id: "ui.nav.app.automationPlatform", title: "app.sidebar.sections.automationPlatform" }),
|
||||
])
|
||||
);
|
||||
|
||||
expect(result.find((group) => group.id === "ui.nav.app.overview")?.items?.map((item) => item.id)).toEqual([UI_NAV_IDS.appDashboard]);
|
||||
expect(result.find((group) => group.id === "ui.nav.app.customers")?.items?.map((item) => item.id)).toEqual([UI_NAV_IDS.appCrm]);
|
||||
expect(result.find((group) => group.id === "ui.nav.app.projects")?.items?.map((item) => item.id)).toEqual([
|
||||
UI_NAV_IDS.appProjects,
|
||||
UI_NAV_IDS.appPlantafel,
|
||||
]);
|
||||
expect(result.find((group) => group.id === "ui.nav.app.communication")?.items?.map((item) => item.id)).toEqual([
|
||||
UI_NAV_IDS.appEmails,
|
||||
UI_NAV_IDS.appEmailMarketing,
|
||||
]);
|
||||
expect(result.find((group) => group.id === "ui.nav.app.automationPlatform")?.items?.map((item) => item.id)).toEqual([UI_NAV_IDS.appAutomation]);
|
||||
expect(result.find((group) => group.id === "ui.nav.app.apiDeveloper")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("renders plan-backed core feature links from product access decisions", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
|
||||
const starter = JSON.stringify(AppSidebar({ t, i18n, tenantId: "starter", appConfiguration: null, productAccess: starterProductAccess }));
|
||||
const pro = JSON.stringify(AppSidebar({ t, i18n, tenantId: "pro", appConfiguration: null, productAccess: proProductAccess }));
|
||||
const business = JSON.stringify(AppSidebar({ t, i18n, tenantId: "business", appConfiguration: null, productAccess: businessProductAccess }));
|
||||
const starterResult = AppSidebar({ t, i18n, tenantId: "starter", appConfiguration: null, productAccess: starterProductAccess });
|
||||
const proResult = AppSidebar({ t, i18n, tenantId: "pro", appConfiguration: null, productAccess: proProductAccess });
|
||||
const businessResult = AppSidebar({ t, i18n, tenantId: "business", appConfiguration: null, productAccess: businessProductAccess });
|
||||
const starter = JSON.stringify(starterResult);
|
||||
const pro = JSON.stringify(proResult);
|
||||
const business = JSON.stringify(businessResult);
|
||||
const primaryPaths = (groups: ReturnType<typeof AppSidebar>) =>
|
||||
groups.filter((group) => !group.isSecondary).flatMap((group) => group.items?.map((item) => item.path) ?? []);
|
||||
|
||||
expect(starter).toContain("/starter/contacts");
|
||||
expect(starter).toContain("/starter/projects");
|
||||
@@ -109,7 +154,7 @@ describe("AppSidebar", () => {
|
||||
expect(starter).not.toContain("/starter/email-marketing");
|
||||
expect(starter).not.toContain("/starter/emails");
|
||||
expect(starter).not.toContain("/starter/automations");
|
||||
expect(starter).not.toContain("/starter/settings/api");
|
||||
expect(primaryPaths(starterResult)).not.toContain("/starter/api");
|
||||
expect(starter).not.toContain("/starter/workflow-engine");
|
||||
|
||||
expect(pro).toContain("/pro/contacts");
|
||||
@@ -117,15 +162,122 @@ describe("AppSidebar", () => {
|
||||
expect(pro).toContain("/pro/email-marketing");
|
||||
expect(pro).toContain("/pro/emails");
|
||||
expect(pro).not.toContain("/pro/automations");
|
||||
expect(pro).toContain("/pro/settings/api");
|
||||
expect(primaryPaths(proResult)).not.toContain("/pro/api");
|
||||
expect(pro).not.toContain("/pro/workflow-engine");
|
||||
|
||||
expect(business).toContain("/business/contacts");
|
||||
expect(business).toContain("/business/projects");
|
||||
expect(business).toContain("/business/email-marketing");
|
||||
expect(business).toContain("/business/automations");
|
||||
expect(business).toContain("/business/settings/api");
|
||||
expect(business).toContain("/business/workflow-engine");
|
||||
expect(primaryPaths(businessResult)).not.toContain("/business/api");
|
||||
expect(business).not.toContain("/business/workflow-engine");
|
||||
});
|
||||
|
||||
it("shows telephony only with product access and carries the read permission gate", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
const withoutTelephony = AppSidebar({ t, i18n, tenantId: "acme", appConfiguration: null, productAccess: businessProductAccess });
|
||||
const withTelephony = AppSidebar({
|
||||
t,
|
||||
i18n,
|
||||
tenantId: "acme",
|
||||
appConfiguration: null,
|
||||
productAccess: { ...businessProductAccess, telephony: { allowed: true } },
|
||||
});
|
||||
|
||||
expect(JSON.stringify(withoutTelephony)).not.toContain("/acme/calls");
|
||||
expect(withTelephony.flatMap((group) => group.items ?? [])).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: UI_NAV_IDS.appTelephony,
|
||||
title: "telephony.nav.title",
|
||||
path: "/acme/calls",
|
||||
permission: "telephony.read_own",
|
||||
}),
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it("shows team chat only with product access and carries the member read gate", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
const withoutChat = AppSidebar({ t, i18n, tenantId: "acme", appConfiguration: null, productAccess: businessProductAccess });
|
||||
const withChat = AppSidebar({
|
||||
t,
|
||||
i18n,
|
||||
tenantId: "acme",
|
||||
appConfiguration: null,
|
||||
productAccess: { ...businessProductAccess, chat: { allowed: true } },
|
||||
});
|
||||
|
||||
expect(JSON.stringify(withoutChat)).not.toContain("/acme/chat");
|
||||
expect(withChat.flatMap((group) => group.items ?? [])).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: UI_NAV_IDS.appChat,
|
||||
title: "chat.nav.title",
|
||||
path: "/acme/chat",
|
||||
permission: "chat.read_own_channels",
|
||||
}),
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps balanced global destinations while consolidating the appointment area", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
const result = AppSidebar({ t, i18n, tenantId: "full", appConfiguration: null, productAccess: fullProductAccess });
|
||||
const globalItems = result.filter((group) => !group.isSecondary).flatMap((group) => group.items ?? []);
|
||||
|
||||
expect(globalItems.map((item) => item.id)).toEqual([
|
||||
UI_NAV_IDS.appDashboard,
|
||||
"ui.nav.app.tasks",
|
||||
UI_NAV_IDS.appCrm,
|
||||
UI_NAV_IDS.appLeads,
|
||||
UI_NAV_IDS.appProjects,
|
||||
UI_NAV_IDS.appPlantafel,
|
||||
"ui.nav.app.files",
|
||||
UI_NAV_IDS.appEmails,
|
||||
UI_NAV_IDS.appEmailMarketing,
|
||||
UI_NAV_IDS.appForms,
|
||||
"ui.nav.app.appointments",
|
||||
UI_NAV_IDS.appChat,
|
||||
"ui.nav.app.hr",
|
||||
UI_NAV_IDS.appPasswordSafe,
|
||||
UI_NAV_IDS.appAutomation,
|
||||
]);
|
||||
// WF-P8 S00: boards start page is the consolidated module entry, so the
|
||||
// projects group is back to at most three entries.
|
||||
expect(result.find((group) => group.id === "ui.nav.app.projects")?.items).toHaveLength(3);
|
||||
expect(globalItems.find((item) => item.id === "ui.nav.app.appointments")?.contextItems).toHaveLength(3);
|
||||
expect(globalItems.find((item) => item.id === UI_NAV_IDS.appPasswordSafe)).toMatchObject({
|
||||
path: "/full/passwords",
|
||||
anyPermissions: ["hr.passwordsafe.use", "hr.passwordsafe.admin"],
|
||||
});
|
||||
});
|
||||
|
||||
it("reaches the lead statistics through the leads sub-sidenav, not through the inbox screen", () => {
|
||||
const t = vi.fn().mockImplementation((v: string) => v) as any;
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
|
||||
const result = AppSidebar({ t, i18n, tenantId: "acme", appConfiguration: null, productAccess: fullProductAccess });
|
||||
const leads = result.flatMap((group) => group.items ?? []).find((item) => item.id === UI_NAV_IDS.appLeads);
|
||||
|
||||
expect(leads?.contextItems?.map((item) => item.path)).toEqual([
|
||||
"/acme/leads",
|
||||
"/acme/leads-statistics",
|
||||
"/acme/admin/lead-sources",
|
||||
"/acme/admin/lead-anti-spam",
|
||||
]);
|
||||
// Same permission as the inbox: everyone who sees leads sees their statistics.
|
||||
expect(leads?.contextItems?.find((item) => item.id === "ui.nav.app.leads.statistics")).toMatchObject({
|
||||
title: "leads.statistics.title",
|
||||
permission: "leads.read_own",
|
||||
});
|
||||
// The statistics path must stay highlighted as part of the leads workspace —
|
||||
// that is also what puts "Leads" in front of the breadcrumb.
|
||||
expect(leads?.activePaths).toContain("/acme/leads-statistics");
|
||||
expect(existsSync(resolveRepoPath("apps/web/app/routes/app.$tenant/leads-statistics.tsx"))).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps static tenant sidebar targets backed by registered route files", () => {
|
||||
@@ -133,15 +285,16 @@ describe("AppSidebar", () => {
|
||||
const i18n = { exists: vi.fn().mockReturnValue(false) } as any;
|
||||
const result = AppSidebar({ t, i18n, tenantId: "acme", appConfiguration: null, productAccess: businessProductAccess });
|
||||
const serialized = JSON.stringify(result);
|
||||
const primaryPaths = result.filter((group) => !group.isSecondary).flatMap((group) => group.items?.map((item) => item.path) ?? []);
|
||||
|
||||
expect(serialized).toContain("/acme/dashboard");
|
||||
expect(serialized).toContain("/acme/notifications");
|
||||
expect(serialized).not.toContain("/acme/notifications");
|
||||
expect(serialized).toContain("/acme/contacts");
|
||||
expect(serialized).toContain("/acme/projects");
|
||||
expect(serialized).toContain("/acme/automations");
|
||||
expect(serialized).toContain("/acme/email-marketing");
|
||||
expect(serialized).toContain("/acme/workflow-engine");
|
||||
expect(serialized).toContain("/acme/settings/api");
|
||||
expect(serialized).not.toContain("/acme/workflow-engine");
|
||||
expect(primaryPaths).not.toContain("/acme/api");
|
||||
expect(serialized).not.toContain("/acme/settings/credits");
|
||||
expect(serialized).toContain("/acme/settings");
|
||||
expect(serialized).toContain("/acme/settings/profile");
|
||||
@@ -150,15 +303,12 @@ describe("AppSidebar", () => {
|
||||
|
||||
[
|
||||
"apps/web/app/routes/app.$tenant/dashboard.tsx",
|
||||
"apps/web/app/routes/app.$tenant/notifications.tsx",
|
||||
"apps/web/app/routes/app.$tenant/contacts._index.tsx",
|
||||
"apps/web/app/routes/app.$tenant/projects._index.tsx",
|
||||
"apps/web/app/routes/app.$tenant/automations._index.tsx",
|
||||
"apps/web/app/routes/app.$tenant/automations.$id.edit.tsx",
|
||||
"apps/web/app/routes/app.$tenant/automations.templates._index.tsx",
|
||||
"apps/web/app/routes/app.$tenant/email-marketing.tsx",
|
||||
"apps/web/app/routes/app.$tenant/__workflows/workflow-engine.tsx",
|
||||
"apps/web/app/routes/app.$tenant/settings/api/index.tsx",
|
||||
"apps/web/app/routes/app.$tenant/settings.tsx",
|
||||
"apps/web/app/routes/app.$tenant/settings/profile.tsx",
|
||||
].forEach((routeFile) => {
|
||||
|
||||
+329
-183
@@ -4,20 +4,26 @@ import { AppConfiguration } from "~/utils/db/appConfiguration.db.server";
|
||||
import IconSettings from "~/components/layouts/icons/IconSettings";
|
||||
import IconDashboard from "~/components/layouts/icons/IconDashboard";
|
||||
import IconAdmin from "~/components/layouts/icons/IconAdmin";
|
||||
import IconNotifications from "~/components/layouts/icons/IconNotifications";
|
||||
import IconEmails from "~/components/layouts/icons/IconEmails";
|
||||
import IconKeys from "~/components/layouts/icons/IconKeys";
|
||||
import IconWorkflows from "~/components/layouts/icons/IconWorkflows";
|
||||
import AddressBookIcon from "~/components/ui/icons/crm/AddressBookIcon";
|
||||
import IconDocs from "~/components/layouts/icons/IconDocs";
|
||||
import ViewListIcon from "~/components/ui/icons/ViewListIcon";
|
||||
import CalendarIcon from "~/components/ui/icons/CalendarIcon";
|
||||
import CalendarCheckIcon from "~/components/ui/icons/CalendarCheckIcon";
|
||||
import CalendarClockIcon from "~/components/ui/icons/CalendarClockIcon";
|
||||
import CalendarDaysIcon from "~/components/ui/icons/CalendarDaysIcon";
|
||||
import CalendarRangeIcon from "~/components/ui/icons/CalendarRangeIcon";
|
||||
import InboxIcon from "~/components/ui/icons/emails/InboxIcon";
|
||||
import MegaphoneIcon from "~/components/ui/icons/emails/MegaphoneIcon";
|
||||
import { UI_NAV_IDS } from "~/application/ui/uiRegistry";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import { absoluteAdminPath, type PublicDomainRoutingConfig } from "~/utils/app/CrossHostUrls";
|
||||
import { resolveConnectorNavState } from "~/utils/connector/connectorNavState";
|
||||
import { WALKING_SKELETON_MODULE_KEY } from "~/modules/walkingSkeleton/constants";
|
||||
import { SearchIcon } from "~/components/ui/icons/vendor";
|
||||
import { ClipboardIcon, FileTextIcon, LockIcon, PhoneIcon, ShieldCheckIcon, TrendingUpIcon, UserIcon } from "~/components/ui/icons/vendor";
|
||||
import BoardIcon from "~/components/ui/icons/BoardIcon";
|
||||
import ComboChartIcon from "~/components/ui/icons/ComboChartIcon";
|
||||
import DataSourceIcon from "~/components/ui/icons/DataSourceIcon";
|
||||
import TableIcon from "~/components/ui/icons/TableIcon";
|
||||
import ChatAltIcon from "~/components/ui/icons/ChatAltIcon";
|
||||
|
||||
type Props = {
|
||||
t: TFunction;
|
||||
@@ -36,35 +42,27 @@ export const AppSidebar = ({ t, tenantId, routing, productAccess }: Props): Side
|
||||
const walkingSkeletonDecision = productAccess?.[WALKING_SKELETON_MODULE_KEY];
|
||||
const walkingSkeletonState = walkingSkeletonDecision ? resolveConnectorNavState(walkingSkeletonDecision) : "hidden";
|
||||
|
||||
const productCoreItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("search")
|
||||
const overviewItems: SideBarItem[] = [
|
||||
...(hasDashboardAccess
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appSearch,
|
||||
title: t("search.nav.title"),
|
||||
path: tenantPath("search"),
|
||||
icon: <SearchIcon />,
|
||||
permission: "search.use" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("automation")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appAutomation,
|
||||
title: t("automation.nav.title"),
|
||||
path: tenantPath("automations"),
|
||||
icon: <IconWorkflows />,
|
||||
permission: "automation.read" as const,
|
||||
id: UI_NAV_IDS.appDashboard,
|
||||
title: t("app.sidebar.dashboard"),
|
||||
path: tenantPath("dashboard"),
|
||||
icon: <IconDashboard />,
|
||||
permission: "dashboard.read" as const,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN, TenantUserType.MEMBER],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const crmContextItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("crm-basic")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appCrm,
|
||||
title: t("crm:title"),
|
||||
// R-P6: typed CRM contacts replace the entity-builder CRM (/crm → /contacts).
|
||||
id: "ui.nav.app.crm.contacts",
|
||||
title: t("crm.contacts.title"),
|
||||
path: tenantPath("contacts"),
|
||||
icon: <AddressBookIcon />,
|
||||
permission: "crm.read_own" as const,
|
||||
@@ -77,143 +75,280 @@ export const AppSidebar = ({ t, tenantId, routing, productAccess }: Props): Side
|
||||
id: UI_NAV_IDS.appLeads,
|
||||
title: t("leads.nav.title"),
|
||||
path: tenantPath("leads"),
|
||||
icon: <ViewListIcon />,
|
||||
icon: <TrendingUpIcon />,
|
||||
permission: "leads.read_own" as const,
|
||||
// Leads is a workspace area: inbox/board plus the two admin screens
|
||||
// share an inner sub-sidenav (rendered by app.$tenant when >1 item
|
||||
// is visible — non-admins only see the inbox, so no rail for them).
|
||||
activePaths: [tenantPath("leads"), tenantPath("leads-statistics"), tenantPath("admin/lead-sources"), tenantPath("admin/lead-anti-spam")],
|
||||
contextItems: [
|
||||
{
|
||||
id: "ui.nav.app.leads.inbox",
|
||||
title: t("leads.list.title"),
|
||||
path: tenantPath("leads"),
|
||||
icon: <InboxIcon />,
|
||||
permission: "leads.read_own" as const,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.leads.statistics",
|
||||
title: t("leads.statistics.title"),
|
||||
path: tenantPath("leads-statistics"),
|
||||
icon: <ComboChartIcon />,
|
||||
permission: "leads.read_own" as const,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.leads.sources",
|
||||
title: t("leads.sources.title"),
|
||||
path: tenantPath("admin/lead-sources"),
|
||||
icon: <DataSourceIcon />,
|
||||
permission: "leads.admin" as const,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.leads.antiSpam",
|
||||
title: t("leads.antiSpam.title"),
|
||||
path: tenantPath("admin/lead-anti-spam"),
|
||||
icon: <ShieldCheckIcon />,
|
||||
permission: "leads.admin" as const,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const projectContextItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("projects")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appProjects,
|
||||
title: t("projects.nav.title"),
|
||||
path: tenantPath("projects"),
|
||||
icon: <ViewListIcon />,
|
||||
// WF-P8 S00 (Subframe 2026-07-15): the boards start page is the
|
||||
// module entry; the kanban/list/detail routes under /projects keep
|
||||
// this consolidated entry highlighted via activePaths.
|
||||
id: "ui.nav.app.projects.boards",
|
||||
title: t("projects.boards.nav"),
|
||||
path: tenantPath("projects/boards"),
|
||||
icon: <BoardIcon />,
|
||||
permission: "projects.read_own" as const,
|
||||
activePaths: [tenantPath("projects")],
|
||||
// Plantafel is its own sidebar entry but lives under /projects.
|
||||
excludePaths: [tenantPath("projects/plantafel")],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("files")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.files",
|
||||
title: t("files.nav.title"),
|
||||
path: tenantPath("files"),
|
||||
icon: <IconDocs />,
|
||||
permission: "files.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("tasks")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.tasks",
|
||||
title: t("tasks.nav.title"),
|
||||
path: tenantPath("tasks"),
|
||||
icon: <ViewListIcon />,
|
||||
permission: "tasks.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("hr")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.hr",
|
||||
title: t("hr.nav.title"),
|
||||
path: tenantPath("hr"),
|
||||
icon: <AddressBookIcon />,
|
||||
permission: "hr.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("integrations")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.integrations",
|
||||
title: t("integrations.nav.title"),
|
||||
path: tenantPath("integrations"),
|
||||
icon: <IconWorkflows />,
|
||||
permission: "integrations.read" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("integrations")
|
||||
? [
|
||||
{
|
||||
// AK-P16a · calendar reuses the integrations feature gate (it is an
|
||||
// Apps-Engine integration); the entry is gated by calendar.connect_own.
|
||||
id: UI_NAV_IDS.appCalendar,
|
||||
title: t("calendar.nav.title"),
|
||||
path: tenantPath("calendar"),
|
||||
icon: <CalendarIcon />,
|
||||
permission: "calendar.connect_own" as const,
|
||||
id: UI_NAV_IDS.appPlantafel,
|
||||
title: t("projects.nav.plantafel"),
|
||||
path: tenantPath("projects/plantafel"),
|
||||
icon: <CalendarRangeIcon />,
|
||||
permission: "plantafel.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const communicationContextItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("email-inbox")
|
||||
? [
|
||||
{
|
||||
// VA-P23 · mailbox sync inbox — own `email-inbox` feature gate; the
|
||||
// entry is gated by email.read_own (own-mailbox visibility, M09 I).
|
||||
id: UI_NAV_IDS.appEmails,
|
||||
title: t("emailInbox.nav.title"),
|
||||
path: tenantPath("emails"),
|
||||
icon: <IconEmails className="h-5 w-5" />,
|
||||
icon: <IconEmails />,
|
||||
permission: "email.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("booking")
|
||||
? [
|
||||
{
|
||||
// AK-P16b · Booking module — own `booking` feature gate; the entry is
|
||||
// gated by bookings.read_own (every provider can see their own bookings).
|
||||
id: UI_NAV_IDS.appBookings,
|
||||
title: t("bookings.nav.title"),
|
||||
path: tenantPath("bookings"),
|
||||
icon: <CalendarIcon />,
|
||||
permission: "bookings.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("forms")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appForms,
|
||||
title: t("settings.forms.admin.title"),
|
||||
path: tenantPath("forms"),
|
||||
icon: <ViewListIcon />,
|
||||
permission: "forms.basic" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("email-marketing")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appEmailMarketing,
|
||||
title: t("emailMarketing:title"),
|
||||
path: tenantPath("email-marketing"),
|
||||
icon: <IconEmails />,
|
||||
icon: <MegaphoneIcon />,
|
||||
permission: "emailMarketing.view" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("workflow-engine")
|
||||
...(hasFeatureAccess("forms")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appWorkflowEngine,
|
||||
title: t("workflows.title"),
|
||||
path: tenantPath("workflow-engine"),
|
||||
id: UI_NAV_IDS.appForms,
|
||||
title: t("settings.forms.admin.title"),
|
||||
path: tenantPath("forms"),
|
||||
icon: <TableIcon />,
|
||||
permission: "forms.basic" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("telephony")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appTelephony,
|
||||
title: t("telephony.nav.title"),
|
||||
path: tenantPath("calls"),
|
||||
icon: <PhoneIcon />,
|
||||
permission: "telephony.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const appointmentContextItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("integrations")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appCalendar,
|
||||
title: t("calendar.nav.title"),
|
||||
path: tenantPath("calendar"),
|
||||
icon: <CalendarDaysIcon />,
|
||||
permission: "calendar.connect_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("booking")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appBookings,
|
||||
title: t("bookings.nav.title"),
|
||||
path: tenantPath("bookings"),
|
||||
icon: <CalendarCheckIcon />,
|
||||
permission: "bookings.read_own" as const,
|
||||
},
|
||||
{
|
||||
id: UI_NAV_IDS.appAvailability,
|
||||
title: t("bookings.availability.title"),
|
||||
path: tenantPath("availability"),
|
||||
icon: <CalendarClockIcon />,
|
||||
permission: "bookings.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const workspaceArea = ({
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
contextItems,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: SideBarItem["icon"];
|
||||
contextItems: SideBarItem[];
|
||||
}): SideBarItem | null => {
|
||||
const firstItem = contextItems[0];
|
||||
if (!firstItem) return null;
|
||||
return {
|
||||
id,
|
||||
title,
|
||||
path: firstItem.path,
|
||||
icon,
|
||||
activePaths: contextItems.map((item) => item.path),
|
||||
contextItems,
|
||||
};
|
||||
};
|
||||
|
||||
const appointmentsArea = workspaceArea({
|
||||
id: "ui.nav.app.appointments",
|
||||
title: t("app.sidebar.areas.appointments"),
|
||||
icon: <CalendarDaysIcon />,
|
||||
contextItems: appointmentContextItems,
|
||||
});
|
||||
|
||||
const taskItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("tasks")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.tasks",
|
||||
title: t("tasks.nav.title"),
|
||||
path: tenantPath("tasks"),
|
||||
icon: <ClipboardIcon />,
|
||||
permission: "tasks.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const fileItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("files")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.files",
|
||||
title: t("files.nav.title"),
|
||||
path: tenantPath("files"),
|
||||
icon: <FileTextIcon />,
|
||||
permission: "files.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const hrItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("hr")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appHr,
|
||||
title: t("hr.nav.title"),
|
||||
path: tenantPath("hr"),
|
||||
icon: <UserIcon />,
|
||||
permission: "hr.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const passwordSafeItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("hr")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appPasswordSafe,
|
||||
title: t("hr.passwordSafe.title"),
|
||||
path: tenantPath("passwords"),
|
||||
icon: <LockIcon />,
|
||||
anyPermissions: ["hr.passwordsafe.use" as const, "hr.passwordsafe.admin" as const],
|
||||
activePaths: [tenantPath("passwords")],
|
||||
contextItems: [
|
||||
{
|
||||
id: "ui.nav.app.passwordSafe.vaults",
|
||||
title: t("hr.passwordSafe.nav.vaults"),
|
||||
path: tenantPath("passwords"),
|
||||
icon: <LockIcon />,
|
||||
permission: "hr.passwordsafe.use" as const,
|
||||
exact: true,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.passwordSafe.admin",
|
||||
title: t("hr.passwordSafe.nav.admin"),
|
||||
path: tenantPath("passwords/admin"),
|
||||
icon: <ShieldCheckIcon />,
|
||||
permission: "hr.passwordsafe.admin" as const,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const chatItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("chat")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appChat,
|
||||
title: t("chat.nav.title"),
|
||||
path: tenantPath("chat"),
|
||||
icon: <ChatAltIcon />,
|
||||
permission: "chat.read_own_channels" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
const automationItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("automation")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appAutomation,
|
||||
title: t("automation.nav.title"),
|
||||
path: tenantPath("automations"),
|
||||
icon: <IconWorkflows />,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("api")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appApi,
|
||||
title: t("models.apiKey.plural"),
|
||||
path: tenantPath("settings/api"),
|
||||
icon: <IconKeys />,
|
||||
permission: "automation.read" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
@@ -230,70 +365,81 @@ export const AppSidebar = ({ t, tenantId, routing, productAccess }: Props): Side
|
||||
: []),
|
||||
];
|
||||
|
||||
const appItem: SideBarItem = {
|
||||
id: "ui.nav.app.primary",
|
||||
const startItems = [...overviewItems, ...taskItems];
|
||||
const customerItems = crmContextItems.map((item, index) => (index === 0 ? { ...item, id: UI_NAV_IDS.appCrm, title: t("crm:title") } : item));
|
||||
const projectItems = [...projectContextItems.map((item, index) => (index === 0 ? { ...item, id: UI_NAV_IDS.appProjects } : item)), ...fileItems];
|
||||
const organizationItems = [...(appointmentsArea ? [appointmentsArea] : []), ...chatItems, ...hrItems, ...passwordSafeItems];
|
||||
|
||||
const navigationGroups: SideBarItem[] = [
|
||||
{
|
||||
id: "ui.nav.app.overview",
|
||||
title: "",
|
||||
path: "",
|
||||
items: startItems,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.customers",
|
||||
title: t("app.sidebar.sections.customers"),
|
||||
path: "",
|
||||
items: customerItems,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.projects",
|
||||
title: t("app.sidebar.sections.projects"),
|
||||
path: "",
|
||||
items: projectItems,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.communication",
|
||||
title: t("app.sidebar.sections.communication"),
|
||||
path: "",
|
||||
items: communicationContextItems,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.organization",
|
||||
title: t("app.sidebar.sections.organization"),
|
||||
path: "",
|
||||
items: organizationItems,
|
||||
},
|
||||
{
|
||||
id: "ui.nav.app.automationPlatform",
|
||||
title: t("app.sidebar.sections.automationPlatform"),
|
||||
path: "",
|
||||
items: automationItems,
|
||||
},
|
||||
].filter((group) => (group.items?.length ?? 0) > 0);
|
||||
|
||||
const secondaryItem: SideBarItem = {
|
||||
id: "ui.nav.app.secondary",
|
||||
title: "",
|
||||
path: "",
|
||||
isSecondary: true,
|
||||
items: [
|
||||
...(hasDashboardAccess
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appDashboard,
|
||||
title: t("app.sidebar.dashboard"),
|
||||
path: tenantPath("dashboard"),
|
||||
icon: <IconDashboard />,
|
||||
permission: "dashboard.read" as const,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN, TenantUserType.MEMBER],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: UI_NAV_IDS.appNotifications,
|
||||
title: t("app.sidebar.notifications"),
|
||||
path: tenantPath("notifications"),
|
||||
icon: <IconNotifications />,
|
||||
id: UI_NAV_IDS.appSettings,
|
||||
title: t("app.sidebar.settings"),
|
||||
icon: <IconSettings />,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN],
|
||||
path: tenantPath("settings"),
|
||||
redirectTo: tenantPath("settings/profile"),
|
||||
},
|
||||
...productCoreItems,
|
||||
// {
|
||||
// title: t("models.email.plural"),
|
||||
// path: `${currentTenantUrl}/emails`,
|
||||
// icon: SvgIcon.EMAILS,
|
||||
// title: t("app.sidebar.logs"),
|
||||
// icon: SvgIcon.LOGS,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN],
|
||||
// path: `${currentTenantUrl}/logs`,
|
||||
// },
|
||||
{
|
||||
id: UI_NAV_IDS.appSwitchToAdmin,
|
||||
title: t("admin.switchToAdmin"),
|
||||
path: absoluteAdminPath(routing, "dashboard"),
|
||||
icon: <IconAdmin />,
|
||||
adminOnly: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return [
|
||||
appItem,
|
||||
{
|
||||
id: "ui.nav.app.secondary",
|
||||
title: "",
|
||||
path: "",
|
||||
isSecondary: true,
|
||||
items: [
|
||||
{
|
||||
id: UI_NAV_IDS.appSettings,
|
||||
title: t("app.sidebar.settings"),
|
||||
icon: <IconSettings />,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN],
|
||||
path: tenantPath("settings"),
|
||||
redirectTo: tenantPath("settings/profile"),
|
||||
},
|
||||
// {
|
||||
// title: t("app.sidebar.logs"),
|
||||
// icon: SvgIcon.LOGS,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN],
|
||||
// path: `${currentTenantUrl}/logs`,
|
||||
// },
|
||||
{
|
||||
id: UI_NAV_IDS.appSwitchToAdmin,
|
||||
title: t("admin.switchToAdmin"),
|
||||
path: absoluteAdminPath(routing, "dashboard"),
|
||||
icon: <IconAdmin />,
|
||||
adminOnly: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
return [...navigationGroups, secondaryItem];
|
||||
};
|
||||
|
||||
// function SideText({ text }: { text: string }) {
|
||||
|
||||
+1
-21
@@ -1,5 +1,5 @@
|
||||
import { SideBarItem } from "./SidebarItem";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { UI_ID_PATTERNS, UI_NAV_IDS, uiIdSegment } from "~/application/ui/uiRegistry";
|
||||
|
||||
function withDocsSidebarIds(items: SideBarItem[], seenIds = new Map<string, number>()): SideBarItem[] {
|
||||
@@ -274,26 +274,6 @@ export const DocsSidebar = (): SideBarItem[] => {
|
||||
title: i18nT("docs.sidebar.supportLanguageI18n"),
|
||||
path: "/docs/learning-center/guides/localization/support-a-language",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.createCustomEntity"),
|
||||
path: "/docs/learning-center/guides/entities/create-a-custom-entity",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.useCustomEntityApi"),
|
||||
path: "/docs/learning-center/guides/entities/use-the-custom-entity-api",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.sharedEntityRows"),
|
||||
path: "/docs/learning-center/guides/entities/shared-entity-rows",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.planEntityLimits"),
|
||||
path: "/docs/learning-center/guides/entities/plan-entity-limits",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.extendExistingModels"),
|
||||
path: "/docs/learning-center/guides/entities/extend-existing-models",
|
||||
},
|
||||
{
|
||||
title: i18nT("docs.sidebar.singleSignOn"),
|
||||
path: "/docs/learning-center/guides/sso/",
|
||||
|
||||
+8
@@ -47,6 +47,14 @@ describe("sidebar UI IDs", () => {
|
||||
expectStaticItemsHaveIds(sidebar);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminDashboard);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSettings);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesCommunication);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesLeadSettings);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesToday);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesEmail);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesContacts);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesCompanies);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesFieldsTags);
|
||||
expect(ids).toContain(UI_NAV_IDS.adminSalesImportExport);
|
||||
});
|
||||
|
||||
it("assigns unique IDs to app sidebar static items", () => {
|
||||
|
||||
+8
@@ -14,7 +14,15 @@ export interface SideBarItem {
|
||||
adminOnly?: boolean;
|
||||
tenantUserTypes?: TenantUserType[];
|
||||
permission?: DefaultPermission;
|
||||
/** Item is visible when at least one permission is granted. */
|
||||
anyPermissions?: DefaultPermission[];
|
||||
items?: SideBarItem[];
|
||||
/** Alternate route roots that keep a consolidated navigation entry active. */
|
||||
activePaths?: string[];
|
||||
/** Route roots that must NOT activate this entry (sibling entries' subroutes under a broad activePaths prefix). */
|
||||
excludePaths?: string[];
|
||||
/** Links shown inside the workspace area instead of permanently in the global sidebar. */
|
||||
contextItems?: SideBarItem[];
|
||||
side?: ReactNode;
|
||||
exact?: boolean;
|
||||
redirectTo?: string;
|
||||
|
||||
+14
-1
@@ -1,8 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { UI_NAV_IDS } from "./uiRegistry";
|
||||
import { UI_ACTION_IDS, UI_ID_PATTERNS, UI_NAV_IDS, getCommandPaletteActionId, getCommandPaletteRecentId, getCommandPaletteResultId } from "./uiRegistry";
|
||||
|
||||
describe("UI_NAV_IDS", () => {
|
||||
it("exposes the app notification nav id", () => {
|
||||
expect(UI_NAV_IDS.appNotifications).toBe("ui.nav.app.notifications");
|
||||
});
|
||||
|
||||
it("keeps desktop and mobile search triggers independently addressable", () => {
|
||||
expect(UI_ACTION_IDS.search).toBe("ui.action.shell.search");
|
||||
expect(UI_ACTION_IDS.searchMobile).toBe("ui.action.shell.searchMobile");
|
||||
expect(UI_ACTION_IDS.searchMobile).not.toBe(UI_ACTION_IDS.search);
|
||||
});
|
||||
|
||||
it("builds stable, unique Spotlight row ids from the registered patterns", () => {
|
||||
expect(UI_ID_PATTERNS.commandPaletteResult).toBe("ui.surface.commandPalette.result.{entityType}.{entityId}");
|
||||
expect(getCommandPaletteResultId("project", "project-42")).toBe("ui.surface.commandPalette.result.project.project42");
|
||||
expect(getCommandPaletteRecentId("recent-42")).toBe("ui.surface.commandPalette.recent.recent42");
|
||||
expect(getCommandPaletteActionId("open-settings")).toBe("ui.surface.commandPalette.action.openSettings");
|
||||
});
|
||||
});
|
||||
@@ -17,13 +17,20 @@ export const UI_SURFACE_IDS = {
|
||||
feedbackDialog: "ui.surface.shell.feedback.dialog",
|
||||
commandPalettePortal: "ui.surface.commandPalette.portal",
|
||||
commandPaletteSearch: "ui.surface.commandPalette.search",
|
||||
commandPaletteFilters: "ui.surface.commandPalette.filters",
|
||||
commandPaletteResults: "ui.surface.commandPalette.results",
|
||||
commandPaletteRow: "ui.surface.commandPalette.row",
|
||||
commandPaletteQueryHint: "ui.surface.commandPalette.queryHint",
|
||||
commandPaletteSearchStatus: "ui.surface.commandPalette.searchStatus",
|
||||
commandPaletteRecentStatus: "ui.surface.commandPalette.recentStatus",
|
||||
commandPalettePermissionHint: "ui.surface.commandPalette.permissionHint",
|
||||
commandPaletteFooter: "ui.surface.commandPalette.footer",
|
||||
} as const;
|
||||
|
||||
export const UI_ACTION_IDS = {
|
||||
sidebarTrigger: "ui.action.shell.sidebarTrigger",
|
||||
search: "ui.action.shell.search",
|
||||
searchMobile: "ui.action.shell.searchMobile",
|
||||
commandPaletteLoadMore: "ui.action.commandPalette.loadMore",
|
||||
aiAssistant: "ui.action.shell.aiAssistant",
|
||||
aiAssistantExpand: "ui.action.shell.aiAssistant.expand",
|
||||
aiAssistantClose: "ui.action.shell.aiAssistant.close",
|
||||
@@ -40,20 +47,33 @@ export const UI_ACTION_IDS = {
|
||||
export const UI_NAV_IDS = {
|
||||
appDashboard: "ui.nav.app.dashboard",
|
||||
appNotifications: "ui.nav.app.notifications",
|
||||
appSearch: "ui.nav.app.search",
|
||||
appAutomation: "ui.nav.app.automation",
|
||||
appCrm: "ui.nav.app.crm",
|
||||
appLeads: "ui.nav.app.leads",
|
||||
appProjects: "ui.nav.app.projects",
|
||||
appPlantafel: "ui.nav.app.plantafel",
|
||||
appEmailMarketing: "ui.nav.app.emailMarketing",
|
||||
appEmails: "ui.nav.app.emails",
|
||||
appTelephony: "ui.nav.app.telephony",
|
||||
appChat: "ui.nav.app.chat",
|
||||
appHr: "ui.nav.app.hr",
|
||||
appPasswordSafe: "ui.nav.app.passwordSafe",
|
||||
appCalendar: "ui.nav.app.calendar",
|
||||
appBookings: "ui.nav.app.bookings",
|
||||
appAvailability: "ui.nav.app.availability",
|
||||
appForms: "ui.nav.app.forms",
|
||||
appBilling: "ui.nav.app.billing",
|
||||
appApi: "ui.nav.app.api",
|
||||
appWorkflowEngine: "ui.nav.app.workflowEngine",
|
||||
appCredits: "ui.nav.app.credits",
|
||||
appSettings: "ui.nav.app.settings",
|
||||
appSettingsAccount: "ui.nav.app.settings.account",
|
||||
appSettingsTeam: "ui.nav.app.settings.team",
|
||||
appSettingsBilling: "ui.nav.app.settings.billing",
|
||||
appSettingsWorkspace: "ui.nav.app.settings.workspace",
|
||||
appSettingsCustomerPortal: "ui.nav.app.settings.customerPortal",
|
||||
appSettingsIntegrations: "ui.nav.app.settings.integrations",
|
||||
appSettingsCompliance: "ui.nav.app.settings.compliance",
|
||||
appSwitchToAdmin: "ui.nav.app.switchToAdmin",
|
||||
adminDashboard: "ui.nav.admin.dashboard",
|
||||
adminAccounts: "ui.nav.admin.accounts",
|
||||
@@ -64,6 +84,21 @@ export const UI_NAV_IDS = {
|
||||
adminPrompts: "ui.nav.admin.prompts",
|
||||
adminEmailMarketing: "ui.nav.admin.emailMarketing",
|
||||
adminMarketing: "ui.nav.admin.marketing",
|
||||
adminPlatformLeads: "ui.nav.admin.platformLeads",
|
||||
adminSales: "ui.nav.admin.sales",
|
||||
adminSalesCommunication: "ui.nav.admin.salesCommunication",
|
||||
adminSalesContacts: "ui.nav.admin.sales.contacts",
|
||||
adminSalesCompanies: "ui.nav.admin.sales.companies",
|
||||
adminSalesDeals: "ui.nav.admin.sales.deals",
|
||||
adminSalesToday: "ui.nav.admin.sales.today",
|
||||
adminSalesEmail: "ui.nav.admin.sales.email",
|
||||
adminSalesCalls: "ui.nav.admin.sales.calls",
|
||||
adminSalesBookings: "ui.nav.admin.sales.bookings",
|
||||
adminSalesTelephonySettings: "ui.nav.admin.sales.telephonySettings",
|
||||
adminSalesLeadSettings: "ui.nav.admin.sales.leadSettings",
|
||||
adminSalesPipelineSettings: "ui.nav.admin.sales.pipelineSettings",
|
||||
adminSalesFieldsTags: "ui.nav.admin.sales.fieldsTags",
|
||||
adminSalesImportExport: "ui.nav.admin.sales.importExport",
|
||||
adminKnowledgeBase: "ui.nav.admin.knowledgeBase",
|
||||
adminHelpDesk: "ui.nav.admin.helpDesk",
|
||||
adminSettings: "ui.nav.admin.settings",
|
||||
@@ -77,8 +112,23 @@ export const UI_ID_PATTERNS = {
|
||||
appEntityGroupEntity: "ui.nav.app.entityGroup.{groupSlug}.entity.{entityName}",
|
||||
appSection: "ui.nav.app.section.{sectionName}",
|
||||
docsRoute: "ui.nav.docs.route.{routeSlug}",
|
||||
commandPaletteResult: "ui.surface.commandPalette.result.{entityType}.{entityId}",
|
||||
commandPaletteRecent: "ui.surface.commandPalette.recent.{recentId}",
|
||||
commandPaletteAction: "ui.surface.commandPalette.action.{actionId}",
|
||||
} as const;
|
||||
|
||||
export function getCommandPaletteResultId(entityType: string, entityId: string) {
|
||||
return `ui.surface.commandPalette.result.${uiIdSegment(entityType)}.${uiIdSegment(entityId)}`;
|
||||
}
|
||||
|
||||
export function getCommandPaletteRecentId(recentId: string) {
|
||||
return `ui.surface.commandPalette.recent.${uiIdSegment(recentId)}`;
|
||||
}
|
||||
|
||||
export function getCommandPaletteActionId(actionId: string) {
|
||||
return `ui.surface.commandPalette.action.${uiIdSegment(actionId)}`;
|
||||
}
|
||||
|
||||
export function getSidebarSurfaceId(layout: UiLayout) {
|
||||
if (layout === "admin") {
|
||||
return UI_SURFACE_IDS.adminSidebar;
|
||||
|
||||
Reference in new issue
Block a user