@burdenoff/microfe-bigconsole 2026.801.1 → 2026.801.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/bigconsole/AdminRoutes.js +1 -1
  2. package/dist/bigconsole/AdminRoutes.js.map +1 -1
  3. package/dist/bigconsole/BigConsoleRoot.js +1 -1
  4. package/dist/bigconsole/BigConsoleRoot.js.map +1 -1
  5. package/dist/bigconsole/BigConsoleRoutes.js +1 -1
  6. package/dist/bigconsole/BigConsoleRoutes.js.map +1 -1
  7. package/dist/bigconsole/components/datasink/LinkedParsersPanel.js +1 -1
  8. package/dist/bigconsole/components/datasink/LinkedParsersPanel.js.map +1 -1
  9. package/dist/bigconsole/components/embed/widgets/TableEmbed.js +39 -23
  10. package/dist/bigconsole/components/embed/widgets/TableEmbed.js.map +1 -1
  11. package/dist/bigconsole/components/widgets/table/TableCell.js +47 -42
  12. package/dist/bigconsole/components/widgets/table/TableCell.js.map +1 -1
  13. package/dist/bigconsole/components/widgets/table/TableWidget.js +4 -1
  14. package/dist/bigconsole/components/widgets/table/TableWidget.js.map +1 -1
  15. package/dist/bigconsole/components/widgets/table/cellLink.js +26 -0
  16. package/dist/bigconsole/components/widgets/table/cellLink.js.map +1 -0
  17. package/dist/bigconsole/contexts/NavigationContext.js +1 -1
  18. package/dist/bigconsole/contexts/NavigationContext.js.map +1 -1
  19. package/dist/bigconsole/hooks/useFilterUrlSync.js +1 -1
  20. package/dist/bigconsole/hooks/useFilterUrlSync.js.map +1 -1
  21. package/dist/bigconsole/pages/DashboardBuilderPage.js +1 -1
  22. package/dist/bigconsole/pages/DashboardBuilderPage.js.map +1 -1
  23. package/dist/bigconsole/pages/DashboardViewPage.js +1 -1
  24. package/dist/bigconsole/pages/DashboardViewPage.js.map +1 -1
  25. package/dist/bigconsole/pages/DataParsersPage.js +1 -1
  26. package/dist/bigconsole/pages/DataParsersPage.js.map +1 -1
  27. package/dist/bigconsole/pages/DataSinkBuilderPage.js +1 -1
  28. package/dist/bigconsole/pages/DataSinkBuilderPage.js.map +1 -1
  29. package/dist/bigconsole/pages/DataSinkViewPage.js +1 -1
  30. package/dist/bigconsole/pages/DataSinkViewPage.js.map +1 -1
  31. package/dist/bigconsole/pages/ParserBuilderPage.js +1 -1
  32. package/dist/bigconsole/pages/ParserBuilderPage.js.map +1 -1
  33. package/dist/bigconsole/pages/ParserViewPage.js +1 -1
  34. package/dist/bigconsole/pages/ParserViewPage.js.map +1 -1
  35. package/dist/bigconsole/pages/PipelineBuilderPage.js +1 -1
  36. package/dist/bigconsole/pages/PipelineBuilderPage.js.map +1 -1
  37. package/dist/bigconsole/pages/PipelineViewPage.js +1 -1
  38. package/dist/bigconsole/pages/PipelineViewPage.js.map +1 -1
  39. package/dist/bigconsole/pages/WorkflowViewPage.js +1 -1
  40. package/dist/bigconsole/pages/WorkflowViewPage.js.map +1 -1
  41. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { AdminPage as e } from "./pages/AdminPage.js";
2
- import { Route as t, Routes as n } from "react-router-dom";
2
+ import { Route as t, Routes as n } from "react-router";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
4
  //#region src/bigconsole/AdminRoutes.tsx
5
5
  function i() {
@@ -1 +1 @@
1
- {"version":3,"file":"AdminRoutes.js","names":[],"sources":["../../src/bigconsole/AdminRoutes.tsx"],"sourcesContent":["/**\n * BigConsole Admin Routes\n *\n * Internal routing for the admin surface mounted inside admin-app.\n */\n\nimport { Route, Routes } from 'react-router-dom';\nimport { AdminPage } from './pages/AdminPage';\n\nexport function AdminRoutes() {\n return (\n <Routes>\n <Route path=\"*\" element={<AdminPage />} />\n </Routes>\n );\n}\n"],"mappings":";;;;AASA,SAAgB,IAAc;AAC5B,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAO,MAAK;EAAI,SAAS,kBAAC,GAAD,EAAa,CAAA;EAAI,CAAA,EACnC,CAAA"}
1
+ {"version":3,"file":"AdminRoutes.js","names":[],"sources":["../../src/bigconsole/AdminRoutes.tsx"],"sourcesContent":["/**\n * BigConsole Admin Routes\n *\n * Internal routing for the admin surface mounted inside admin-app.\n */\n\nimport { Route, Routes } from 'react-router';\nimport { AdminPage } from './pages/AdminPage';\n\nexport function AdminRoutes() {\n return (\n <Routes>\n <Route path=\"*\" element={<AdminPage />} />\n </Routes>\n );\n}\n"],"mappings":";;;;AASA,SAAgB,IAAc;AAC5B,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAO,MAAK;EAAI,SAAS,kBAAC,GAAD,EAAa,CAAA;EAAI,CAAA,EACnC,CAAA"}
@@ -12,7 +12,7 @@ import u from "./components/DrilldownDashboardRenderer.js";
12
12
  import d from "./components/preview/AiPreviewPanel.js";
13
13
  import f from "./components/DrilldownModal.js";
14
14
  import { useCallback as p, useEffect as m, useLayoutEffect as h, useRef as g, useState as _ } from "react";
15
- import { useSearchParams as v } from "react-router-dom";
15
+ import { useSearchParams as v } from "react-router";
16
16
  import { ErrorBoundary as y } from "@burdenoff/fe-libs/shared/components";
17
17
  import { FeatureFlagProvider as b } from "@burdenoff/fe-libs/shared/feature-flags";
18
18
  import { BarChart3 as x, Boxes as S, Database as C, LayoutDashboard as w, Lightbulb as T, Settings as ee } from "lucide-react";
@@ -1 +1 @@
1
- {"version":3,"file":"BigConsoleRoot.js","names":[],"sources":["../../src/bigconsole/BigConsoleRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport type { TypedDocumentNode } from '@apollo/client';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { BarChart3, Database, LayoutDashboard, Lightbulb, Settings, Boxes } from 'lucide-react';\nimport type { BigConsoleRootProps } from './types';\nimport { BigConsoleRoutes } from './BigConsoleRoutes';\nimport { BigConsoleProvider } from './context';\nimport { NavigationProvider, CrossFilterProvider } from './contexts';\nimport { BigConsoleQuotaProvider } from './providers/BigConsoleQuotaProvider';\nimport { AiPreviewPanel } from './components/preview/AiPreviewPanel';\nimport { DrilldownModal } from './components/DrilldownModal';\nimport { DrilldownDashboardRenderer } from './components/DrilldownDashboardRenderer';\nimport { useFilterUrlSync } from './hooks/useFilterUrlSync';\nimport { useDrilldownStore } from './store/drilldownStore';\n\n// FluidGrids SDK client injection (needed for workflow components)\nimport {\n setFluidGridsClient,\n resetFluidGridsClient,\n setFluidGridsConfig,\n resetFluidGridsConfig,\n setGlobalStoreClient,\n resetGlobalStoreClient,\n} from '@burdenoff/fluidgrids-fe-sdk';\n// Use the shared gateway Apollo clients from the shell\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport {\n CreateWorkflowDocument,\n GetWorkflowByKeyDocument,\n ListWorkflowsDocument,\n type GetWorkflowByKeyQuery,\n type GetWorkflowByKeyQueryVariables,\n type CreateWorkflowMutation,\n type CreateWorkflowMutationVariables,\n type ListWorkflowsQuery,\n type ListWorkflowsQueryVariables,\n} from '../generated/wspace-operations';\n\nconst getWorkflowByKeyDocument = GetWorkflowByKeyDocument as unknown as TypedDocumentNode<\n GetWorkflowByKeyQuery,\n GetWorkflowByKeyQueryVariables\n>;\nconst createWorkflowDocument = CreateWorkflowDocument as unknown as TypedDocumentNode<\n CreateWorkflowMutation,\n CreateWorkflowMutationVariables\n>;\nconst listWorkflowsDocument = ListWorkflowsDocument as unknown as TypedDocumentNode<\n ListWorkflowsQuery,\n ListWorkflowsQueryVariables\n>;\n\n/**\n * Local contract for the workflow-save payload emitted by the embedded FluidGrids builder.\n * Kept explicit here to maintain strict typing at the BigConsole boundary.\n */\ninterface WorkflowSavedResult {\n dbId: string;\n workflowKey: string;\n version: string;\n name: string;\n description?: string;\n operation: 'created' | 'updated' | 'versioned';\n}\n\n// In-flight guard: prevents duplicate BigConsole records when the callback\n// fires twice in rapid succession (React StrictMode, retry, double-click).\n// Server unique constraint on `key` is the ultimate backstop.\nconst inFlightKeys = new Set<string>();\n\n/**\n * Root component for the BigConsole microfrontend.\n *\n * This is the main entry point that host applications import and render.\n * It sets up the necessary providers and renders the internal routing.\n * Automatically registers navigation items with the shell if registration functions are provided.\n *\n * @example\n * ```tsx\n * import { BigConsoleRoot, type BigConsoleRootProps } from '@burdenoff/microfe-bigconsole';\n *\n * function App() {\n * const props: BigConsoleRootProps = {\n * basePath: '/analytics',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com' },\n * apiGatewayUrl: 'https://api.example.com',\n * authToken: 'token',\n * };\n *\n * return <BigConsoleRoot {...props} />;\n * }\n * ```\n */\nexport const BigConsoleRoot: FC<BigConsoleRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/bigconsole', navigate: hostNavigate } = props;\n\n // Use the shared Apollo clients from the shell (both workspace and global)\n const workspaceClient = useGatewayClient('workspace');\n const globalClient = useGatewayClient('global');\n const [clientReady, setClientReady] = useState(false);\n const [clientError, setClientError] = useState<string | null>(null);\n\n // Helper to join paths correctly, avoiding double slashes\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with the shell\n useEffect(() => {\n if (!registerNavItems) return;\n\n const bigConsoleNavItem = {\n id: 'bigconsole',\n label: 'Analytics',\n path: basePath,\n icon: <BarChart3 size={20} />,\n order: 15,\n group: 'bigconsole',\n children: [\n {\n id: 'bigconsole-home',\n label: 'Overview',\n path: basePath,\n icon: <BarChart3 size={16} />,\n order: 10,\n },\n {\n id: 'bigconsole-dashboards',\n label: 'Dashboards',\n path: joinPath(basePath, 'dashboards'),\n icon: <LayoutDashboard size={16} />,\n order: 20,\n },\n {\n id: 'bigconsole-datasources',\n label: 'Data Sources',\n path: joinPath(basePath, 'datasources'),\n icon: <Database size={16} />,\n order: 30,\n },\n {\n id: 'bigconsole-insights',\n label: 'AI Insights',\n path: joinPath(basePath, 'insights'),\n icon: <Lightbulb size={16} />,\n order: 40,\n },\n {\n id: 'bigconsole-widgets',\n label: 'Widget Demo',\n path: joinPath(basePath, 'widgets/demo'),\n icon: <Boxes size={16} />,\n order: 50,\n },\n {\n id: 'bigconsole-settings',\n label: 'Settings',\n path: joinPath(basePath, 'settings'),\n icon: <Settings size={16} />,\n order: 60,\n },\n ],\n };\n\n const cleanup = registerNavItems(bigConsoleNavItem);\n return cleanup;\n }, [registerNavItems, basePath]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'bigconsole-status',\n label: 'Analytics Ready',\n type: 'status' as const,\n order: 15,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n // Inject Apollo clients into FluidGrids SDK (for workflow components)\n // This synchronizes external stores (module-level client singletons in the SDK)\n // with React's lifecycle. The setState call is intentional — it gates rendering\n // so children don't mount before the SDK clients are available.\n //\n // KNOWN TRADE-OFF: clientReady is NOT reset in cleanup. When workspaceClient/globalClient\n // change references (e.g. token refresh), children continue rendering against a briefly\n // uninitialized SDK client until the next effect run re-injects the new client. This avoids\n // a visible spinner flash mid-session. Failed SDK requests during this short window will\n // be retried by React Query / Apollo's retry policies. If this becomes a real issue,\n // consider using startTransition to reset clientReady without the visual disruption.\n useEffect(() => {\n if (workspaceClient && globalClient) {\n setFluidGridsClient(workspaceClient);\n setGlobalStoreClient(globalClient);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: gate children until external SDK clients are injected\n setClientReady(true);\n }\n return () => {\n resetFluidGridsClient();\n resetGlobalStoreClient();\n };\n }, [workspaceClient, globalClient]);\n\n // Timeout fallback: if gateway clients are never provided (test env, shell\n // misconfiguration, auth failure before hydration), show an error rather\n // than spinning indefinitely.\n useEffect(() => {\n if (clientReady) return;\n const timer = setTimeout(() => {\n if (!clientReady) {\n setClientError(\n 'BigConsole could not connect to the gateway. Please refresh the page or check your configuration.'\n );\n }\n }, 10_000);\n return () => clearTimeout(timer);\n }, [clientReady]);\n\n // Callback: sync workflow metadata to BigConsole after FluidGrids SDK saves\n const handleWorkflowSaved = useCallback(\n async (result: WorkflowSavedResult) => {\n // Only create a BigConsole record for brand-new workflows.\n // 'updated' = edit of existing, 'versioned' = new snapshot of same key — both already have records.\n if (result.operation !== 'created') return;\n\n if (!workspaceClient) {\n console.warn('[BigConsole] onWorkflowSaved: workspace client not ready');\n return;\n }\n\n // In-flight guard: prevent duplicate records from rapid double-fire\n // (React StrictMode, retry, fast double-click).\n if (inFlightKeys.has(result.workflowKey)) return;\n inFlightKeys.add(result.workflowKey);\n\n try {\n // Idempotency check — avoid creating duplicates if callback fires twice\n const existing = await workspaceClient.query<GetWorkflowByKeyQuery>({\n query: getWorkflowByKeyDocument,\n variables: { key: result.workflowKey },\n fetchPolicy: 'network-only',\n });\n\n if (existing.data?.workflowByKey) {\n return;\n }\n\n // Create BigConsole metadata record linked to the SDK workflow\n await workspaceClient.mutate<CreateWorkflowMutation>({\n mutation: createWorkflowDocument,\n variables: {\n input: {\n name: result.name,\n key: result.workflowKey,\n description: result.description,\n externalWorkflowId: result.dbId,\n },\n },\n refetchQueries: [{ query: listWorkflowsDocument }],\n });\n } catch (err) {\n // Possible: network error, or duplicate-key constraint (race condition).\n // SDK save already succeeded — never block the user.\n console.warn('[BigConsole] onWorkflowSaved: failed to create record:', err);\n } finally {\n inFlightKeys.delete(result.workflowKey);\n }\n },\n [workspaceClient]\n );\n\n // BOFF-1870 follow-up: keep this ref bridge explicit as the breadcrumb for\n // why this callback is decoupled from SDK config updates.\n // Ref-forwarding: decouple the callback from the SDK config effect so that\n // workspaceClient reference changes don't trigger resetFluidGridsConfig() + re-init.\n const handleWorkflowSavedRef = useRef(handleWorkflowSaved);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: keep ref in sync with latest callback\n useLayoutEffect(() => {\n handleWorkflowSavedRef.current = handleWorkflowSaved;\n }, [handleWorkflowSaved]);\n\n // Configure FluidGrids SDK settings\n useEffect(() => {\n if (props.apiGatewayUrl) {\n const normalizedBase = props.apiGatewayUrl.endsWith('/') ? props.apiGatewayUrl.slice(0, -1) : props.apiGatewayUrl;\n\n console.log('[BigConsole] Setting FluidGrids config', {\n apiGatewayUrl: normalizedBase,\n workspaceId: props.workspaceId,\n tenantId: props.tenantId,\n productId: props.productId,\n productName: props.productName,\n });\n\n setFluidGridsConfig({\n apiGatewayUrl: normalizedBase,\n authToken: props.authToken,\n workspaceId: props.workspaceId ?? '',\n tenantId: props.tenantId,\n // Default to 'bigconsole' when unset — the SDK uses productId for workflow isolation\n // (filtering workflows by product). undefined would show all products' workflows.\n productId: props.productId ?? 'bigconsole',\n productName: props.productName ?? 'BigConsole',\n // Stable wrapper via ref — avoids SDK re-init when workspaceClient changes reference\n onWorkflowSaved: (result: WorkflowSavedResult) => handleWorkflowSavedRef.current(result),\n });\n }\n return () => {\n resetFluidGridsConfig();\n };\n // handleWorkflowSavedRef is stable (useRef) — intentionally excluded to prevent SDK re-init on client change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.apiGatewayUrl, props.authToken, props.workspaceId, props.tenantId, props.productId, props.productName]);\n\n // Drilldown modal state from store\n const [searchParams, setSearchParams] = useSearchParams();\n const isModalOpen = useDrilldownStore((state) => state.isOpen);\n const closeModal = useDrilldownStore((state) => state.closeModal);\n useFilterUrlSync();\n\n const handleDrilldownClose = useCallback(() => {\n closeModal();\n // Clear any cross-filter URL params when closing drilldown modal\n const newParams = new URLSearchParams(searchParams);\n Array.from(newParams.keys()).forEach((key) => {\n if (key.startsWith('filter_') || key.startsWith('ctx_')) {\n newParams.delete(key);\n }\n });\n setSearchParams(newParams, { replace: true });\n // Remove focus from any element to prevent blue border\n if (document.activeElement instanceof HTMLElement) {\n document.activeElement.blur();\n }\n }, [closeModal, searchParams, setSearchParams]);\n\n const handleViewBilling = useCallback(() => {\n if (hostNavigate) {\n hostNavigate('/billing');\n return;\n }\n window.location.assign('/billing');\n }, [hostNavigate]);\n\n // Render a DrilldownDashboardRenderer inside the modal when a drilldown is active.\n // This callback is only invoked by DrilldownModal when isOpen && dashboardId are set,\n // so the renderer always receives a valid dashboardId.\n // NOTE: Must be declared before the early return below to satisfy React's rules of hooks.\n const renderDrilldownDashboard = useCallback(\n (dashboardId: string, params: Record<string, unknown>) => (\n <DrilldownDashboardRenderer dashboardId={dashboardId} params={params} />\n ),\n []\n );\n\n // Don't render until client is ready (same pattern as microfe-workflows)\n if (!clientReady) {\n if (clientError) {\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center p-6\">\n <div className=\"text-center\">\n <p className=\"text-sm text-text-secondary mb-4\">{clientError}</p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"px-4 py-2 text-sm font-medium text-white bg-action-primary-bg hover:bg-action-primary-bg/90 rounded-md transition-colors\"\n >\n Reload Page\n </button>\n </div>\n </div>\n );\n }\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-600\" />\n </div>\n );\n }\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n Something went wrong loading BigConsole. Please refresh the page.\n </div>\n }\n >\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <BigConsoleProvider props={props}>\n <BigConsoleQuotaProvider onViewBilling={handleViewBilling}>\n <NavigationProvider basePath={basePath}>\n <CrossFilterProvider>\n {/* Sits ABOVE the routed page, so when the assistant starts building\n you watch it happen on whatever screen you were already on —\n rather than having to guess which list to go and refresh. */}\n <AiPreviewPanel />\n <BigConsoleRoutes {...props} />\n {isModalOpen && (\n <DrilldownModal onClose={handleDrilldownClose} renderDashboard={renderDrilldownDashboard} />\n )}\n </CrossFilterProvider>\n </NavigationProv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GAAc;AAChB,KAAa,WAAW;AACxB;;AAEF,SAAO,SAAS,OAAO,WAAW;IACjC,CAAC,EAAa,CAAC,EAMZ,KAA2B,GAC9B,GAAqB,MACpB,kBAAC,GAAD;EAAyC;EAAqB;EAAU,CAAA,EAE1E,EAAE,CACH;AA2BD,QAxBK,IAyBH,kBAAC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;aAAsC;GAE/C,CAAA;YAGR,kBAAC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;aACvE,kBAAC,GAAD;IAA2B;cACzB,kBAAC,GAAD;KAAyB,eAAe;eACtC,kBAAC,GAAD;MAA8B;gBAC5B,kBAAC,GAAD,EAAA,UAAA;OAIE,kBAAC,GAAD,EAAkB,CAAA;OAClB,kBAAC,GAAD,EAAkB,GAAI,GAAS,CAAA;OAC9B,KACC,kBAAC,GAAD;QAAgB,SAAS;QAAsB,iBAAiB;QAA4B,CAAA;OAE1E,EAAA,CAAA;MACH,CAAA;KACG,CAAA;IACP,CAAA;GACD,CAAA;EACR,CAAA,GAjDZ,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,KAAD;IAAG,WAAU;cAAoC;IAAgB,CAAA,EACjE,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,OAAO,SAAS,QAAQ;IACvC,WAAU;cACX;IAEQ,CAAA,CACL;;EACF,CAAA,GAIR,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,gFAAiF,CAAA;EAC5F,CAAA"}
1
+ {"version":3,"file":"BigConsoleRoot.js","names":[],"sources":["../../src/bigconsole/BigConsoleRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { useSearchParams } from 'react-router';\nimport type { TypedDocumentNode } from '@apollo/client';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { BarChart3, Database, LayoutDashboard, Lightbulb, Settings, Boxes } from 'lucide-react';\nimport type { BigConsoleRootProps } from './types';\nimport { BigConsoleRoutes } from './BigConsoleRoutes';\nimport { BigConsoleProvider } from './context';\nimport { NavigationProvider, CrossFilterProvider } from './contexts';\nimport { BigConsoleQuotaProvider } from './providers/BigConsoleQuotaProvider';\nimport { AiPreviewPanel } from './components/preview/AiPreviewPanel';\nimport { DrilldownModal } from './components/DrilldownModal';\nimport { DrilldownDashboardRenderer } from './components/DrilldownDashboardRenderer';\nimport { useFilterUrlSync } from './hooks/useFilterUrlSync';\nimport { useDrilldownStore } from './store/drilldownStore';\n\n// FluidGrids SDK client injection (needed for workflow components)\nimport {\n setFluidGridsClient,\n resetFluidGridsClient,\n setFluidGridsConfig,\n resetFluidGridsConfig,\n setGlobalStoreClient,\n resetGlobalStoreClient,\n} from '@burdenoff/fluidgrids-fe-sdk';\n// Use the shared gateway Apollo clients from the shell\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport {\n CreateWorkflowDocument,\n GetWorkflowByKeyDocument,\n ListWorkflowsDocument,\n type GetWorkflowByKeyQuery,\n type GetWorkflowByKeyQueryVariables,\n type CreateWorkflowMutation,\n type CreateWorkflowMutationVariables,\n type ListWorkflowsQuery,\n type ListWorkflowsQueryVariables,\n} from '../generated/wspace-operations';\n\nconst getWorkflowByKeyDocument = GetWorkflowByKeyDocument as unknown as TypedDocumentNode<\n GetWorkflowByKeyQuery,\n GetWorkflowByKeyQueryVariables\n>;\nconst createWorkflowDocument = CreateWorkflowDocument as unknown as TypedDocumentNode<\n CreateWorkflowMutation,\n CreateWorkflowMutationVariables\n>;\nconst listWorkflowsDocument = ListWorkflowsDocument as unknown as TypedDocumentNode<\n ListWorkflowsQuery,\n ListWorkflowsQueryVariables\n>;\n\n/**\n * Local contract for the workflow-save payload emitted by the embedded FluidGrids builder.\n * Kept explicit here to maintain strict typing at the BigConsole boundary.\n */\ninterface WorkflowSavedResult {\n dbId: string;\n workflowKey: string;\n version: string;\n name: string;\n description?: string;\n operation: 'created' | 'updated' | 'versioned';\n}\n\n// In-flight guard: prevents duplicate BigConsole records when the callback\n// fires twice in rapid succession (React StrictMode, retry, double-click).\n// Server unique constraint on `key` is the ultimate backstop.\nconst inFlightKeys = new Set<string>();\n\n/**\n * Root component for the BigConsole microfrontend.\n *\n * This is the main entry point that host applications import and render.\n * It sets up the necessary providers and renders the internal routing.\n * Automatically registers navigation items with the shell if registration functions are provided.\n *\n * @example\n * ```tsx\n * import { BigConsoleRoot, type BigConsoleRootProps } from '@burdenoff/microfe-bigconsole';\n *\n * function App() {\n * const props: BigConsoleRootProps = {\n * basePath: '/analytics',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com' },\n * apiGatewayUrl: 'https://api.example.com',\n * authToken: 'token',\n * };\n *\n * return <BigConsoleRoot {...props} />;\n * }\n * ```\n */\nexport const BigConsoleRoot: FC<BigConsoleRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/bigconsole', navigate: hostNavigate } = props;\n\n // Use the shared Apollo clients from the shell (both workspace and global)\n const workspaceClient = useGatewayClient('workspace');\n const globalClient = useGatewayClient('global');\n const [clientReady, setClientReady] = useState(false);\n const [clientError, setClientError] = useState<string | null>(null);\n\n // Helper to join paths correctly, avoiding double slashes\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with the shell\n useEffect(() => {\n if (!registerNavItems) return;\n\n const bigConsoleNavItem = {\n id: 'bigconsole',\n label: 'Analytics',\n path: basePath,\n icon: <BarChart3 size={20} />,\n order: 15,\n group: 'bigconsole',\n children: [\n {\n id: 'bigconsole-home',\n label: 'Overview',\n path: basePath,\n icon: <BarChart3 size={16} />,\n order: 10,\n },\n {\n id: 'bigconsole-dashboards',\n label: 'Dashboards',\n path: joinPath(basePath, 'dashboards'),\n icon: <LayoutDashboard size={16} />,\n order: 20,\n },\n {\n id: 'bigconsole-datasources',\n label: 'Data Sources',\n path: joinPath(basePath, 'datasources'),\n icon: <Database size={16} />,\n order: 30,\n },\n {\n id: 'bigconsole-insights',\n label: 'AI Insights',\n path: joinPath(basePath, 'insights'),\n icon: <Lightbulb size={16} />,\n order: 40,\n },\n {\n id: 'bigconsole-widgets',\n label: 'Widget Demo',\n path: joinPath(basePath, 'widgets/demo'),\n icon: <Boxes size={16} />,\n order: 50,\n },\n {\n id: 'bigconsole-settings',\n label: 'Settings',\n path: joinPath(basePath, 'settings'),\n icon: <Settings size={16} />,\n order: 60,\n },\n ],\n };\n\n const cleanup = registerNavItems(bigConsoleNavItem);\n return cleanup;\n }, [registerNavItems, basePath]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'bigconsole-status',\n label: 'Analytics Ready',\n type: 'status' as const,\n order: 15,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n // Inject Apollo clients into FluidGrids SDK (for workflow components)\n // This synchronizes external stores (module-level client singletons in the SDK)\n // with React's lifecycle. The setState call is intentional — it gates rendering\n // so children don't mount before the SDK clients are available.\n //\n // KNOWN TRADE-OFF: clientReady is NOT reset in cleanup. When workspaceClient/globalClient\n // change references (e.g. token refresh), children continue rendering against a briefly\n // uninitialized SDK client until the next effect run re-injects the new client. This avoids\n // a visible spinner flash mid-session. Failed SDK requests during this short window will\n // be retried by React Query / Apollo's retry policies. If this becomes a real issue,\n // consider using startTransition to reset clientReady without the visual disruption.\n useEffect(() => {\n if (workspaceClient && globalClient) {\n setFluidGridsClient(workspaceClient);\n setGlobalStoreClient(globalClient);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: gate children until external SDK clients are injected\n setClientReady(true);\n }\n return () => {\n resetFluidGridsClient();\n resetGlobalStoreClient();\n };\n }, [workspaceClient, globalClient]);\n\n // Timeout fallback: if gateway clients are never provided (test env, shell\n // misconfiguration, auth failure before hydration), show an error rather\n // than spinning indefinitely.\n useEffect(() => {\n if (clientReady) return;\n const timer = setTimeout(() => {\n if (!clientReady) {\n setClientError(\n 'BigConsole could not connect to the gateway. Please refresh the page or check your configuration.'\n );\n }\n }, 10_000);\n return () => clearTimeout(timer);\n }, [clientReady]);\n\n // Callback: sync workflow metadata to BigConsole after FluidGrids SDK saves\n const handleWorkflowSaved = useCallback(\n async (result: WorkflowSavedResult) => {\n // Only create a BigConsole record for brand-new workflows.\n // 'updated' = edit of existing, 'versioned' = new snapshot of same key — both already have records.\n if (result.operation !== 'created') return;\n\n if (!workspaceClient) {\n console.warn('[BigConsole] onWorkflowSaved: workspace client not ready');\n return;\n }\n\n // In-flight guard: prevent duplicate records from rapid double-fire\n // (React StrictMode, retry, fast double-click).\n if (inFlightKeys.has(result.workflowKey)) return;\n inFlightKeys.add(result.workflowKey);\n\n try {\n // Idempotency check — avoid creating duplicates if callback fires twice\n const existing = await workspaceClient.query<GetWorkflowByKeyQuery>({\n query: getWorkflowByKeyDocument,\n variables: { key: result.workflowKey },\n fetchPolicy: 'network-only',\n });\n\n if (existing.data?.workflowByKey) {\n return;\n }\n\n // Create BigConsole metadata record linked to the SDK workflow\n await workspaceClient.mutate<CreateWorkflowMutation>({\n mutation: createWorkflowDocument,\n variables: {\n input: {\n name: result.name,\n key: result.workflowKey,\n description: result.description,\n externalWorkflowId: result.dbId,\n },\n },\n refetchQueries: [{ query: listWorkflowsDocument }],\n });\n } catch (err) {\n // Possible: network error, or duplicate-key constraint (race condition).\n // SDK save already succeeded — never block the user.\n console.warn('[BigConsole] onWorkflowSaved: failed to create record:', err);\n } finally {\n inFlightKeys.delete(result.workflowKey);\n }\n },\n [workspaceClient]\n );\n\n // BOFF-1870 follow-up: keep this ref bridge explicit as the breadcrumb for\n // why this callback is decoupled from SDK config updates.\n // Ref-forwarding: decouple the callback from the SDK config effect so that\n // workspaceClient reference changes don't trigger resetFluidGridsConfig() + re-init.\n const handleWorkflowSavedRef = useRef(handleWorkflowSaved);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: keep ref in sync with latest callback\n useLayoutEffect(() => {\n handleWorkflowSavedRef.current = handleWorkflowSaved;\n }, [handleWorkflowSaved]);\n\n // Configure FluidGrids SDK settings\n useEffect(() => {\n if (props.apiGatewayUrl) {\n const normalizedBase = props.apiGatewayUrl.endsWith('/') ? props.apiGatewayUrl.slice(0, -1) : props.apiGatewayUrl;\n\n console.log('[BigConsole] Setting FluidGrids config', {\n apiGatewayUrl: normalizedBase,\n workspaceId: props.workspaceId,\n tenantId: props.tenantId,\n productId: props.productId,\n productName: props.productName,\n });\n\n setFluidGridsConfig({\n apiGatewayUrl: normalizedBase,\n authToken: props.authToken,\n workspaceId: props.workspaceId ?? '',\n tenantId: props.tenantId,\n // Default to 'bigconsole' when unset — the SDK uses productId for workflow isolation\n // (filtering workflows by product). undefined would show all products' workflows.\n productId: props.productId ?? 'bigconsole',\n productName: props.productName ?? 'BigConsole',\n // Stable wrapper via ref — avoids SDK re-init when workspaceClient changes reference\n onWorkflowSaved: (result: WorkflowSavedResult) => handleWorkflowSavedRef.current(result),\n });\n }\n return () => {\n resetFluidGridsConfig();\n };\n // handleWorkflowSavedRef is stable (useRef) — intentionally excluded to prevent SDK re-init on client change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.apiGatewayUrl, props.authToken, props.workspaceId, props.tenantId, props.productId, props.productName]);\n\n // Drilldown modal state from store\n const [searchParams, setSearchParams] = useSearchParams();\n const isModalOpen = useDrilldownStore((state) => state.isOpen);\n const closeModal = useDrilldownStore((state) => state.closeModal);\n useFilterUrlSync();\n\n const handleDrilldownClose = useCallback(() => {\n closeModal();\n // Clear any cross-filter URL params when closing drilldown modal\n const newParams = new URLSearchParams(searchParams);\n Array.from(newParams.keys()).forEach((key) => {\n if (key.startsWith('filter_') || key.startsWith('ctx_')) {\n newParams.delete(key);\n }\n });\n setSearchParams(newParams, { replace: true });\n // Remove focus from any element to prevent blue border\n if (document.activeElement instanceof HTMLElement) {\n document.activeElement.blur();\n }\n }, [closeModal, searchParams, setSearchParams]);\n\n const handleViewBilling = useCallback(() => {\n if (hostNavigate) {\n hostNavigate('/billing');\n return;\n }\n window.location.assign('/billing');\n }, [hostNavigate]);\n\n // Render a DrilldownDashboardRenderer inside the modal when a drilldown is active.\n // This callback is only invoked by DrilldownModal when isOpen && dashboardId are set,\n // so the renderer always receives a valid dashboardId.\n // NOTE: Must be declared before the early return below to satisfy React's rules of hooks.\n const renderDrilldownDashboard = useCallback(\n (dashboardId: string, params: Record<string, unknown>) => (\n <DrilldownDashboardRenderer dashboardId={dashboardId} params={params} />\n ),\n []\n );\n\n // Don't render until client is ready (same pattern as microfe-workflows)\n if (!clientReady) {\n if (clientError) {\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center p-6\">\n <div className=\"text-center\">\n <p className=\"text-sm text-text-secondary mb-4\">{clientError}</p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"px-4 py-2 text-sm font-medium text-white bg-action-primary-bg hover:bg-action-primary-bg/90 rounded-md transition-colors\"\n >\n Reload Page\n </button>\n </div>\n </div>\n );\n }\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-600\" />\n </div>\n );\n }\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n Something went wrong loading BigConsole. Please refresh the page.\n </div>\n }\n >\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <BigConsoleProvider props={props}>\n <BigConsoleQuotaProvider onViewBilling={handleViewBilling}>\n <NavigationProvider basePath={basePath}>\n <CrossFilterProvider>\n {/* Sits ABOVE the routed page, so when the assistant starts building\n you watch it happen on whatever screen you were already on —\n rather than having to guess which list to go and refresh. */}\n <AiPreviewPanel />\n <BigConsoleRoutes {...props} />\n {isModalOpen && (\n <DrilldownModal onClose={handleDrilldownClose} renderDashboard={renderDrilldownDashboard} />\n )}\n </CrossFilterProvider>\n </NavigationProvider>\n </BigConsoleQuotaProvider>\n </BigConsoleProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAM,IAA2B,GAI3B,IAAyB,GAIzB,IAAwB,GAqBxB,oBAAe,IAAI,KAAa,EA0BzB,KAA2C,MAAU;CAChE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,eAAe,UAAU,MAAiB,GAG9F,IAAkB,EAAiB,YAAY,EAC/C,IAAe,EAAiB,SAAS,EACzC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAG7D,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AA8GtD,CAzGA,QAAgB;AACT,QAwDL,QADgB,EArDU;GACxB,IAAI;GACJ,OAAO;GACP,MAAM;GACN,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;GAC7B,OAAO;GACP,OAAO;GACP,UAAU;IACR;KACE,IAAI;KACJ,OAAO;KACP,MAAM;KACN,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;KAC7B,OAAO;KACR;IACD;KACE,IAAI;KACJ,OAAO;KACP,MAAM,EAAS,GAAU,aAAa;KACtC,MAAM,kBAAC,GAAD,EAAiB,MAAM,IAAM,CAAA;KACnC,OAAO;KACR;IACD;KACE,IAAI;KACJ,OAAO;KACP,MAAM,EAAS,GAAU,cAAc;KACvC,MAAM,kBAAC,GAAD,EAAU,MAAM,IAAM,CAAA;KAC5B,OAAO;KACR;IACD;KACE,IAAI;KACJ,OAAO;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Operations.js";
6
6
  import { BOOTSTRAP_RETRY_DELAY_MS as i } from "./constants.js";
7
7
  import { Suspense as a, lazy as o, memo as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
8
- import { Navigate as f, Route as p, Routes as m, useParams as h } from "react-router-dom";
8
+ import { Navigate as f, Route as p, Routes as m, useParams as h } from "react-router";
9
9
  import { useApolloClient as g } from "@apollo/client/react";
10
10
  import { Spinner as _ } from "@burdenoff/fe-libs/ui";
11
11
  import { jsx as v, jsxs as y } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"BigConsoleRoutes.js","names":[],"sources":["../../src/bigconsole/BigConsoleRoutes.tsx"],"sourcesContent":["import { lazy, Suspense, memo, useState, useMemo, useEffect, useRef } from 'react';\nimport { Route, Routes, Navigate, useParams } from 'react-router-dom';\nimport { type BigConsoleRootProps } from './types';\nimport { HomePage } from './pages/HomePage';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useAppNavigate } from './contexts';\nimport { useWorkflowOperations } from './hooks/useWorkflowOperations';\nimport { GetWorkflowDocument } from '../generated/wspace-operations';\nimport { BOOTSTRAP_RETRY_DELAY_MS } from './constants';\n\n// Import FluidGrids SDK workflow components (EXACT same as microfe-workflows)\nimport {\n WorkflowBuilderPage as SDKWorkflowBuilderPage,\n ExecutionsListPage,\n ExecutionDetailPage,\n HistoryPage,\n TemplatesPage,\n NodesPage,\n SettingsPage as WorkflowSettingsPage,\n} from '@burdenoff/fluidgrids-fe-sdk';\n\n// Lazy-loaded pages\nconst DashboardsPage = lazy(() => import('./pages/DashboardsPage'));\nconst DashboardViewPage = lazy(() => import('./pages/DashboardViewPage'));\nconst DashboardBuilderPage = lazy(() => import('./pages/DashboardBuilderPage'));\nconst DataSourcesPage = lazy(() => import('./pages/DataSourcesPage'));\nconst InsightsPage = lazy(() => import('./pages/InsightsPage'));\nconst SettingsPage = lazy(() => import('./pages/SettingsPage'));\nconst WidgetDemoPage = lazy(() => import('./pages/WidgetDemoPage'));\n// BigConsole-native workflow pages (query bigconsole-svc, not workflow-svc)\n// These use named exports (no default export), so we remap via .then()\nconst WorkflowsPage = lazy(() => import('./pages/WorkflowsPage').then((m) => ({ default: m.WorkflowsPage })));\nconst WorkflowViewPage = lazy(() => import('./pages/WorkflowViewPage').then((m) => ({ default: m.WorkflowViewPage })));\n// DataSink Pages\nconst DataSinksPage = lazy(() => import('./pages/DataSinksPage'));\nconst DataSinkViewPage = lazy(() => import('./pages/DataSinkViewPage'));\nconst DataSinkBuilderPage = lazy(() => import('./pages/DataSinkBuilderPage'));\n// Parser Pages\nconst DataParsersPage = lazy(() => import('./pages/DataParsersPage'));\nconst ParserViewPage = lazy(() => import('./pages/ParserViewPage'));\nconst ParserBuilderPage = lazy(() => import('./pages/ParserBuilderPage'));\n// Pipeline Pages\nconst PipelinesPage = lazy(() => import('./pages/PipelinesPage'));\nconst PipelineViewPage = lazy(() => import('./pages/PipelineViewPage'));\nconst PipelineBuilderPage = lazy(() => import('./pages/PipelineBuilderPage'));\n\n// Loading fallback component\nfunction PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n}\n\n/** Generate a new workflow builder path with a fresh UUID key. */\nexport const newWorkflowPath = () => `/workflows/workflow/${crypto.randomUUID()}/v1`;\n\n/**\n * Redirect /workflows/new to a UUID-based URL.\n * Uses <Navigate> for synchronous redirect (no blank frame).\n */\nfunction WorkflowNewRedirect() {\n const path = useMemo(() => newWorkflowPath(), []);\n return <Navigate to={path} replace />;\n}\n\n/**\n * Bridge component: resolves a BigConsole workflow ID to its externalWorkflowId\n * and navigates to the SDK's visual builder route.\n *\n * Route: /workflows/:workflowId/edit\n * Redirects to: /workflows/workflow/{workflowKey}/v1\n */\nconst WorkflowEditBridge = memo(function WorkflowEditBridge() {\n const { workflowId } = useParams<{ workflowId: string }>();\n const navigate = useAppNavigate();\n const { fetchWorkflow } = useWorkflowOperations({ skipFetch: true });\n const [error, setError] = useState<string | null>(null);\n const retryCount = useRef(0);\n\n useEffect(() => {\n if (!workflowId) {\n setError('No workflow ID provided');\n return;\n }\n\n // Reset retry budget and error when workflowId changes so a\n // previous failed attempt doesn't consume the new workflow's retry.\n retryCount.current = 0;\n setError(null);\n let cancelled = false;\n\n const handleResult = (workflow: Awaited<ReturnType<typeof fetchWorkflow>>) => {\n if (cancelled) return;\n\n if (workflow?.key) {\n // Navigate to the SDK builder route using the workflow key (e.g. \"github_user_profile\")\n // and default version \"v1\". The FluidGrids SDK fetches the definition by workflowKey.\n // Replace history so the bridge doesn't trap the back button.\n navigate(`/workflows/workflow/${workflow.key}/v1`, { replace: true });\n } else if (workflow) {\n // Workflow exists but has no key — open SDK builder in create mode\n navigate(`/workflows/builder`, { replace: true });\n } else if (retryCount.current < 1) {\n // On full-page loads the auth/workspace context may not be bootstrapped yet,\n // causing a false null. Retry once after a short delay (same pattern as WorkflowViewPage).\n retryCount.current += 1;\n setTimeout(() => {\n if (!cancelled) {\n fetchWorkflow(workflowId)\n .then(handleResult)\n .catch((err) => {\n if (!cancelled) setError(err?.message ?? 'Failed to load workflow');\n });\n }\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n setError('Workflow not found');\n }\n };\n\n fetchWorkflow(workflowId)\n .then(handleResult)\n .catch((err) => {\n if (!cancelled) setError(err?.message ?? 'Failed to load workflow');\n });\n\n return () => {\n cancelled = true;\n };\n }, [workflowId, fetchWorkflow, navigate]);\n\n if (error) {\n return (\n <div className=\"p-6 flex flex-col items-center justify-center min-h-[400px] text-center gap-4\">\n <p className=\"text-sm text-text-secondary\">{error}</p>\n <button\n type=\"button\"\n onClick={() => navigate('/workflows')}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n Back to Workflows\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n});\n\n/**\n * Matches a canonical v4-style UUID. BigConsole workflow RECORD ids are UUIDs;\n * workflow KEYS are human slugs (e.g. \"users_analytics\"). New-workflow URLs also\n * use a fresh `crypto.randomUUID()` as the builder key. We only attempt record\n * resolution for UUID-shaped `:id`s — slugs are always real keys and skip the\n * lookup entirely (no extra round-trip, no spinner flash).\n */\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/** Minimal shape of the GetWorkflow query — the resolver only needs the key. */\ntype WorkflowKeyLookup = { workflow: { key: string | null } | null };\n\n/**\n * Guards the SDK visual builder route.\n *\n * The SDK builder loads its definition from workflow-svc using the URL `:id` as\n * the `workflowKey`. That only works when `:id` is the workflow KEY. When a\n * BigConsole workflow RECORD id (a UUID) reaches the builder — via the SDK\n * card's `navigate(\"../workflow/\" + workflow.workflow_key + ...)`, a bookmarked\n * record-id URL, etc. — no definition matches that key, so the canvas is empty\n * AND the SDK silently creates a phantom 0-node definition keyed by the UUID.\n *\n * This resolver closes that gap centrally (the same id→key resolution the\n * `/workflows/:workflowId/edit` `WorkflowEditBridge` does, but applied to the\n * builder route itself so EVERY entry point is covered):\n * - `:id` is a slug → it's already a key → render the builder as-is.\n * - `:id` is a UUID that maps to a BigConsole record with a different key →\n * redirect to `/workflows/workflow/<key>/<version>`.\n * - `:id` is a UUID that is NOT a record (a fresh new-workflow id) → render\n * the builder as-is (create mode).\n */\nconst WorkflowBuilderResolver = memo(function WorkflowBuilderResolver() {\n const { id, version } = useParams<{ id: string; version: string }>();\n const navigate = useAppNavigate();\n const client = useApolloClient();\n // Slugs (real keys) render the builder immediately (derived below); only\n // UUID-shaped ids need a record lookup first.\n const isUuid = !!id && UUID_RE.test(id);\n // A UUID is only safe to open in the SDK builder once the lookup POSITIVELY\n // confirms it is not a BigConsole record (a clean not-found — e.g. a fresh\n // new-workflow id). Both verdicts are keyed by the id they describe so that\n // navigating between workflows re-resolves instead of reusing a stale answer.\n const [confirmedAbsentId, setConfirmedAbsentId] = useState<string | null>(null);\n const [failedId, setFailedId] = useState<string | null>(null);\n // Bumped by the \"Try again\" button to re-run the lookup effect after a failure.\n const [retryNonce, setRetryNonce] = useState(0);\n const retryCount = useRef(0);\n\n useEffect(() => {\n if (!id || !isUuid) return;\n\n retryCount.current = 0;\n let cancelled = false;\n const targetVersion = version ?? 'v1';\n\n const attempt = () => {\n // Query directly (not via fetchWorkflow, which swallows Apollo errors and\n // returns null) so we can tell a genuine \"no such record\" apart from a\n // transient lookup failure. Treating a failure as not-found would re-open\n // the builder with the record id and recreate a phantom 0-node definition.\n client\n .query<WorkflowKeyLookup>({\n query: GetWorkflowDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n })\n .then((result) => {\n if (cancelled) return;\n const record = result.data?.workflow;\n if (record) {\n // The UUID IS a BigConsole record.\n if (record.key && record.key !== id) {\n // Open the builder under its real key (where the definition + nodes\n // live). encodeURIComponent guards against URL-unsafe key chars.\n // Replace history so the resolver doesn't trap the back button.\n navigate(`/workflows/workflow/${encodeURIComponent(record.key)}/${targetVersion}`, {\n replace: true,\n });\n } else {\n // Record exists but has no usable key — open a blank builder rather\n // than reusing the record UUID as the key (which would phantom).\n navigate('/workflows/builder', { replace: true });\n }\n } else {\n // Query succeeded with no record → a genuine new-workflow id.\n setConfirmedAbsentId(id);\n }\n })\n .catch(() => {\n if (cancelled) return;\n if (retryCount.current < 1) {\n // On a cold full-page load the auth/workspace context may not be\n // bootstrapped yet. Retry once before giving up.\n retryCount.current += 1;\n setTimeout(() => {\n if (!cancelled) attempt();\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n // Lookup failed — do NOT assume create mode (the id may be a record);\n // surface a retry instead of risking a phantom definition.\n setFailedId(id);\n }\n });\n };\n\n attempt();\n\n return () => {\n cancelled = true;\n };\n }, [id, isUuid, version, client, navigate, retryNonce]);\n\n // Slug keys, and UUIDs confirmed not to be records, render the builder.\n if (!isUuid || confirmedAbsentId === id) {\n return <SDKWorkflowBuilderPage />;\n }\n\n // A lookup that ultimately failed: surface a retry rather than silently\n // opening the builder with what may be a record id.\n if (failedId === id) {\n return (\n <div className=\"p-6 flex flex-col items-center justify-center min-h-[400px] text-center gap-4\">\n <p className=\"text-sm text-text-secondary\">Couldn&apos;t load this workflow. Please try again.</p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setFailedId(null);\n setRetryNonce((n) => n + 1);\n }}\n className=\"px-4 py-2 text-sm font-medium text-action-primary-fg bg-action-primary-bg hover:bg-action-primary-bgHover rounded-md transition-colors\"\n >\n Try again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate('/workflows')}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n Back to Workflows\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n});\n\nexport function BigConsoleRoutes(_props: BigConsoleRootProps) {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route path=\"/\" element={<HomePage />} />\n <Route path=\"/dashboards\" element={<DashboardsPage />} />\n <Route path=\"/dashboards/:dashboardId\" element={<DashboardViewPage />} />\n <Route path=\"/dashboards/:dashboardId/builder\" element={<DashboardBuilderPage />} />\n <Route path=\"/datasources\" element={<DataSourcesPage />} />\n <Route path=\"/insights\" element={<InsightsPage />} />\n <Route path=\"/settings\" element={<SettingsPage />} />\n <Route path=\"/widgets/demo\" element={<WidgetDemoPage />} />\n {/* DataSink Routes */}\n <Route path=\"/datasinks\" element={<DataSinksPage />} />\n <Route path=\"/datasinks/new\" element={<DataSinkBuilderPage />} />\n <Route path=\"/datasinks/:dataSinkId\" element={<DataSinkViewPage />} />\n <Route path=\"/datasinks/:dataSinkId/edit\" element={<DataSinkBuilderPage />} />\n {/* Parser Routes */}\n <Route path=\"/parsers\" element={<DataParsersPage />} />\n <Route path=\"/parsers/new\" element={<ParserBuilderPage />} />\n <Route path=\"/parsers/:parserId\" element={<ParserViewPage />} />\n <Route path=\"/parsers/:parserId/edit\" element={<ParserBuilderPage />} />\n {/* Dashboard-scoped Parser Routes */}\n <Route path=\"/dashboards/:consoleId/parsers\" element={<DataParsersPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/new\" element={<ParserBuilderPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/:parserId\" element={<ParserViewPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/:parserId/edit\" element={<ParserBuilderPage />} />\n {/* Workflow Routes — list/view use BigConsole-native pages (query bigconsole-svc).\n All static routes are grouped before the dynamic :workflowId catch-all.\n React Router v6 prioritizes static segments regardless of declaration order,\n but keeping them above the param routes makes intent unambiguous for maintainers. */}\n <Route path=\"/workflows\" element={<WorkflowsPage />} />\n <Route path=\"/workflows/list\" element={<WorkflowsPage />} />\n {/* New workflow — redirect to UUID-based URL (matches FluidGrids pattern) */}\n <Route path=\"/workflows/new\" element={<WorkflowNewRedirect />} />\n {/* SDK visual workflow builder — design existing workflows */}\n <Route path=\"/workflows/builder\" element={<SDKWorkflowBuilderPage />} />\n {/* All parameterised builder routes go through WorkflowBuilderResolver so a\n record-id `:id` is resolved to its workflow key first (slugs/new-workflow\n UUIDs pass straight through); otherwise the SDK opens an empty canvas and\n creates a phantom 0-node definition keyed by the record id. */}\n <Route path=\"/workflows/builder/:id/:version\" element={<WorkflowBuilderResolver />} />\n <Route path=\"/workflows/workflow/:id/:version\" element={<WorkflowBuilderResolver />} />\n {/* SDK sub-pages (runs, history, templates, nodes, settings) */}\n <Route path=\"/workflows/runs\" element={<ExecutionsListPage />} />\n <Route path=\"/workflows/runs/:runId\" element={<ExecutionDetailPage />} />\n <Route path=\"/workflows/history\" element={<HistoryPage />} />\n <Route path=\"/workflows/templates\" element={<TemplatesPage />} />\n <Route path=\"/workflows/nodes\" element={<NodesPage />} />\n <Route path=\"/workflows/settings\" element={<WorkflowSettingsPage />} />\n {/* Dynamic routes — :workflowId catch-all AFTER all static segments */}\n <Route path=\"/workflows/:workflowId\" element={<WorkflowViewPage />} />\n <Route path=\"/workflows/:workflowId/edit\" element={<WorkflowEditBridge />} />\n {/* Support SDK's navigation pattern (without /workflows/ prefix) — also\n resolves record-id → key via WorkflowBuilderResolver. */}\n <Route path=\"/workflow/:id/:version\" element={<WorkflowBuilderResolver />} />\n {/* Redirect /list to /workflows/list (SDK uses relative navigation) */}\n <Route path=\"/list\" element={<Navigate to=\"/bigconsole/workflows/list\" replace />} />\n {/* Pipeline Routes */}\n <Route path=\"/pipelines\" element={<PipelinesPage />} />\n <Route path=\"/pipelines/new\" element={<PipelineBuilderPage />} />\n <Route path=\"/pipelines/:pipelineId\" element={<PipelineViewPage />} />\n <Route path=\"/pipelines/:pipelineId/edit\" element={<PipelineBuilderPage />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,IAAiB,QAAW,OAAO,6BAA0B,EAC7D,IAAoB,QAAW,OAAO,gCAA6B,EACnE,IAAuB,QAAW,OAAO,mCAAgC,EACzE,IAAkB,QAAW,OAAO,8BAA2B,EAC/D,IAAe,QAAW,OAAO,2BAAwB,EACzD,IAAe,QAAW,OAAO,2BAAwB,EACzD,IAAiB,QAAW,OAAO,6BAA0B,EAG7D,IAAgB,QAAW,OAAO,4BAAyB,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,EACvG,IAAmB,QAAW,OAAO,+BAA4B,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,EAEhH,IAAgB,QAAW,OAAO,4BAAyB,EAC3D,IAAmB,QAAW,OAAO,+BAA4B,EACjE,IAAsB,QAAW,OAAO,kCAA+B,EAEvE,IAAkB,QAAW,OAAO,8BAA2B,EAC/D,IAAiB,QAAW,OAAO,6BAA0B,EAC7D,IAAoB,QAAW,OAAO,gC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,GAAD;IAAO,MAAK;IAAa,SAAS,kBAAC,GAAD,EAAiB,CAAA;IAAI,CAAA;GACvD,kBAAC,GAAD;IAAO,MAAK;IAAiB,SAAS,kBAAC,GAAD,EAAuB,CAAA;IAAI,CAAA;GACjE,kBAAC,GAAD;IAAO,MAAK;IAAyB,SAAS,kBAAC,GAAD,EAAoB,CAAA;IAAI,CAAA;GACtE,kBAAC,GAAD;IAAO,MAAK;IAA8B,SAAS,kBAAC,GAAD,EAAuB,CAAA;IAAI,CAAA;GACvE,EAAA,CAAA;EACA,CAAA"}
1
+ {"version":3,"file":"BigConsoleRoutes.js","names":[],"sources":["../../src/bigconsole/BigConsoleRoutes.tsx"],"sourcesContent":["import { lazy, Suspense, memo, useState, useMemo, useEffect, useRef } from 'react';\nimport { Route, Routes, Navigate, useParams } from 'react-router';\nimport { type BigConsoleRootProps } from './types';\nimport { HomePage } from './pages/HomePage';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useAppNavigate } from './contexts';\nimport { useWorkflowOperations } from './hooks/useWorkflowOperations';\nimport { GetWorkflowDocument } from '../generated/wspace-operations';\nimport { BOOTSTRAP_RETRY_DELAY_MS } from './constants';\n\n// Import FluidGrids SDK workflow components (EXACT same as microfe-workflows)\nimport {\n WorkflowBuilderPage as SDKWorkflowBuilderPage,\n ExecutionsListPage,\n ExecutionDetailPage,\n HistoryPage,\n TemplatesPage,\n NodesPage,\n SettingsPage as WorkflowSettingsPage,\n} from '@burdenoff/fluidgrids-fe-sdk';\n\n// Lazy-loaded pages\nconst DashboardsPage = lazy(() => import('./pages/DashboardsPage'));\nconst DashboardViewPage = lazy(() => import('./pages/DashboardViewPage'));\nconst DashboardBuilderPage = lazy(() => import('./pages/DashboardBuilderPage'));\nconst DataSourcesPage = lazy(() => import('./pages/DataSourcesPage'));\nconst InsightsPage = lazy(() => import('./pages/InsightsPage'));\nconst SettingsPage = lazy(() => import('./pages/SettingsPage'));\nconst WidgetDemoPage = lazy(() => import('./pages/WidgetDemoPage'));\n// BigConsole-native workflow pages (query bigconsole-svc, not workflow-svc)\n// These use named exports (no default export), so we remap via .then()\nconst WorkflowsPage = lazy(() => import('./pages/WorkflowsPage').then((m) => ({ default: m.WorkflowsPage })));\nconst WorkflowViewPage = lazy(() => import('./pages/WorkflowViewPage').then((m) => ({ default: m.WorkflowViewPage })));\n// DataSink Pages\nconst DataSinksPage = lazy(() => import('./pages/DataSinksPage'));\nconst DataSinkViewPage = lazy(() => import('./pages/DataSinkViewPage'));\nconst DataSinkBuilderPage = lazy(() => import('./pages/DataSinkBuilderPage'));\n// Parser Pages\nconst DataParsersPage = lazy(() => import('./pages/DataParsersPage'));\nconst ParserViewPage = lazy(() => import('./pages/ParserViewPage'));\nconst ParserBuilderPage = lazy(() => import('./pages/ParserBuilderPage'));\n// Pipeline Pages\nconst PipelinesPage = lazy(() => import('./pages/PipelinesPage'));\nconst PipelineViewPage = lazy(() => import('./pages/PipelineViewPage'));\nconst PipelineBuilderPage = lazy(() => import('./pages/PipelineBuilderPage'));\n\n// Loading fallback component\nfunction PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n}\n\n/** Generate a new workflow builder path with a fresh UUID key. */\nexport const newWorkflowPath = () => `/workflows/workflow/${crypto.randomUUID()}/v1`;\n\n/**\n * Redirect /workflows/new to a UUID-based URL.\n * Uses <Navigate> for synchronous redirect (no blank frame).\n */\nfunction WorkflowNewRedirect() {\n const path = useMemo(() => newWorkflowPath(), []);\n return <Navigate to={path} replace />;\n}\n\n/**\n * Bridge component: resolves a BigConsole workflow ID to its externalWorkflowId\n * and navigates to the SDK's visual builder route.\n *\n * Route: /workflows/:workflowId/edit\n * Redirects to: /workflows/workflow/{workflowKey}/v1\n */\nconst WorkflowEditBridge = memo(function WorkflowEditBridge() {\n const { workflowId } = useParams<{ workflowId: string }>();\n const navigate = useAppNavigate();\n const { fetchWorkflow } = useWorkflowOperations({ skipFetch: true });\n const [error, setError] = useState<string | null>(null);\n const retryCount = useRef(0);\n\n useEffect(() => {\n if (!workflowId) {\n setError('No workflow ID provided');\n return;\n }\n\n // Reset retry budget and error when workflowId changes so a\n // previous failed attempt doesn't consume the new workflow's retry.\n retryCount.current = 0;\n setError(null);\n let cancelled = false;\n\n const handleResult = (workflow: Awaited<ReturnType<typeof fetchWorkflow>>) => {\n if (cancelled) return;\n\n if (workflow?.key) {\n // Navigate to the SDK builder route using the workflow key (e.g. \"github_user_profile\")\n // and default version \"v1\". The FluidGrids SDK fetches the definition by workflowKey.\n // Replace history so the bridge doesn't trap the back button.\n navigate(`/workflows/workflow/${workflow.key}/v1`, { replace: true });\n } else if (workflow) {\n // Workflow exists but has no key — open SDK builder in create mode\n navigate(`/workflows/builder`, { replace: true });\n } else if (retryCount.current < 1) {\n // On full-page loads the auth/workspace context may not be bootstrapped yet,\n // causing a false null. Retry once after a short delay (same pattern as WorkflowViewPage).\n retryCount.current += 1;\n setTimeout(() => {\n if (!cancelled) {\n fetchWorkflow(workflowId)\n .then(handleResult)\n .catch((err) => {\n if (!cancelled) setError(err?.message ?? 'Failed to load workflow');\n });\n }\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n setError('Workflow not found');\n }\n };\n\n fetchWorkflow(workflowId)\n .then(handleResult)\n .catch((err) => {\n if (!cancelled) setError(err?.message ?? 'Failed to load workflow');\n });\n\n return () => {\n cancelled = true;\n };\n }, [workflowId, fetchWorkflow, navigate]);\n\n if (error) {\n return (\n <div className=\"p-6 flex flex-col items-center justify-center min-h-[400px] text-center gap-4\">\n <p className=\"text-sm text-text-secondary\">{error}</p>\n <button\n type=\"button\"\n onClick={() => navigate('/workflows')}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n Back to Workflows\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n});\n\n/**\n * Matches a canonical v4-style UUID. BigConsole workflow RECORD ids are UUIDs;\n * workflow KEYS are human slugs (e.g. \"users_analytics\"). New-workflow URLs also\n * use a fresh `crypto.randomUUID()` as the builder key. We only attempt record\n * resolution for UUID-shaped `:id`s — slugs are always real keys and skip the\n * lookup entirely (no extra round-trip, no spinner flash).\n */\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/** Minimal shape of the GetWorkflow query — the resolver only needs the key. */\ntype WorkflowKeyLookup = { workflow: { key: string | null } | null };\n\n/**\n * Guards the SDK visual builder route.\n *\n * The SDK builder loads its definition from workflow-svc using the URL `:id` as\n * the `workflowKey`. That only works when `:id` is the workflow KEY. When a\n * BigConsole workflow RECORD id (a UUID) reaches the builder — via the SDK\n * card's `navigate(\"../workflow/\" + workflow.workflow_key + ...)`, a bookmarked\n * record-id URL, etc. — no definition matches that key, so the canvas is empty\n * AND the SDK silently creates a phantom 0-node definition keyed by the UUID.\n *\n * This resolver closes that gap centrally (the same id→key resolution the\n * `/workflows/:workflowId/edit` `WorkflowEditBridge` does, but applied to the\n * builder route itself so EVERY entry point is covered):\n * - `:id` is a slug → it's already a key → render the builder as-is.\n * - `:id` is a UUID that maps to a BigConsole record with a different key →\n * redirect to `/workflows/workflow/<key>/<version>`.\n * - `:id` is a UUID that is NOT a record (a fresh new-workflow id) → render\n * the builder as-is (create mode).\n */\nconst WorkflowBuilderResolver = memo(function WorkflowBuilderResolver() {\n const { id, version } = useParams<{ id: string; version: string }>();\n const navigate = useAppNavigate();\n const client = useApolloClient();\n // Slugs (real keys) render the builder immediately (derived below); only\n // UUID-shaped ids need a record lookup first.\n const isUuid = !!id && UUID_RE.test(id);\n // A UUID is only safe to open in the SDK builder once the lookup POSITIVELY\n // confirms it is not a BigConsole record (a clean not-found — e.g. a fresh\n // new-workflow id). Both verdicts are keyed by the id they describe so that\n // navigating between workflows re-resolves instead of reusing a stale answer.\n const [confirmedAbsentId, setConfirmedAbsentId] = useState<string | null>(null);\n const [failedId, setFailedId] = useState<string | null>(null);\n // Bumped by the \"Try again\" button to re-run the lookup effect after a failure.\n const [retryNonce, setRetryNonce] = useState(0);\n const retryCount = useRef(0);\n\n useEffect(() => {\n if (!id || !isUuid) return;\n\n retryCount.current = 0;\n let cancelled = false;\n const targetVersion = version ?? 'v1';\n\n const attempt = () => {\n // Query directly (not via fetchWorkflow, which swallows Apollo errors and\n // returns null) so we can tell a genuine \"no such record\" apart from a\n // transient lookup failure. Treating a failure as not-found would re-open\n // the builder with the record id and recreate a phantom 0-node definition.\n client\n .query<WorkflowKeyLookup>({\n query: GetWorkflowDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n })\n .then((result) => {\n if (cancelled) return;\n const record = result.data?.workflow;\n if (record) {\n // The UUID IS a BigConsole record.\n if (record.key && record.key !== id) {\n // Open the builder under its real key (where the definition + nodes\n // live). encodeURIComponent guards against URL-unsafe key chars.\n // Replace history so the resolver doesn't trap the back button.\n navigate(`/workflows/workflow/${encodeURIComponent(record.key)}/${targetVersion}`, {\n replace: true,\n });\n } else {\n // Record exists but has no usable key — open a blank builder rather\n // than reusing the record UUID as the key (which would phantom).\n navigate('/workflows/builder', { replace: true });\n }\n } else {\n // Query succeeded with no record → a genuine new-workflow id.\n setConfirmedAbsentId(id);\n }\n })\n .catch(() => {\n if (cancelled) return;\n if (retryCount.current < 1) {\n // On a cold full-page load the auth/workspace context may not be\n // bootstrapped yet. Retry once before giving up.\n retryCount.current += 1;\n setTimeout(() => {\n if (!cancelled) attempt();\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n // Lookup failed — do NOT assume create mode (the id may be a record);\n // surface a retry instead of risking a phantom definition.\n setFailedId(id);\n }\n });\n };\n\n attempt();\n\n return () => {\n cancelled = true;\n };\n }, [id, isUuid, version, client, navigate, retryNonce]);\n\n // Slug keys, and UUIDs confirmed not to be records, render the builder.\n if (!isUuid || confirmedAbsentId === id) {\n return <SDKWorkflowBuilderPage />;\n }\n\n // A lookup that ultimately failed: surface a retry rather than silently\n // opening the builder with what may be a record id.\n if (failedId === id) {\n return (\n <div className=\"p-6 flex flex-col items-center justify-center min-h-[400px] text-center gap-4\">\n <p className=\"text-sm text-text-secondary\">Couldn&apos;t load this workflow. Please try again.</p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setFailedId(null);\n setRetryNonce((n) => n + 1);\n }}\n className=\"px-4 py-2 text-sm font-medium text-action-primary-fg bg-action-primary-bg hover:bg-action-primary-bgHover rounded-md transition-colors\"\n >\n Try again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate('/workflows')}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n Back to Workflows\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Spinner className=\"h-8 w-8\" />\n </div>\n );\n});\n\nexport function BigConsoleRoutes(_props: BigConsoleRootProps) {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route path=\"/\" element={<HomePage />} />\n <Route path=\"/dashboards\" element={<DashboardsPage />} />\n <Route path=\"/dashboards/:dashboardId\" element={<DashboardViewPage />} />\n <Route path=\"/dashboards/:dashboardId/builder\" element={<DashboardBuilderPage />} />\n <Route path=\"/datasources\" element={<DataSourcesPage />} />\n <Route path=\"/insights\" element={<InsightsPage />} />\n <Route path=\"/settings\" element={<SettingsPage />} />\n <Route path=\"/widgets/demo\" element={<WidgetDemoPage />} />\n {/* DataSink Routes */}\n <Route path=\"/datasinks\" element={<DataSinksPage />} />\n <Route path=\"/datasinks/new\" element={<DataSinkBuilderPage />} />\n <Route path=\"/datasinks/:dataSinkId\" element={<DataSinkViewPage />} />\n <Route path=\"/datasinks/:dataSinkId/edit\" element={<DataSinkBuilderPage />} />\n {/* Parser Routes */}\n <Route path=\"/parsers\" element={<DataParsersPage />} />\n <Route path=\"/parsers/new\" element={<ParserBuilderPage />} />\n <Route path=\"/parsers/:parserId\" element={<ParserViewPage />} />\n <Route path=\"/parsers/:parserId/edit\" element={<ParserBuilderPage />} />\n {/* Dashboard-scoped Parser Routes */}\n <Route path=\"/dashboards/:consoleId/parsers\" element={<DataParsersPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/new\" element={<ParserBuilderPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/:parserId\" element={<ParserViewPage />} />\n <Route path=\"/dashboards/:consoleId/parsers/:parserId/edit\" element={<ParserBuilderPage />} />\n {/* Workflow Routes — list/view use BigConsole-native pages (query bigconsole-svc).\n All static routes are grouped before the dynamic :workflowId catch-all.\n React Router v6 prioritizes static segments regardless of declaration order,\n but keeping them above the param routes makes intent unambiguous for maintainers. */}\n <Route path=\"/workflows\" element={<WorkflowsPage />} />\n <Route path=\"/workflows/list\" element={<WorkflowsPage />} />\n {/* New workflow — redirect to UUID-based URL (matches FluidGrids pattern) */}\n <Route path=\"/workflows/new\" element={<WorkflowNewRedirect />} />\n {/* SDK visual workflow builder — design existing workflows */}\n <Route path=\"/workflows/builder\" element={<SDKWorkflowBuilderPage />} />\n {/* All parameterised builder routes go through WorkflowBuilderResolver so a\n record-id `:id` is resolved to its workflow key first (slugs/new-workflow\n UUIDs pass straight through); otherwise the SDK opens an empty canvas and\n creates a phantom 0-node definition keyed by the record id. */}\n <Route path=\"/workflows/builder/:id/:version\" element={<WorkflowBuilderResolver />} />\n <Route path=\"/workflows/workflow/:id/:version\" element={<WorkflowBuilderResolver />} />\n {/* SDK sub-pages (runs, history, templates, nodes, settings) */}\n <Route path=\"/workflows/runs\" element={<ExecutionsListPage />} />\n <Route path=\"/workflows/runs/:runId\" element={<ExecutionDetailPage />} />\n <Route path=\"/workflows/history\" element={<HistoryPage />} />\n <Route path=\"/workflows/templates\" element={<TemplatesPage />} />\n <Route path=\"/workflows/nodes\" element={<NodesPage />} />\n <Route path=\"/workflows/settings\" element={<WorkflowSettingsPage />} />\n {/* Dynamic routes — :workflowId catch-all AFTER all static segments */}\n <Route path=\"/workflows/:workflowId\" element={<WorkflowViewPage />} />\n <Route path=\"/workflows/:workflowId/edit\" element={<WorkflowEditBridge />} />\n {/* Support SDK's navigation pattern (without /workflows/ prefix) — also\n resolves record-id → key via WorkflowBuilderResolver. */}\n <Route path=\"/workflow/:id/:version\" element={<WorkflowBuilderResolver />} />\n {/* Redirect /list to /workflows/list (SDK uses relative navigation) */}\n <Route path=\"/list\" element={<Navigate to=\"/bigconsole/workflows/list\" replace />} />\n {/* Pipeline Routes */}\n <Route path=\"/pipelines\" element={<PipelinesPage />} />\n <Route path=\"/pipelines/new\" element={<PipelineBuilderPage />} />\n <Route path=\"/pipelines/:pipelineId\" element={<PipelineViewPage />} />\n <Route path=\"/pipelines/:pipelineId/edit\" element={<PipelineBuilderPage />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,IAAiB,QAAW,OAAO,6BAA0B,EAC7D,IAAoB,QAAW,OAAO,gCAA6B,EACnE,IAAuB,QAAW,OAAO,mCAAgC,EACzE,IAAkB,QAAW,OAAO,8BAA2B,EAC/D,IAAe,QAAW,OAAO,2BAAwB,EACzD,IAAe,QAAW,OAAO,2BAAwB,EACzD,IAAiB,QAAW,OAAO,6BAA0B,EAG7D,IAAgB,QAAW,OAAO,4BAAyB,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,EACvG,IAAmB,QAAW,OAAO,+BAA4B,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,EAEhH,IAAgB,QAAW,OAAO,4BAAyB,EAC3D,IAAmB,QAAW,OAAO,+BAA4B,EACjE,IAAsB,QAAW,OAAO,kCAA+B,EAEvE,IAAkB,QAAW,OAAO,8BAA2B,EAC/D,IAAiB,QAAW,OAAO,6BAA0B,EAC7D,IAAoB,QAAW,OAAO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AAC,GAAD;IAAO,MAAK;IAAa,SAAS,kBAAC,GAAD,EAAiB,CAAA;IAAI,CAAA;GACvD,kBAAC,GAAD;IAAO,MAAK;IAAiB,SAAS,kBAAC,GAAD,EAAuB,CAAA;IAAI,CAAA;GACjE,kBAAC,GAAD;IAAO,MAAK;IAAyB,SAAS,kBAAC,GAAD,EAAoB,CAAA;IAAI,CAAA;GACtE,kBAAC,GAAD;IAAO,MAAK;IAA8B,SAAS,kBAAC,GAAD,EAAuB,CAAA;IAAI,CAAA;GACvE,EAAA,CAAA;EACA,CAAA"}
@@ -2,7 +2,7 @@ import { useAppNavigate as e } from "../../contexts/NavigationContext.js";
2
2
  import "../../contexts/index.js";
3
3
  import t from "../../hooks/useParserOperations.js";
4
4
  import { memo as n, useCallback as r, useEffect as i, useMemo as a } from "react";
5
- import { useParams as o } from "react-router-dom";
5
+ import { useParams as o } from "react-router";
6
6
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  //#region src/bigconsole/components/datasink/LinkedParsersPanel.tsx
8
8
  var l = ({ className: e }) => /* @__PURE__ */ s("svg", {
@@ -1 +1 @@
1
- {"version":3,"file":"LinkedParsersPanel.js","names":[],"sources":["../../../../src/bigconsole/components/datasink/LinkedParsersPanel.tsx"],"sourcesContent":["/**\n * LinkedParsersPanel Component\n *\n * Shows parsers that use this DataSink as their source.\n * Provides navigation to parser view pages.\n */\n\nimport { memo, useMemo, useCallback, useEffect } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAppNavigate } from '../../contexts';\nimport { useParserOperations } from '../../hooks/useParserOperations';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ninterface LinkedParsersPanelProps {\n dataSinkKey?: string;\n}\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst CodeIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={1.5} d=\"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4\" />\n </svg>\n);\n\nconst ArrowRightIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 5l7 7-7 7\" />\n </svg>\n);\n\n// ============================================================================\n// PARSER TYPE BADGE\n// ============================================================================\n\nconst ParserTypeBadge = ({ type }: { type: string }) => {\n const config: Record<string, { label: string; className: string }> = {\n jq: { label: 'JQ', className: 'bg-purple-100 text-purple-700' },\n jsonata: { label: 'JSONata', className: 'bg-blue-100 text-blue-700' },\n };\n\n const { label, className } = config[type] || {\n label: type.toUpperCase(),\n className: 'bg-gray-100 text-gray-700',\n };\n\n return <span className={`px-1.5 py-0.5 text-[10px] font-medium rounded ${className}`}>{label}</span>;\n};\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nconst DEFAULT_CONSOLE_ID = 'default';\n\nexport const LinkedParsersPanel = memo(function LinkedParsersPanel({ dataSinkKey }: LinkedParsersPanelProps) {\n const navigate = useAppNavigate();\n const { consoleId: urlConsoleId } = useParams<{ consoleId?: string }>();\n const consoleId = urlConsoleId || DEFAULT_CONSOLE_ID;\n\n // Operations\n const { parsers, loading: isLoading, fetchParsers } = useParserOperations({ consoleId, skipFetch: true });\n\n // Fetch parsers when dataSinkKey is available (consoleId is optional)\n useEffect(() => {\n if (dataSinkKey) {\n fetchParsers();\n }\n }, [dataSinkKey, fetchParsers]);\n\n // Filter parsers that use this dataSink as input - using useMemo to avoid setState in effect\n const linkedParsers = useMemo(() => {\n if (!dataSinkKey) return [];\n return parsers.filter((p) => p.inputSinkKey === dataSinkKey);\n }, [parsers, dataSinkKey]);\n\n // Handle view parser — navigate to the parser detail page\n const handleViewParser = useCallback(\n (parserId: string) => {\n if (consoleId) {\n navigate(`/dashboards/${consoleId}/parsers/${parserId}`);\n } else {\n navigate(`/parsers/${parserId}`);\n }\n },\n [navigate, consoleId]\n );\n\n // Don't render if no dataSinkKey provided\n if (!dataSinkKey) {\n return null;\n }\n\n return (\n <div className=\"border border-border-default rounded-lg bg-bg-surface p-4 space-y-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <CodeIcon className=\"w-4 h-4 text-text-secondary\" />\n <h2 className=\"text-sm font-semibold text-text-primary\">Parsers Using This DataSink</h2>\n </div>\n <span className=\"text-xs text-text-tertiary\">\n {linkedParsers.length} parser{linkedParsers.length !== 1 ? 's' : ''}\n </span>\n </div>\n\n {isLoading ? (\n <div className=\"flex items-center justify-center py-4\">\n <svg className=\"w-5 h-5 text-text-secondary animate-spin\" fill=\"none\" viewBox=\"0 0 24 24\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n </div>\n ) : linkedParsers.length === 0 ? (\n <p className=\"text-sm text-text-tertiary py-2\">No parsers are using this DataSink as their source.</p>\n ) : (\n <div className=\"space-y-2\">\n {linkedParsers.map((parser) => (\n <button\n key={parser.id}\n type=\"button\"\n onClick={() => handleViewParser(parser.id)}\n className=\"w-full flex items-center justify-between px-3 py-2 bg-bg-sunken rounded-md hover:bg-border-default transition-colors group\"\n >\n <div className=\"flex items-center gap-3\">\n <CodeIcon className=\"w-4 h-4 text-text-secondary\" />\n <div className=\"text-left\">\n <p className=\"text-sm font-medium text-text-primary\">{parser.name}</p>\n <p className=\"text-xs text-text-tertiary font-mono\">{parser.outputKey}</p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <ParserTypeBadge type={parser.type} />\n <ArrowRightIcon className=\"w-4 h-4 text-text-tertiary group-hover:text-text-primary transition-colors\" />\n </div>\n </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DC;EAsDT"}
1
+ {"version":3,"file":"LinkedParsersPanel.js","names":[],"sources":["../../../../src/bigconsole/components/datasink/LinkedParsersPanel.tsx"],"sourcesContent":["/**\n * LinkedParsersPanel Component\n *\n * Shows parsers that use this DataSink as their source.\n * Provides navigation to parser view pages.\n */\n\nimport { memo, useMemo, useCallback, useEffect } from 'react';\nimport { useParams } from 'react-router';\nimport { useAppNavigate } from '../../contexts';\nimport { useParserOperations } from '../../hooks/useParserOperations';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ninterface LinkedParsersPanelProps {\n dataSinkKey?: string;\n}\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst CodeIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={1.5} d=\"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4\" />\n </svg>\n);\n\nconst ArrowRightIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 5l7 7-7 7\" />\n </svg>\n);\n\n// ============================================================================\n// PARSER TYPE BADGE\n// ============================================================================\n\nconst ParserTypeBadge = ({ type }: { type: string }) => {\n const config: Record<string, { label: string; className: string }> = {\n jq: { label: 'JQ', className: 'bg-purple-100 text-purple-700' },\n jsonata: { label: 'JSONata', className: 'bg-blue-100 text-blue-700' },\n };\n\n const { label, className } = config[type] || {\n label: type.toUpperCase(),\n className: 'bg-gray-100 text-gray-700',\n };\n\n return <span className={`px-1.5 py-0.5 text-[10px] font-medium rounded ${className}`}>{label}</span>;\n};\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nconst DEFAULT_CONSOLE_ID = 'default';\n\nexport const LinkedParsersPanel = memo(function LinkedParsersPanel({ dataSinkKey }: LinkedParsersPanelProps) {\n const navigate = useAppNavigate();\n const { consoleId: urlConsoleId } = useParams<{ consoleId?: string }>();\n const consoleId = urlConsoleId || DEFAULT_CONSOLE_ID;\n\n // Operations\n const { parsers, loading: isLoading, fetchParsers } = useParserOperations({ consoleId, skipFetch: true });\n\n // Fetch parsers when dataSinkKey is available (consoleId is optional)\n useEffect(() => {\n if (dataSinkKey) {\n fetchParsers();\n }\n }, [dataSinkKey, fetchParsers]);\n\n // Filter parsers that use this dataSink as input - using useMemo to avoid setState in effect\n const linkedParsers = useMemo(() => {\n if (!dataSinkKey) return [];\n return parsers.filter((p) => p.inputSinkKey === dataSinkKey);\n }, [parsers, dataSinkKey]);\n\n // Handle view parser — navigate to the parser detail page\n const handleViewParser = useCallback(\n (parserId: string) => {\n if (consoleId) {\n navigate(`/dashboards/${consoleId}/parsers/${parserId}`);\n } else {\n navigate(`/parsers/${parserId}`);\n }\n },\n [navigate, consoleId]\n );\n\n // Don't render if no dataSinkKey provided\n if (!dataSinkKey) {\n return null;\n }\n\n return (\n <div className=\"border border-border-default rounded-lg bg-bg-surface p-4 space-y-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <CodeIcon className=\"w-4 h-4 text-text-secondary\" />\n <h2 className=\"text-sm font-semibold text-text-primary\">Parsers Using This DataSink</h2>\n </div>\n <span className=\"text-xs text-text-tertiary\">\n {linkedParsers.length} parser{linkedParsers.length !== 1 ? 's' : ''}\n </span>\n </div>\n\n {isLoading ? (\n <div className=\"flex items-center justify-center py-4\">\n <svg className=\"w-5 h-5 text-text-secondary animate-spin\" fill=\"none\" viewBox=\"0 0 24 24\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n </div>\n ) : linkedParsers.length === 0 ? (\n <p className=\"text-sm text-text-tertiary py-2\">No parsers are using this DataSink as their source.</p>\n ) : (\n <div className=\"space-y-2\">\n {linkedParsers.map((parser) => (\n <button\n key={parser.id}\n type=\"button\"\n onClick={() => handleViewParser(parser.id)}\n className=\"w-full flex items-center justify-between px-3 py-2 bg-bg-sunken rounded-md hover:bg-border-default transition-colors group\"\n >\n <div className=\"flex items-center gap-3\">\n <CodeIcon className=\"w-4 h-4 text-text-secondary\" />\n <div className=\"text-left\">\n <p className=\"text-sm font-medium text-text-primary\">{parser.name}</p>\n <p className=\"text-xs text-text-tertiary font-mono\">{parser.outputKey}</p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <ParserTypeBadge type={parser.type} />\n <ArrowRightIcon className=\"w-4 h-4 text-text-tertiary group-hover:text-text-primary transition-colors\" />\n </div>\n </button>\n ))}\n </div>\n )}\n </div>\n );\n});\n\nexport default LinkedParsersPanel;\n"],"mappings":";;;;;;;AAwBA,IAAM,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAK,GAAE;EAA0C,CAAA;CAC7G,CAAA,EAGF,KAAkB,EAAE,mBACxB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAG,GAAE;EAAiB,CAAA;CAClF,CAAA,EAOF,KAAmB,EAAE,cAA6B;CAMtD,IAAM,EAAE,UAAO,iBALsD;EACnE,IAAI;GAAE,OAAO;GAAM,WAAW;GAAiC;EAC/D,SAAS;GAAE,OAAO;GAAW,WAAW;GAA6B;EACtE,CAEmC,MAAS;EAC3C,OAAO,EAAK,aAAa;EACzB,WAAW;EACZ;AAED,QAAO,kBAAC,QAAD;EAAM,WAA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;GAAK,WAAU;aACZ,EAAc,KAAK,MAClB,kBAAC,UAAD;IAEE,MAAK;IACL,eAAe,EAAiB,EAAO,GAAG;IAC1C,WAAU;cAJZ,CAME,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAAU,WAAU,+BAAgC,CAAA,EACpD,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,KAAD;OAAG,WAAU;iBAAyC,EAAO;OAAS,CAAA,EACtE,kBAAC,KAAD;OAAG,WAAU;iBAAwC,EAAO;OAAc,CAAA,CACtE;QACF;QACN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAAiB,MAAM,EAAO,MAAQ,CAAA,EACtC,kBAAC,GAAD,EAAgB,WAAU,8EAA+E,CAAA,CACrG;OACC;MAhBF,EAAO,GAgBL,CACT;GACE,CAAA,CAEJ;MApDC;EAsDT"}
@@ -1,12 +1,18 @@
1
1
  import { asArray as e, asRecord as t, asString as n, formatCell as r, isNumeric as i } from "./shared.js";
2
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import { resolveCellLinkHref as a } from "../../widgets/table/cellLink.js";
3
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
3
4
  //#region src/bigconsole/components/embed/widgets/TableEmbed.tsx
4
- var s = 500;
5
- function c(i, a) {
6
- let o = e(i.columns).map((e) => t(e)).map((e) => ({
7
- key: n(e.key),
8
- label: n(e.label ?? e.key)
9
- })).filter((e) => e.key.length > 0);
5
+ var c = 500;
6
+ function l(i, a) {
7
+ let o = e(i.columns).map((e) => t(e)).map((e) => {
8
+ let t = n(e.key) || n(e.field);
9
+ return {
10
+ key: t,
11
+ label: n(e.label ?? e.header ?? t),
12
+ format: n(e.format) || void 0,
13
+ linkPattern: n(e.linkPattern) || void 0
14
+ };
15
+ }).filter((e) => e.key.length > 0);
10
16
  if (o.length > 0) return o;
11
17
  let s = /* @__PURE__ */ new Set(), c = [];
12
18
  for (let e of a) for (let t of Object.keys(e)) s.has(t) || (s.add(t), c.push(t));
@@ -15,38 +21,48 @@ function c(i, a) {
15
21
  label: e
16
22
  }));
17
23
  }
18
- function l({ widget: n }) {
19
- let l = t(n.config), u = e(t(n.data).rows).map((e) => t(e)).slice(0, s), d = c(l, u);
20
- if (d.length === 0 || u.length === 0) return /* @__PURE__ */ a("div", {
24
+ function u({ widget: n }) {
25
+ let u = t(n.config), d = e(t(n.data).rows).map((e) => t(e)).slice(0, c), f = l(u, d);
26
+ if (f.length === 0 || d.length === 0) return /* @__PURE__ */ o("div", {
21
27
  className: "flex h-full items-center justify-center bg-bg-surface p-4 text-sm text-text-secondary",
22
28
  children: "No data"
23
29
  });
24
- let f = new Set(d.filter((e) => {
25
- let t = u.map((t) => t[e.key]).filter((e) => e != null && e !== "");
30
+ let p = new Set(f.filter((e) => {
31
+ let t = d.map((t) => t[e.key]).filter((e) => e != null && e !== "");
26
32
  return t.length > 0 && t.every(i);
27
33
  }).map((e) => e.key));
28
- return /* @__PURE__ */ o("div", {
34
+ return /* @__PURE__ */ s("div", {
29
35
  className: "h-full w-full overflow-auto bg-bg-surface",
30
- children: [n.title && /* @__PURE__ */ a("div", {
36
+ children: [n.title && /* @__PURE__ */ o("div", {
31
37
  className: "border-b border-border-subtle bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary",
32
38
  children: n.title
33
- }), /* @__PURE__ */ o("table", {
39
+ }), /* @__PURE__ */ s("table", {
34
40
  className: "w-full border-collapse text-sm",
35
- children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: d.map((e) => /* @__PURE__ */ a("th", {
41
+ children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: f.map((e) => /* @__PURE__ */ o("th", {
36
42
  scope: "col",
37
- className: `sticky top-0 z-10 border-b border-border-default bg-bg-sunken px-3 py-2 font-medium text-text-secondary ${f.has(e.key) ? "text-right tabular-nums" : "text-left"}`,
43
+ className: `sticky top-0 z-10 border-b border-border-default bg-bg-sunken px-3 py-2 font-medium text-text-secondary ${p.has(e.key) ? "text-right tabular-nums" : "text-left"}`,
38
44
  children: e.label
39
- }, e.key)) }) }), /* @__PURE__ */ a("tbody", { children: u.map((e, t) => /* @__PURE__ */ a("tr", {
45
+ }, e.key)) }) }), /* @__PURE__ */ o("tbody", { children: d.map((e, t) => /* @__PURE__ */ o("tr", {
40
46
  className: "hover:bg-bg-sunken/50",
41
- children: d.map((t) => /* @__PURE__ */ a("td", {
42
- className: `border-b border-border-subtle px-3 py-2 text-text-primary ${f.has(t.key) ? "text-right tabular-nums" : "text-left"}`,
43
- children: r(e[t.key])
44
- }, t.key))
47
+ children: f.map((t) => {
48
+ let n = t.format === "link" ? a(t.linkPattern, e[t.key], e) : null;
49
+ return /* @__PURE__ */ o("td", {
50
+ className: `border-b border-border-subtle px-3 py-2 text-text-primary ${p.has(t.key) ? "text-right tabular-nums" : "text-left"}`,
51
+ children: n ? /* @__PURE__ */ o("a", {
52
+ href: n,
53
+ target: "_blank",
54
+ rel: "noopener noreferrer",
55
+ title: n,
56
+ className: "text-action-primary-bg hover:underline",
57
+ children: r(e[t.key])
58
+ }) : r(e[t.key])
59
+ }, t.key);
60
+ })
45
61
  }, t)) })]
46
62
  })]
47
63
  });
48
64
  }
49
65
  //#endregion
50
- export { l as TableEmbed };
66
+ export { u as TableEmbed };
51
67
 
52
68
  //# sourceMappingURL=TableEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableEmbed.js","names":[],"sources":["../../../../../src/bigconsole/components/embed/widgets/TableEmbed.tsx"],"sourcesContent":["/** Read-only table embed renderer (BOFF-2986 / BOFF-5733). */\nimport type { EmbedWidgetRenderProps } from '../types';\nimport { asRecord, asArray, asString, formatCell, isNumeric } from './shared';\n\ninterface Column {\n key: string;\n label: string;\n}\n\n/** Hard client-side cap; the publication builder is expected to page/limit rows. */\nconst MAX_ROWS = 500;\n\nfunction readColumns(config: Record<string, unknown>, rows: Record<string, unknown>[]): Column[] {\n const configured = asArray(config.columns)\n .map((c) => asRecord(c))\n .map((c) => ({ key: asString(c.key), label: asString(c.label ?? c.key) }))\n .filter((c) => c.key.length > 0);\n // A publisher that pinned columns chose exactly what to show — respect it.\n if (configured.length > 0) return configured;\n\n // Derive from the data when the publication didn't pin columns. Union the keys\n // across all rows (rows can be sparse), then drop noise so an embed never shows\n // a raw internal dump: `_`-prefixed technical keys and columns that are empty\n // in every row (the \"empty metadata/badge column\" gap from BOFF-5733).\n const seen = new Set<string>();\n const keys: string[] = [];\n for (const row of rows) {\n for (const key of Object.keys(row)) {\n if (!seen.has(key)) {\n seen.add(key);\n keys.push(key);\n }\n }\n }\n return keys\n .filter((key) => !key.startsWith('_'))\n .filter((key) => rows.some((row) => formatCell(row[key]) !== ''))\n .map((key) => ({ key, label: key }));\n}\n\nexport function TableEmbed({ widget }: EmbedWidgetRenderProps) {\n const config = asRecord(widget.config);\n const data = asRecord(widget.data);\n const rows = asArray(data.rows)\n .map((r) => asRecord(r))\n .slice(0, MAX_ROWS);\n const columns = readColumns(config, rows);\n\n if (columns.length === 0 || rows.length === 0) {\n return (\n <div className=\"flex h-full items-center justify-center bg-bg-surface p-4 text-sm text-text-secondary\">\n No data\n </div>\n );\n }\n\n // Right-align a column when its populated cells are all numeric (matches the\n // in-app TableCell), so currency/counts line up on the decimal edge.\n const numericColumns = new Set(\n columns\n .filter((col) => {\n const values = rows.map((r) => r[col.key]).filter((v) => v !== null && v !== undefined && v !== '');\n return values.length > 0 && values.every(isNumeric);\n })\n .map((col) => col.key)\n );\n\n return (\n <div className=\"h-full w-full overflow-auto bg-bg-surface\">\n {widget.title && (\n <div className=\"border-b border-border-subtle bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary\">\n {widget.title}\n </div>\n )}\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr>\n {columns.map((col) => (\n // `sticky` lives on the cells (not the title, which scrolls away)\n // so column headers stay visible while scrolling the 500-row cap.\n // Cells carry their own opaque background so rows don't show through.\n <th\n key={col.key}\n scope=\"col\"\n className={`sticky top-0 z-10 border-b border-border-default bg-bg-sunken px-3 py-2 font-medium text-text-secondary ${\n numericColumns.has(col.key) ? 'text-right tabular-nums' : 'text-left'\n }`}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr key={i} className=\"hover:bg-bg-sunken/50\">\n {columns.map((col) => (\n <td\n key={col.key}\n className={`border-b border-border-subtle px-3 py-2 text-text-primary ${\n numericColumns.has(col.key) ? 'text-right tabular-nums' : 'text-left'\n }`}\n >\n {formatCell(row[col.key])}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"],"mappings":";;;AAUA,IAAM,IAAW;AAEjB,SAAS,EAAY,GAAiC,GAA2C;CAC/F,IAAM,IAAa,EAAQ,EAAO,QAAQ,CACvC,KAAK,MAAM,EAAS,EAAE,CAAC,CACvB,KAAK,OAAO;EAAE,KAAK,EAAS,EAAE,IAAI;EAAE,OAAO,EAAS,EAAE,SAAS,EAAE,IAAI;EAAE,EAAE,CACzE,QAAQ,MAAM,EAAE,IAAI,SAAS,EAAE;AAElC,KAAI,EAAW,SAAS,EAAG,QAAO;CAMlC,IAAM,oBAAO,IAAI,KAAa,EACxB,IAAiB,EAAE;AACzB,MAAK,IAAM,KAAO,EAChB,MAAK,IAAM,KAAO,OAAO,KAAK,EAAI,CAChC,CAAK,EAAK,IAAI,EAAI,KAChB,EAAK,IAAI,EAAI,EACb,EAAK,KAAK,EAAI;AAIpB,QAAO,EACJ,QAAQ,MAAQ,CAAC,EAAI,WAAW,IAAI,CAAC,CACrC,QAAQ,MAAQ,EAAK,MAAM,MAAQ,EAAW,EAAI,GAAK,KAAK,GAAG,CAAC,CAChE,KAAK,OAAS;EAAE;EAAK,OAAO;EAAK,EAAE;;AAGxC,SAAgB,EAAW,EAAE,aAAkC;CAC7D,IAAM,IAAS,EAAS,EAAO,OAAO,EAEhC,IAAO,EADA,EAAS,EAAO,KAAK,CACR,KAAK,CAC5B,KAAK,MAAM,EAAS,EAAE,CAAC,CACvB,MAAM,GAAG,EAAS,EACf,IAAU,EAAY,GAAQ,EAAK;AAEzC,KAAI,EAAQ,WAAW,KAAK,EAAK,WAAW,EAC1C,QACE,kBAAC,OAAD;EAAK,WAAU;YAAwF;EAEjG,CAAA;CAMV,IAAM,IAAiB,IAAI,IACzB,EACG,QAAQ,MAAQ;EACf,IAAM,IAAS,EAAK,KAAK,MAAM,EAAE,EAAI,KAAK,CAAC,QAAQ,MAAM,KAAM,QAA2B,MAAM,GAAG;AACnG,SAAO,EAAO,SAAS,KAAK,EAAO,MAAM,EAAU;GACnD,CACD,KAAK,MAAQ,EAAI,IAAI,CACzB;AAED,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACG,EAAO,SACN,kBAAC,OAAD;GAAK,WAAU;aACZ,EAAO;GACJ,CAAA,EAER,kBAAC,SAAD;GAAO,WAAU;aAAjB,CACE,kBAAC,SAAD,EAAA,UACE,kBAAC,MAAD,EAAA,UACG,EAAQ,KAAK,MAIZ,kBAAC,MAAD;IAEE,OAAM;IACN,WAAW,2GACT,EAAe,IAAI,EAAI,IAAI,GAAG,4BAA4B;cAG3D,EAAI;IACF,EAPE,EAAI,IAON,CACL,EACC,CAAA,EACC,CAAA,EACR,kBAAC,SAAD,EAAA,UACG,EAAK,KAAK,GAAK,MACd,kBAAC,MAAD;IAAY,WAAU;cACnB,EAAQ,KAAK,MACZ,kBAAC,MAAD;KAEE,WAAW,6DACT,EAAe,IAAI,EAAI,IAAI,GAAG,4BAA4B;eAG3D,EAAW,EAAI,EAAI,KAAK;KACtB,EANE,EAAI,IAMN,CACL;IACC,EAXI,EAWJ,CACL,EACI,CAAA,CACF;KACJ"}
1
+ {"version":3,"file":"TableEmbed.js","names":[],"sources":["../../../../../src/bigconsole/components/embed/widgets/TableEmbed.tsx"],"sourcesContent":["/** Read-only table embed renderer (BOFF-2986 / BOFF-5733). */\nimport type { EmbedWidgetRenderProps } from '../types';\nimport { asRecord, asArray, asString, formatCell, isNumeric } from './shared';\nimport { resolveCellLinkHref } from '../../widgets/table/cellLink';\n\ninterface Column {\n key: string;\n label: string;\n /** When 'link', the cell renders a navigable anchor (see cellLink). */\n format?: string;\n /** URL template for a `link` column; `{value}`/`{field}` tokens. */\n linkPattern?: string;\n}\n\n/** Hard client-side cap; the publication builder is expected to page/limit rows. */\nconst MAX_ROWS = 500;\n\nfunction readColumns(config: Record<string, unknown>, rows: Record<string, unknown>[]): Column[] {\n const configured = asArray(config.columns)\n .map((c) => asRecord(c))\n .map((c) => {\n // Mirror the live table's key/label fallbacks: a column may use `field`\n // instead of `key` and `header` instead of `label` (config-UI alias).\n const key = asString(c.key) || asString(c.field);\n return {\n key,\n label: asString(c.label ?? c.header ?? key),\n format: asString(c.format) || undefined,\n linkPattern: asString(c.linkPattern) || undefined,\n };\n })\n .filter((c) => c.key.length > 0);\n // A publisher that pinned columns chose exactly what to show — respect it.\n if (configured.length > 0) return configured;\n\n // Derive from the data when the publication didn't pin columns. Union the keys\n // across all rows (rows can be sparse), then drop noise so an embed never shows\n // a raw internal dump: `_`-prefixed technical keys and columns that are empty\n // in every row (the \"empty metadata/badge column\" gap from BOFF-5733).\n const seen = new Set<string>();\n const keys: string[] = [];\n for (const row of rows) {\n for (const key of Object.keys(row)) {\n if (!seen.has(key)) {\n seen.add(key);\n keys.push(key);\n }\n }\n }\n return keys\n .filter((key) => !key.startsWith('_'))\n .filter((key) => rows.some((row) => formatCell(row[key]) !== ''))\n .map((key) => ({ key, label: key }));\n}\n\nexport function TableEmbed({ widget }: EmbedWidgetRenderProps) {\n const config = asRecord(widget.config);\n const data = asRecord(widget.data);\n const rows = asArray(data.rows)\n .map((r) => asRecord(r))\n .slice(0, MAX_ROWS);\n const columns = readColumns(config, rows);\n\n if (columns.length === 0 || rows.length === 0) {\n return (\n <div className=\"flex h-full items-center justify-center bg-bg-surface p-4 text-sm text-text-secondary\">\n No data\n </div>\n );\n }\n\n // Right-align a column when its populated cells are all numeric (matches the\n // in-app TableCell), so currency/counts line up on the decimal edge.\n const numericColumns = new Set(\n columns\n .filter((col) => {\n const values = rows.map((r) => r[col.key]).filter((v) => v !== null && v !== undefined && v !== '');\n return values.length > 0 && values.every(isNumeric);\n })\n .map((col) => col.key)\n );\n\n return (\n <div className=\"h-full w-full overflow-auto bg-bg-surface\">\n {widget.title && (\n <div className=\"border-b border-border-subtle bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary\">\n {widget.title}\n </div>\n )}\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr>\n {columns.map((col) => (\n // `sticky` lives on the cells (not the title, which scrolls away)\n // so column headers stay visible while scrolling the 500-row cap.\n // Cells carry their own opaque background so rows don't show through.\n <th\n key={col.key}\n scope=\"col\"\n className={`sticky top-0 z-10 border-b border-border-default bg-bg-sunken px-3 py-2 font-medium text-text-secondary ${\n numericColumns.has(col.key) ? 'text-right tabular-nums' : 'text-left'\n }`}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr key={i} className=\"hover:bg-bg-sunken/50\">\n {columns.map((col) => {\n // Mirror the in-app TableCell: only `link` columns navigate.\n const href = col.format === 'link' ? resolveCellLinkHref(col.linkPattern, row[col.key], row) : null;\n return (\n <td\n key={col.key}\n className={`border-b border-border-subtle px-3 py-2 text-text-primary ${\n numericColumns.has(col.key) ? 'text-right tabular-nums' : 'text-left'\n }`}\n >\n {href ? (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={href}\n className=\"text-action-primary-bg hover:underline\"\n >\n {formatCell(row[col.key])}\n </a>\n ) : (\n formatCell(row[col.key])\n )}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"],"mappings":";;;;AAeA,IAAM,IAAW;AAEjB,SAAS,EAAY,GAAiC,GAA2C;CAC/F,IAAM,IAAa,EAAQ,EAAO,QAAQ,CACvC,KAAK,MAAM,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