import { lazy, Suspense } from "react"; import type { ReactElement } from "react"; // Lazy load route components for code splitting const Dashboard = lazy(() => import("@/pages/tenant/Dashboard")); const Roles = lazy(() => import("@/pages/tenant/Roles")); const Settings = lazy(() => import("@/pages/tenant/Settings")); const Users = lazy(() => import("@/pages/tenant/Users")); const AuditLogs = lazy(() => import("@/pages/tenant/AuditLogs")); const Modules = lazy(() => import("@/pages/tenant/Modules")); const LandingPage = lazy(() => import("@/pages/tenant/LandingPage")); const Departments = lazy(() => import("@/pages/tenant/Departments")); const Designations = lazy(() => import("@/pages/tenant/Designations")); const WorkflowDefination = lazy( () => import("@/pages/tenant/WorkflowDefination"), ); const Suppliers = lazy(() => import("@/pages/tenant/Suppliers")); const Documents = lazy(() => import("@/pages/tenant/Documents")); const CreateDocument = lazy(() => import("@/pages/tenant/CreateDocument")); const EditDocument = lazy(() => import("@/pages/tenant/EditDocument")); const ViewDocument = lazy(() => import("@/pages/tenant/ViewDocument")); const DocumentCategories = lazy( () => import("@/pages/tenant/DocumentCategories"), ); const DocumentsDueForReview = lazy( () => import("@/pages/tenant/DocumentsDueForReview"), ); const Tasks = lazy(() => import("@/pages/tenant/Tasks")); const NotificationSettings = lazy( () => import("@/pages/tenant/NotificationSettings"), ); const Notifications = lazy(() => import("@/pages/tenant/Notifications")); const NotificationTemplates = lazy( () => import("@/pages/tenant/NotificationTemplates"), ); const FilesList = lazy(() => import("@/pages/tenant/FilesList")); const FileView = lazy(() => import("@/pages/tenant/FileView")); const StorageDashboard = lazy(() => import("@/pages/tenant/StorageDashboard")); const SmtpSettings = lazy(() => import("@/pages/tenant/SmtpSettings")); const FailedEmails = lazy(() => import("@/pages/tenant/FailedEmails")); // const AIGateway = lazy(() => import("@/pages/tenant/AIGateway")); const CompletionHistory = lazy( () => import("@/pages/tenant/CompletionHistory"), ); const CompletionCreate = lazy(() => import("@/pages/tenant/CompletionCreate")); const CompletionDetail = lazy(() => import("@/pages/tenant/CompletionDetail")); const PromptManagement = lazy(() => import("@/pages/tenant/PromptManagement")); const PromptCreate = lazy(() => import("@/pages/tenant/PromptCreate")); const PromptEdit = lazy(() => import("@/pages/tenant/PromptEdit")); const PromptExecute = lazy(() => import("@/pages/tenant/PromptExecute")); const PromptExecutions = lazy(() => import("@/pages/tenant/PromptExecutions")); const PromptTestCases = lazy(() => import("@/pages/tenant/PromptTestCases")); const PromptTestCaseCreate = lazy( () => import("@/pages/tenant/PromptTestCaseCreate"), ); const TenantAIProviders = lazy( () => import("@/pages/tenant/TenantAIProviders"), ); const TenantAIProviderCreate = lazy( () => import("@/pages/tenant/TenantAIProviderCreate"), ); const TenantAIDashboard = lazy(() => import("@/pages/tenant/TenantAIDashboard")); const SecurityPolicy = lazy(() => import("@/pages/tenant/SecurityPolicy")); // Loading fallback component const RouteLoader = (): ReactElement => (
Loading...
); // Wrapper component with Suspense const LazyRoute = ({ component: Component, }: { component: React.ComponentType; }): ReactElement => ( }> ); export interface RouteConfig { path: string; element: ReactElement; } // Tenant Admin routes (requires authentication but NOT super_admin role) export const tenantAdminRoutes: RouteConfig[] = [ { path: "/tenant/landing", element: , }, { path: "/tenant", element: , }, { path: "/tenant/roles", element: , }, { path: "/tenant/users", element: , }, { path: "/tenant/modules", element: , }, { path: "/tenant/audit-logs", element: , }, { path: "/tenant/settings", element: , }, { path: "/tenant/departments", element: , }, { path: "/tenant/designations", element: , }, { path: "/tenant/workflows/definitions", element: , }, { path: "/tenant/suppliers", element: , }, { path: "/tenant/documents", element: , }, { path: "/tenant/documents/create", element: , }, { path: "/tenant/documents/edit/:id", element: , }, { path: "/tenant/documents/:id", element: , }, { path: "/tenant/documents/categories", element: , }, { path: "/tenant/documents/due-for-review", element: , }, { path: "/tenant/workflows/tasks", element: , }, { path: "/tenant/settings/notifications", element: , }, { path: "/tenant/notifications", element: , }, { path: "/tenant/settings/notification-templates", element: , }, { path: "/tenant/files", element: , }, { path: "/tenant/files/:id", element: , }, { path: "/tenant/files/storage-dashboard", element: , }, { path: "/tenant/settings/smtp", element: , }, { path: "/tenant/settings/failed-emails", element: , }, { path: "/tenant/ai", element: , }, { path: "/tenant/ai/completions", element: , }, { path: "/tenant/ai/completions/create", element: , }, { path: "/tenant/ai/completions/:completionId", element: , }, // { // path: "/tenant/ai/config", // element: , // }, { path: "/tenant/ai/providers", element: , }, { path: "/tenant/ai/providers/create", element: , }, { path: "/tenant/ai/prompts", element: , }, { path: "/tenant/ai/prompts/create", element: , }, { path: "/tenant/ai/prompts/:id/edit", element: , }, { path: "/tenant/ai/prompts/:id/execute", element: , }, { path: "/tenant/ai/prompts/:id/executions", element: , }, { path: "/tenant/ai/prompts/:id/test-cases", element: , }, { path: "/tenant/ai/prompts/:id/test-cases/create", element: , }, { path: "/tenant/ai/prompt-test-cases", element: , }, { path: "/tenant/ai/dashboard", element: , }, { path: "/tenant/settings/security-policy", element: , }, // { // path: "/tenant/ai/knowledge", // element: , // }, ];