Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

5.2 KB
Raw Blame
import {
  SETTINGS_SECTION_REGISTRY as CORE_SETTINGS_SECTION_REGISTRY,
  type SettingsSectionEntry,
} from "@editor-core/data/settingsSectionRegistry";
import { HAS_PORTAL } from "@editor/routes/hasPortal";

export type { SettingsSectionEntry };

/**
 * Self-hosted (proprietary) settings sections. Extends the core list with the
 * account tab, the developer API keys tab, and the admin area — mirroring the
 * sections added by the proprietary nav builder (`configNavSections`). Keep the
 * two in sync: a section here that the nav can't render would deep-link to a
 * dead tab, and a nav section missing here isn't searchable.
 *
 * Gating flags mirror the builder: `account`/`api-keys`/`users` need login; the admin
 * sections are surfaced when the user is an admin OR login mode is off.
 */
export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
  ...CORE_SETTINGS_SECTION_REGISTRY,
  {
    key: "account",
    labelKey: "account.accountSettings",
    labelFallback: "Account",
    keywords: ["profile", "email", "password", "user"],
    requiresLogin: true,
    groupLabelKey: "settings.preferences.title",
    groupLabelFallback: "Preferences",
  },
  {
    key: "api-keys",
    labelKey: "settings.developer.apiKeys",
    labelFallback: "API Keys",
    keywords: ["api", "token", "developer", "key"],
    requiresLogin: true,
    groupLabelKey: "settings.preferences.title",
    groupLabelFallback: "Preferences",
  },
  // --- Workspace ---
  // The shared roster needs login and admin access. Carries the words the
  // retired People and Teams sections were found by.
  {
    key: "users",
    labelKey: "portal.nav.users",
    labelFallback: "Users",
    keywords: [
      "users",
      "people",
      "members",
      "roster",
      "invite",
      "add member",
      "roles",
      "teams",
      "team",
      "group",
      "create team",
      "processor access",
    ],
    requiresLogin: true,
    adminArea: true,
    groupLabelKey: "settings.workspace.title",
    groupLabelFallback: "Workspace",
  },
  // --- Configuration ---
  {
    key: "adminGeneral",
    labelKey: "settings.configuration.systemSettings",
    labelFallback: "System Settings",
    keywords: [
      "system",
      "config",
      "server",
      "features",
      "toggles",
      "flags",
      "storage",
      "sharing",
      "files",
      "folders",
      "access",
      "permissions",
      "scanning",
      "endpoints",
      "api",
      "routes",
      "mcp",
      "server",
      "ai",
      "model context protocol",
    ],
    adminArea: true,
    groupLabelKey: "settings.server.title",
    groupLabelFallback: "Server",
  },
  {
    key: "adminAdvanced",
    labelKey: "settings.configuration.advanced",
    labelFallback: "Advanced",
    keywords: ["advanced", "expert", "database", "db", "backup"],
    adminArea: true,
    groupLabelKey: "settings.server.title",
    groupLabelFallback: "Server",
  },
  // --- AI ---
  {
    key: "adminAi",
    labelKey: "settings.ai.general",
    labelFallback: "AI Engine",
    keywords: [
      "ai",
      "assistant",
      "enable",
      "models",
      "providers",
      "llm",
      "openai",
      "anthropic",
      "rag",
      "embedding",
      "retrieval",
      "documents",
      "limits",
      "tokens",
      "rate",
      "performance",
    ],
    adminArea: true,
    groupLabelKey: "settings.server.title",
    groupLabelFallback: "Server",
  },
  // --- Security & Authentication ---
  {
    key: "adminSecurity",
    labelKey: "settings.securityAuth.security",
    labelFallback: "Security",
    keywords: [
      "security",
      "authentication",
      "auth",
      "password",
      "sessions",
      "connections",
      "oauth",
      "sso",
      "integrations",
      "privacy",
      "gdpr",
      "data",
      "legal",
      "terms",
      "agreement",
    ],
    adminArea: true,
    groupLabelKey: "settings.server.title",
    groupLabelFallback: "Server",
  },
  // --- Licensing & Analytics ---
  {
    key: "adminAudit",
    labelKey: "settings.licensingAnalytics.audit",
    labelFallback: "Audit",
    keywords: ["audit", "logs", "events", "history"],
    adminArea: true,
    groupLabelKey: "settings.monitoring.title",
    groupLabelFallback: "Monitoring",
  },
  {
    key: "adminUsage",
    labelKey: "settings.licensingAnalytics.usageAnalytics",
    labelFallback: "Usage Analytics",
    keywords: ["usage", "analytics", "stats", "metrics"],
    adminArea: true,
    groupLabelKey: "settings.monitoring.title",
    groupLabelFallback: "Monitoring",
  },
  // --- Workspace (moved off the processor's own nav). Present only where the
  // nav can actually show them: a processor build, and a session that can
  // enter it. ---
  ...(HAS_PORTAL
    ? ([
        {
          key: "billing",
          labelKey: "portal.nav.usage",
          labelFallback: "Usage & Billing",
          keywords: [
            "billing",
            "wallet",
            "credits",
            "invoice",
            "spend",
            "payg",
          ],
          adminArea: true,
          requiresPortalAccess: true,
          groupLabelKey: "settings.workspace.title",
          groupLabelFallback: "Workspace",
        },
      ] satisfies SettingsSectionEntry[])
    : []),
  // --- Policies & Privacy ---
];