@burdenoff/microfe-bigconsole 2026.728.1 → 2026.729.2

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 (111) hide show
  1. package/dist/bigconsole/components/DrilldownDashboardRenderer.js +1 -1
  2. package/dist/bigconsole/components/DrilldownDashboardRenderer.js.map +1 -1
  3. package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +4 -4
  4. package/dist/bigconsole/components/builder/inspector/DataBindingSection.js.map +1 -1
  5. package/dist/bigconsole/components/datasink/CacheTTLSelector.js +5 -5
  6. package/dist/bigconsole/components/datasink/CacheTTLSelector.js.map +1 -1
  7. package/dist/bigconsole/components/datasink/DataSinkCard.js +3 -3
  8. package/dist/bigconsole/components/datasink/DataSinkCard.js.map +1 -1
  9. package/dist/bigconsole/components/datasink/DataSinkDeleteDialog.js +4 -4
  10. package/dist/bigconsole/components/datasink/DataSinkDeleteDialog.js.map +1 -1
  11. package/dist/bigconsole/components/datasink/DataSinkStatusBadge.js +6 -6
  12. package/dist/bigconsole/components/datasink/DataSinkStatusBadge.js.map +1 -1
  13. package/dist/bigconsole/components/datasink/LinkedWorkflowsPanel.js +9 -9
  14. package/dist/bigconsole/components/datasink/LinkedWorkflowsPanel.js.map +1 -1
  15. package/dist/bigconsole/components/datasink/RefreshTypeSelector.js +2 -2
  16. package/dist/bigconsole/components/datasink/RefreshTypeSelector.js.map +1 -1
  17. package/dist/bigconsole/components/datasink/SetupStateBadge.js +8 -8
  18. package/dist/bigconsole/components/datasink/SetupStateBadge.js.map +1 -1
  19. package/dist/bigconsole/components/datasink/WorkflowStatusPanel.js +13 -13
  20. package/dist/bigconsole/components/datasink/WorkflowStatusPanel.js.map +1 -1
  21. package/dist/bigconsole/components/parser/DataSinkSelector.js +2 -2
  22. package/dist/bigconsole/components/parser/DataSinkSelector.js.map +1 -1
  23. package/dist/bigconsole/components/parser/ExpressionEditor.js +1 -1
  24. package/dist/bigconsole/components/parser/ExpressionEditor.js.map +1 -1
  25. package/dist/bigconsole/components/parser/ParserCard.js +1 -1
  26. package/dist/bigconsole/components/parser/ParserCard.js.map +1 -1
  27. package/dist/bigconsole/components/parser/ParserSelector.js +2 -2
  28. package/dist/bigconsole/components/parser/ParserSelector.js.map +1 -1
  29. package/dist/bigconsole/components/parser/ParserStatusBadge.js +2 -2
  30. package/dist/bigconsole/components/parser/ParserStatusBadge.js.map +1 -1
  31. package/dist/bigconsole/components/pipeline/PipelineCard.js +2 -2
  32. package/dist/bigconsole/components/pipeline/PipelineCard.js.map +1 -1
  33. package/dist/bigconsole/components/pipeline/PipelineDeleteDialog.js +5 -5
  34. package/dist/bigconsole/components/pipeline/PipelineDeleteDialog.js.map +1 -1
  35. package/dist/bigconsole/components/pipeline/PipelineStatusBadge.js +3 -3
  36. package/dist/bigconsole/components/pipeline/PipelineStatusBadge.js.map +1 -1
  37. package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js +1 -1
  38. package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js.map +1 -1
  39. package/dist/bigconsole/components/widgets/PropertiesPanel.js +3 -3
  40. package/dist/bigconsole/components/widgets/PropertiesPanel.js.map +1 -1
  41. package/dist/bigconsole/components/widgets/WidgetErrorBoundary.js +2 -2
  42. package/dist/bigconsole/components/widgets/WidgetErrorBoundary.js.map +1 -1
  43. package/dist/bigconsole/components/widgets/WidgetMenu.js +1 -1
  44. package/dist/bigconsole/components/widgets/WidgetMenu.js.map +1 -1
  45. package/dist/bigconsole/components/widgets/adaptive-card/AdaptiveCardWidget.js +3 -3
  46. package/dist/bigconsole/components/widgets/adaptive-card/AdaptiveCardWidget.js.map +1 -1
  47. package/dist/bigconsole/components/widgets/calendar/CalendarWidget.js +1 -1
  48. package/dist/bigconsole/components/widgets/calendar/CalendarWidget.js.map +1 -1
  49. package/dist/bigconsole/components/widgets/gauge/GaugeConfig.js +3 -3
  50. package/dist/bigconsole/components/widgets/gauge/GaugeConfig.js.map +1 -1
  51. package/dist/bigconsole/components/widgets/heatmap/HeatmapWidget.js +52 -32
  52. package/dist/bigconsole/components/widgets/heatmap/HeatmapWidget.js.map +1 -1
  53. package/dist/bigconsole/components/widgets/kanban/KanbanWidget.js +3 -3
  54. package/dist/bigconsole/components/widgets/kanban/KanbanWidget.js.map +1 -1
  55. package/dist/bigconsole/components/widgets/kpi/KPIWidget.js +1 -1
  56. package/dist/bigconsole/components/widgets/kpi/KPIWidget.js.map +1 -1
  57. package/dist/bigconsole/components/widgets/kpi-comparison/KPIComparisonWidget.js +2 -2
  58. package/dist/bigconsole/components/widgets/kpi-comparison/KPIComparisonWidget.js.map +1 -1
  59. package/dist/bigconsole/components/widgets/list/ListItem.js +3 -3
  60. package/dist/bigconsole/components/widgets/list/ListItem.js.map +1 -1
  61. package/dist/bigconsole/components/widgets/metric-card/ComparisonBadge.js +1 -1
  62. package/dist/bigconsole/components/widgets/metric-card/ComparisonBadge.js.map +1 -1
  63. package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +1 -1
  64. package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js.map +1 -1
  65. package/dist/bigconsole/components/widgets/metric-card/SparklineChart.js +6 -6
  66. package/dist/bigconsole/components/widgets/metric-card/SparklineChart.js.map +1 -1
  67. package/dist/bigconsole/components/widgets/metric-card/TrendIndicator.js +1 -1
  68. package/dist/bigconsole/components/widgets/metric-card/TrendIndicator.js.map +1 -1
  69. package/dist/bigconsole/components/widgets/pivot-table/PivotTableWidget.js +2 -2
  70. package/dist/bigconsole/components/widgets/pivot-table/PivotTableWidget.js.map +1 -1
  71. package/dist/bigconsole/components/widgets/progress/ProgressBar.js +4 -4
  72. package/dist/bigconsole/components/widgets/progress/ProgressBar.js.map +1 -1
  73. package/dist/bigconsole/components/widgets/progress/ProgressConfig.js +1 -1
  74. package/dist/bigconsole/components/widgets/progress/ProgressConfig.js.map +1 -1
  75. package/dist/bigconsole/components/widgets/progress/ProgressWidget.js +1 -1
  76. package/dist/bigconsole/components/widgets/progress/ProgressWidget.js.map +1 -1
  77. package/dist/bigconsole/components/widgets/retention/RetentionWidget.js +2 -2
  78. package/dist/bigconsole/components/widgets/retention/RetentionWidget.js.map +1 -1
  79. package/dist/bigconsole/components/widgets/states/ErrorState.js +2 -2
  80. package/dist/bigconsole/components/widgets/states/ErrorState.js.map +1 -1
  81. package/dist/bigconsole/components/widgets/table/TableConfig.js +2 -2
  82. package/dist/bigconsole/components/widgets/table/TableConfig.js.map +1 -1
  83. package/dist/bigconsole/components/widgets/timeline/TimelineWidget.js +1 -1
  84. package/dist/bigconsole/components/widgets/timeline/TimelineWidget.js.map +1 -1
  85. package/dist/bigconsole/components/widgets/widget-actions/WidgetActions.js +6 -6
  86. package/dist/bigconsole/components/widgets/widget-actions/WidgetActions.js.map +1 -1
  87. package/dist/bigconsole/components/workflow/WorkflowCard.js +1 -1
  88. package/dist/bigconsole/components/workflow/WorkflowCard.js.map +1 -1
  89. package/dist/bigconsole/components/workflow/WorkflowDeleteDialog.js +5 -5
  90. package/dist/bigconsole/components/workflow/WorkflowDeleteDialog.js.map +1 -1
  91. package/dist/bigconsole/components/workflow/WorkflowStatusBadge.js +6 -6
  92. package/dist/bigconsole/components/workflow/WorkflowStatusBadge.js.map +1 -1
  93. package/dist/bigconsole/pages/DataSinkBuilderPage.js +17 -17
  94. package/dist/bigconsole/pages/DataSinkBuilderPage.js.map +1 -1
  95. package/dist/bigconsole/pages/DataSinkViewPage.js +2 -2
  96. package/dist/bigconsole/pages/DataSinkViewPage.js.map +1 -1
  97. package/dist/bigconsole/pages/ParserBuilderPage.js +24 -24
  98. package/dist/bigconsole/pages/ParserBuilderPage.js.map +1 -1
  99. package/dist/bigconsole/pages/ParserViewPage.js +8 -8
  100. package/dist/bigconsole/pages/ParserViewPage.js.map +1 -1
  101. package/dist/bigconsole/pages/PipelineBuilderPage.js +9 -9
  102. package/dist/bigconsole/pages/PipelineBuilderPage.js.map +1 -1
  103. package/dist/bigconsole/pages/PipelineViewPage.js +12 -12
  104. package/dist/bigconsole/pages/PipelineViewPage.js.map +1 -1
  105. package/dist/bigconsole/pages/WorkflowViewPage.js +6 -6
  106. package/dist/bigconsole/pages/WorkflowViewPage.js.map +1 -1
  107. package/dist/bigconsole/renderers/adapters/AdaptiveCardRenderer.js +1 -1
  108. package/dist/bigconsole/renderers/adapters/AdaptiveCardRenderer.js.map +1 -1
  109. package/dist/bigconsole/renderers/adapters/BlockKitRenderer.js +2 -2
  110. package/dist/bigconsole/renderers/adapters/BlockKitRenderer.js.map +1 -1
  111. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PipelineViewPage.js","names":[],"sources":["../../../src/bigconsole/pages/PipelineViewPage.tsx"],"sourcesContent":["/**\n * Pipeline View Page\n *\n * Display Pipeline details, stages, and execution history.\n * Supports testing pipeline with sample input.\n */\n\nimport { memo, useState, useCallback, useEffect } from 'react';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { GlassCard, IllustratedEmptyState, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeNotify } from '../../utils/nativeBridge';\nimport { usePipelineOperations } from '../hooks/usePipelineOperations';\nimport { usePipelineStore } from '../store/pipelineStore';\nimport { PipelineStatusBadge } from '../components/pipeline/PipelineStatusBadge';\nimport { PipelineDeleteDialog } from '../components/pipeline/PipelineDeleteDialog';\nimport type { Pipeline, PipelineExecution, PipelineStage } from '../types';\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst BackIcon = ({ 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=\"M10 19l-7-7m0 0l7-7m-7 7h18\" />\n </svg>\n);\n\nconst EditIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n);\n\nconst DeleteIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n);\n\nconst PlayIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z\"\n />\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n);\n\nconst ErrorIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n);\n\nconst CheckIcon = ({ 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=\"M5 13l4 4L19 7\" />\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=\"M14 5l7 7m0 0l-7 7m7-7H3\" />\n </svg>\n);\n\n// ============================================================================\n// STAGE ERROR BADGE\n// ============================================================================\n\nconst StageErrorBadge = ({ handling }: { handling: string }) => {\n const config = {\n fail: { label: 'Fail', className: 'bg-state-error/10 text-state-error' },\n skip: { label: 'Skip', className: 'bg-state-warning/10 text-state-warning' },\n fallback: { label: 'Fallback', className: 'bg-action-primary-bg/10 text-action-primary-bg' },\n };\n const c = config[handling as keyof typeof config] || config.fail;\n return <span className={`px-1.5 py-0.5 text-xs font-medium rounded ${c.className}`}>{c.label}</span>;\n};\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const PipelineViewPage = memo(function PipelineViewPage() {\n const { pipelineId } = useParams<{ pipelineId: string }>();\n const navigate = useAppNavigate();\n // Use default consoleId for now (should come from context in production)\n const consoleId = 'default';\n const [searchParams] = useSearchParams();\n\n // Local state\n const [pipeline, setPipeline] = useState<Pipeline | null>(null);\n const [testInput, setTestInput] = useState('{\\n \"data\": \"sample\"\\n}');\n const [testResult, setTestResult] = useState<PipelineExecution | null>(null);\n const [showTestPanel, setShowTestPanel] = useState(searchParams.get('test') === 'true');\n\n // Store state\n const deleteDialogOpen = usePipelineStore((state) => state.deleteDialogOpen);\n const openDeleteDialog = usePipelineStore((state) => state.openDeleteDialog);\n const closeDeleteDialog = usePipelineStore((state) => state.closeDeleteDialog);\n\n // Operations\n const { loading, error, fetchPipeline, deletePipeline, testPipeline } = usePipelineOperations({\n consoleId,\n skipFetch: true,\n });\n\n // Fetch pipeline on mount\n useEffect(() => {\n if (pipelineId) {\n fetchPipeline(pipelineId).then((result) => {\n if (result) {\n setPipeline(result);\n }\n });\n }\n }, [pipelineId, fetchPipeline]);\n\n // Handlers\n const handleBack = useCallback(() => {\n navigate(`/pipelines`);\n }, [navigate]);\n\n const handleEdit = useCallback(() => {\n navigate(`/pipelines/${pipelineId}/edit`);\n }, [navigate, pipelineId]);\n\n const handleDeleteClick = useCallback(() => {\n if (pipeline) {\n openDeleteDialog(pipeline);\n }\n }, [pipeline, openDeleteDialog]);\n\n const handleDeleteConfirm = useCallback(async () => {\n if (pipeline) {\n const success = await deletePipeline(pipeline.id);\n if (success) {\n if (isNative()) void nativeNotify('success');\n closeDeleteDialog();\n navigate(`/pipelines`);\n } else if (isNative()) {\n void nativeNotify('error');\n }\n }\n }, [pipeline, deletePipeline, closeDeleteDialog, navigate]);\n\n const handleViewParser = useCallback(\n (parserId: string) => {\n navigate(`/dashboards/${consoleId}/parsers/${parserId}`);\n },\n [navigate, consoleId]\n );\n\n const handleTest = useCallback(async () => {\n if (!pipeline) return;\n\n try {\n const result = await testPipeline({\n pipelineId: pipeline.id,\n inputData: testInput,\n });\n if (result) {\n setTestResult(result);\n }\n } catch (err) {}\n }, [pipeline, testPipeline, testInput]);\n\n // Loading state\n if (loading && !pipeline) {\n return (\n <div className=\"p-6\">\n <div className=\"flex flex-col items-center justify-center py-16\">\n <svg className=\"w-8 h-8 text-action-primary-bg animate-spin mb-4\" 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 <p className=\"text-sm text-text-secondary\">Loading Pipeline...</p>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"p-6\">\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-3 rounded-full bg-state-error/10 mb-4\">\n <ErrorIcon className=\"w-8 h-8 text-state-error\" />\n </div>\n <h3 className=\"text-lg font-medium text-text-primary mb-2\">Failed to load Pipeline</h3>\n <p className=\"text-sm text-text-secondary mb-4\">{error.message}</p>\n <button\n type=\"button\"\n onClick={handleBack}\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 Back to Pipelines\n </button>\n </div>\n </div>\n );\n }\n\n // Not found state\n if (!pipeline) {\n return (\n <div className=\"p-6\">\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"Pipeline not found\"\n description=\"The pipeline you're looking for doesn't exist or has been deleted.\"\n action={\n <button\n type=\"button\"\n onClick={handleBack}\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 Back to Pipelines\n </button>\n }\n />\n </div>\n );\n }\n\n return (\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-md transition-colors\"\n >\n <BackIcon className=\"w-5 h-5\" />\n </button>\n <div>\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl font-bold text-text-primary\">{pipeline.name}</h1>\n <PipelineStatusBadge status={pipeline.status} />\n </div>\n {pipeline.description && <p className=\"text-sm text-text-secondary mt-1\">{pipeline.description}</p>}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowTestPanel(!showTestPanel)}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-state-success bg-state-success/10 hover:bg-state-success/20 rounded-md transition-colors\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n Test\n </button>\n <button\n type=\"button\"\n onClick={handleEdit}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n <EditIcon className=\"w-4 h-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={handleDeleteClick}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-state-error bg-state-error/10 hover:bg-state-error/20 rounded-md transition-colors\"\n >\n <DeleteIcon className=\"w-4 h-4\" />\n Delete\n </button>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6\">\n A pipeline chains parsers and a data sink into a repeatable flow. Review its stages here, test it with sample\n input to confirm the output, then edit the stages or run it to process real data into the connected sink.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"bigconsole-pipeline-view\"\n steps={[\n {\n id: 'test',\n label: 'Test with sample input',\n description: 'Run the pipeline against a sample to verify each stage.',\n onClick: () => setShowTestPanel(true),\n },\n {\n id: 'edit',\n label: 'Edit the stages',\n description: 'Add, reorder, or configure the parsers in this pipeline.',\n onClick: handleEdit,\n },\n {\n id: 'sinks',\n label: 'Review the target data sink',\n description: 'See where the processed data lands.',\n onClick: () => navigate('/datasinks'),\n },\n ]}\n />\n\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6\">\n {/* Main Content */}\n <div className=\"lg:col-span-2 space-y-6\">\n {/* Stages — primary emphasis zone */}\n <GlassCard treatment=\"glass\" glow className=\"p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">\n Pipeline Stages ({pipeline.stages?.length || 0})\n </h2>\n\n {!pipeline.stages || pipeline.stages.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No stages defined\"\n description=\"Edit the pipeline to add parser stages.\"\n />\n ) : (\n <div className=\"space-y-3\">\n {pipeline.stages.map((stage: PipelineStage, index: number) => (\n <div key={stage.id} className=\"flex items-center gap-3\">\n {/* Stage Card */}\n <div\n className={`\n flex-1 p-4 rounded-lg border\n ${stage.enabled ? 'bg-bg-surface border-border-default' : 'bg-bg-sunken border-border-default opacity-60'}\n `}\n >\n <div className=\"flex items-center justify-between mb-2\">\n <div className=\"flex items-center gap-2\">\n <span className=\"w-6 h-6 flex items-center justify-center text-xs font-medium bg-action-primary-bg/10 text-action-primary-bg rounded-full\">\n {index + 1}\n </span>\n <span className=\"font-medium text-text-primary\">\n {stage.parserName || `Stage ${index + 1}`}\n </span>\n {stage.parserType && (\n <span className=\"px-1.5 py-0.5 text-xs font-medium bg-bg-sunken text-text-secondary rounded\">\n {stage.parserType.toUpperCase()}\n </span>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <StageErrorBadge handling={stage.onError} />\n {!stage.enabled && (\n <span className=\"px-1.5 py-0.5 text-xs font-medium bg-bg-sunken text-text-secondary rounded\">\n Disabled\n </span>\n )}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2 text-xs text-text-secondary\">\n <span className=\"font-mono bg-bg-sunken px-1.5 py-0.5 rounded\">{stage.inputKey}</span>\n <ArrowRightIcon className=\"w-3 h-3\" />\n <span className=\"font-mono bg-bg-sunken px-1.5 py-0.5 rounded\">{stage.outputKey}</span>\n </div>\n\n {stage.description && <p className=\"text-xs text-text-secondary mt-2\">{stage.description}</p>}\n\n {stage.parserId && (\n <button\n type=\"button\"\n onClick={() => handleViewParser(stage.parserId)}\n className=\"mt-2 text-xs text-action-primary-bg hover:underline\"\n >\n View Parser\n </button>\n )}\n </div>\n\n {/* Arrow to next stage */}\n {index < (pipeline.stages?.length || 0) - 1 && (\n <ArrowRightIcon className=\"w-5 h-5 text-text-secondary flex-shrink-0 hidden md:block\" />\n )}\n </div>\n ))}\n </div>\n )}\n </GlassCard>\n\n {/* Test Panel */}\n {showTestPanel && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">Test Pipeline</h2>\n\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">Input JSON</label>\n <textarea\n value={testInput}\n onChange={(e) => setTestInput(e.target.value)}\n className=\"w-full h-32 px-3 py-2 text-sm font-mono text-text-primary bg-bg-sunken border border-border-default rounded-md focus:outline-none focus:ring-2 focus:ring-action-primary-bg resize-none\"\n placeholder='{\"key\": \"value\"}'\n />\n </div>\n\n <button\n type=\"button\"\n onClick={handleTest}\n disabled={loading}\n className=\"inline-flex items-center gap-2 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 disabled:opacity-50\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n {loading ? 'Running...' : 'Run Test'}\n </button>\n\n {testResult && (\n <div className=\"mt-4\">\n <div className=\"flex items-center gap-2 mb-2\">\n {testResult.status === 'completed' ? (\n <>\n <CheckIcon className=\"w-4 h-4 text-state-success\" />\n <span className=\"text-sm font-medium text-state-success\">Test Passed</span>\n </>\n ) : (\n <>\n <ErrorIcon className=\"w-4 h-4 text-state-error\" />\n <span className=\"text-sm font-medium text-state-error\">Test Failed</span>\n </>\n )}\n {testResult.totalExecutionTimeMs && (\n <span className=\"text-xs text-text-secondary\">({testResult.totalExecutionTimeMs}ms)</span>\n )}\n </div>\n\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">Output</label>\n <pre className=\"w-full p-3 text-xs font-mono text-text-primary bg-bg-sunken border border-border-default rounded-md overflow-auto max-h-48\">\n {JSON.stringify(testResult.outputData, null, 2) || 'null'}\n </pre>\n </div>\n\n {testResult.error && (\n <div className=\"mt-2\">\n <label className=\"block text-sm font-medium text-state-error mb-2\">Error</label>\n <pre className=\"w-full p-3 text-xs font-mono text-state-error bg-state-error/10 border border-state-error/20 rounded-md overflow-auto\">\n {testResult.error}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n\n {/* Sidebar */}\n <div className=\"space-y-6\">\n {/* Details */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">Details</h2>\n\n <dl className=\"space-y-3\">\n <div>\n <dt className=\"text-xs text-text-secondary\">Status</dt>\n <dd className=\"mt-1\">\n <PipelineStatusBadge status={pipeline.status} />\n </dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Stages</dt>\n <dd className=\"text-sm text-text-primary\">{pipeline.stages?.length || 0}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Last Executed</dt>\n <dd className=\"text-sm text-text-primary\">\n {pipeline.lastExecutedAt ? new Date(pipeline.lastExecutedAt).toLocaleString() : 'Never'}\n </dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Version</dt>\n <dd className=\"text-sm text-text-primary\">{pipeline.version}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Created</dt>\n <dd className=\"text-sm text-text-primary\">{new Date(pipeline.createdAt).toLocaleString()}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Updated</dt>\n <dd className=\"text-sm text-text-primary\">{new Date(pipeline.updatedAt).toLocaleString()}</dd>\n </div>\n </dl>\n </div>\n </div>\n </div>\n\n {/* Delete Dialog */}\n {pipeline && (\n <PipelineDeleteDialog\n pipeline={pipeline}\n isOpen={deleteDialogOpen}\n onClose={closeDeleteDialog}\n onConfirm={handleDeleteConfirm}\n />\n )}\n </div>\n );\n});\n\nexport default PipelineViewPage;\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAM,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAG,GAAE;EAAgC,CAAA;CACjG,CAAA,EAGF,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EACE,eAAc;EACd,gBAAe;EACf,aAAa;EACb,GAAE;EACF,CAAA;CACE,CAAA,EAGF,KAAc,EAAE,mBACpB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EACE,eAAc;EACd,gBAAe;EACf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,SAAS;IACT,WAAW;IACX,CAAA;GAEA;MAzSJ,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD;GACE,cAAa;GACb,OAAM;GACN,aAAY;GACZ,QACE,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,WAAU;cACX;IAEQ,CAAA;GAEX,CAAA;EACE,CAAA;EA4RV"}
1
+ {"version":3,"file":"PipelineViewPage.js","names":[],"sources":["../../../src/bigconsole/pages/PipelineViewPage.tsx"],"sourcesContent":["/**\n * Pipeline View Page\n *\n * Display Pipeline details, stages, and execution history.\n * Supports testing pipeline with sample input.\n */\n\nimport { memo, useState, useCallback, useEffect } from 'react';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { GlassCard, IllustratedEmptyState, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeNotify } from '../../utils/nativeBridge';\nimport { usePipelineOperations } from '../hooks/usePipelineOperations';\nimport { usePipelineStore } from '../store/pipelineStore';\nimport { PipelineStatusBadge } from '../components/pipeline/PipelineStatusBadge';\nimport { PipelineDeleteDialog } from '../components/pipeline/PipelineDeleteDialog';\nimport type { Pipeline, PipelineExecution, PipelineStage } from '../types';\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst BackIcon = ({ 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=\"M10 19l-7-7m0 0l7-7m-7 7h18\" />\n </svg>\n);\n\nconst EditIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n);\n\nconst DeleteIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n);\n\nconst PlayIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z\"\n />\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n);\n\nconst ErrorIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n);\n\nconst CheckIcon = ({ 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=\"M5 13l4 4L19 7\" />\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=\"M14 5l7 7m0 0l-7 7m7-7H3\" />\n </svg>\n);\n\n// ============================================================================\n// STAGE ERROR BADGE\n// ============================================================================\n\nconst StageErrorBadge = ({ handling }: { handling: string }) => {\n const config = {\n fail: { label: 'Fail', className: 'bg-status-error-bg/10 text-status-error-text' },\n skip: { label: 'Skip', className: 'bg-status-warning-bg/10 text-status-warning-text' },\n fallback: { label: 'Fallback', className: 'bg-action-primary-bg/10 text-action-primary-bg' },\n };\n const c = config[handling as keyof typeof config] || config.fail;\n return <span className={`px-1.5 py-0.5 text-xs font-medium rounded ${c.className}`}>{c.label}</span>;\n};\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const PipelineViewPage = memo(function PipelineViewPage() {\n const { pipelineId } = useParams<{ pipelineId: string }>();\n const navigate = useAppNavigate();\n // Use default consoleId for now (should come from context in production)\n const consoleId = 'default';\n const [searchParams] = useSearchParams();\n\n // Local state\n const [pipeline, setPipeline] = useState<Pipeline | null>(null);\n const [testInput, setTestInput] = useState('{\\n \"data\": \"sample\"\\n}');\n const [testResult, setTestResult] = useState<PipelineExecution | null>(null);\n const [showTestPanel, setShowTestPanel] = useState(searchParams.get('test') === 'true');\n\n // Store state\n const deleteDialogOpen = usePipelineStore((state) => state.deleteDialogOpen);\n const openDeleteDialog = usePipelineStore((state) => state.openDeleteDialog);\n const closeDeleteDialog = usePipelineStore((state) => state.closeDeleteDialog);\n\n // Operations\n const { loading, error, fetchPipeline, deletePipeline, testPipeline } = usePipelineOperations({\n consoleId,\n skipFetch: true,\n });\n\n // Fetch pipeline on mount\n useEffect(() => {\n if (pipelineId) {\n fetchPipeline(pipelineId).then((result) => {\n if (result) {\n setPipeline(result);\n }\n });\n }\n }, [pipelineId, fetchPipeline]);\n\n // Handlers\n const handleBack = useCallback(() => {\n navigate(`/pipelines`);\n }, [navigate]);\n\n const handleEdit = useCallback(() => {\n navigate(`/pipelines/${pipelineId}/edit`);\n }, [navigate, pipelineId]);\n\n const handleDeleteClick = useCallback(() => {\n if (pipeline) {\n openDeleteDialog(pipeline);\n }\n }, [pipeline, openDeleteDialog]);\n\n const handleDeleteConfirm = useCallback(async () => {\n if (pipeline) {\n const success = await deletePipeline(pipeline.id);\n if (success) {\n if (isNative()) void nativeNotify('success');\n closeDeleteDialog();\n navigate(`/pipelines`);\n } else if (isNative()) {\n void nativeNotify('error');\n }\n }\n }, [pipeline, deletePipeline, closeDeleteDialog, navigate]);\n\n const handleViewParser = useCallback(\n (parserId: string) => {\n navigate(`/dashboards/${consoleId}/parsers/${parserId}`);\n },\n [navigate, consoleId]\n );\n\n const handleTest = useCallback(async () => {\n if (!pipeline) return;\n\n try {\n const result = await testPipeline({\n pipelineId: pipeline.id,\n inputData: testInput,\n });\n if (result) {\n setTestResult(result);\n }\n } catch (err) {}\n }, [pipeline, testPipeline, testInput]);\n\n // Loading state\n if (loading && !pipeline) {\n return (\n <div className=\"p-6\">\n <div className=\"flex flex-col items-center justify-center py-16\">\n <svg className=\"w-8 h-8 text-action-primary-bg animate-spin mb-4\" 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 <p className=\"text-sm text-text-secondary\">Loading Pipeline...</p>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"p-6\">\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-3 rounded-full bg-status-error-bg/10 mb-4\">\n <ErrorIcon className=\"w-8 h-8 text-status-error-text\" />\n </div>\n <h3 className=\"text-lg font-medium text-text-primary mb-2\">Failed to load Pipeline</h3>\n <p className=\"text-sm text-text-secondary mb-4\">{error.message}</p>\n <button\n type=\"button\"\n onClick={handleBack}\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 Back to Pipelines\n </button>\n </div>\n </div>\n );\n }\n\n // Not found state\n if (!pipeline) {\n return (\n <div className=\"p-6\">\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"Pipeline not found\"\n description=\"The pipeline you're looking for doesn't exist or has been deleted.\"\n action={\n <button\n type=\"button\"\n onClick={handleBack}\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 Back to Pipelines\n </button>\n }\n />\n </div>\n );\n }\n\n return (\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-md transition-colors\"\n >\n <BackIcon className=\"w-5 h-5\" />\n </button>\n <div>\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl font-bold text-text-primary\">{pipeline.name}</h1>\n <PipelineStatusBadge status={pipeline.status} />\n </div>\n {pipeline.description && <p className=\"text-sm text-text-secondary mt-1\">{pipeline.description}</p>}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowTestPanel(!showTestPanel)}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-status-success-text bg-status-success-bg/10 hover:bg-status-success-bg/20 rounded-md transition-colors\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n Test\n </button>\n <button\n type=\"button\"\n onClick={handleEdit}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n <EditIcon className=\"w-4 h-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={handleDeleteClick}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-status-error-text bg-status-error-bg/10 hover:bg-status-error-bg/20 rounded-md transition-colors\"\n >\n <DeleteIcon className=\"w-4 h-4\" />\n Delete\n </button>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6\">\n A pipeline chains parsers and a data sink into a repeatable flow. Review its stages here, test it with sample\n input to confirm the output, then edit the stages or run it to process real data into the connected sink.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"bigconsole-pipeline-view\"\n steps={[\n {\n id: 'test',\n label: 'Test with sample input',\n description: 'Run the pipeline against a sample to verify each stage.',\n onClick: () => setShowTestPanel(true),\n },\n {\n id: 'edit',\n label: 'Edit the stages',\n description: 'Add, reorder, or configure the parsers in this pipeline.',\n onClick: handleEdit,\n },\n {\n id: 'sinks',\n label: 'Review the target data sink',\n description: 'See where the processed data lands.',\n onClick: () => navigate('/datasinks'),\n },\n ]}\n />\n\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6\">\n {/* Main Content */}\n <div className=\"lg:col-span-2 space-y-6\">\n {/* Stages — primary emphasis zone */}\n <GlassCard treatment=\"glass\" glow className=\"p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">\n Pipeline Stages ({pipeline.stages?.length || 0})\n </h2>\n\n {!pipeline.stages || pipeline.stages.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No stages defined\"\n description=\"Edit the pipeline to add parser stages.\"\n />\n ) : (\n <div className=\"space-y-3\">\n {pipeline.stages.map((stage: PipelineStage, index: number) => (\n <div key={stage.id} className=\"flex items-center gap-3\">\n {/* Stage Card */}\n <div\n className={`\n flex-1 p-4 rounded-lg border\n ${stage.enabled ? 'bg-bg-surface border-border-default' : 'bg-bg-sunken border-border-default opacity-60'}\n `}\n >\n <div className=\"flex items-center justify-between mb-2\">\n <div className=\"flex items-center gap-2\">\n <span className=\"w-6 h-6 flex items-center justify-center text-xs font-medium bg-action-primary-bg/10 text-action-primary-bg rounded-full\">\n {index + 1}\n </span>\n <span className=\"font-medium text-text-primary\">\n {stage.parserName || `Stage ${index + 1}`}\n </span>\n {stage.parserType && (\n <span className=\"px-1.5 py-0.5 text-xs font-medium bg-bg-sunken text-text-secondary rounded\">\n {stage.parserType.toUpperCase()}\n </span>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <StageErrorBadge handling={stage.onError} />\n {!stage.enabled && (\n <span className=\"px-1.5 py-0.5 text-xs font-medium bg-bg-sunken text-text-secondary rounded\">\n Disabled\n </span>\n )}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2 text-xs text-text-secondary\">\n <span className=\"font-mono bg-bg-sunken px-1.5 py-0.5 rounded\">{stage.inputKey}</span>\n <ArrowRightIcon className=\"w-3 h-3\" />\n <span className=\"font-mono bg-bg-sunken px-1.5 py-0.5 rounded\">{stage.outputKey}</span>\n </div>\n\n {stage.description && <p className=\"text-xs text-text-secondary mt-2\">{stage.description}</p>}\n\n {stage.parserId && (\n <button\n type=\"button\"\n onClick={() => handleViewParser(stage.parserId)}\n className=\"mt-2 text-xs text-action-primary-bg hover:underline\"\n >\n View Parser\n </button>\n )}\n </div>\n\n {/* Arrow to next stage */}\n {index < (pipeline.stages?.length || 0) - 1 && (\n <ArrowRightIcon className=\"w-5 h-5 text-text-secondary flex-shrink-0 hidden md:block\" />\n )}\n </div>\n ))}\n </div>\n )}\n </GlassCard>\n\n {/* Test Panel */}\n {showTestPanel && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">Test Pipeline</h2>\n\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">Input JSON</label>\n <textarea\n value={testInput}\n onChange={(e) => setTestInput(e.target.value)}\n className=\"w-full h-32 px-3 py-2 text-sm font-mono text-text-primary bg-bg-sunken border border-border-default rounded-md focus:outline-none focus:ring-2 focus:ring-action-primary-bg resize-none\"\n placeholder='{\"key\": \"value\"}'\n />\n </div>\n\n <button\n type=\"button\"\n onClick={handleTest}\n disabled={loading}\n className=\"inline-flex items-center gap-2 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 disabled:opacity-50\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n {loading ? 'Running...' : 'Run Test'}\n </button>\n\n {testResult && (\n <div className=\"mt-4\">\n <div className=\"flex items-center gap-2 mb-2\">\n {testResult.status === 'completed' ? (\n <>\n <CheckIcon className=\"w-4 h-4 text-status-success-text\" />\n <span className=\"text-sm font-medium text-status-success-text\">Test Passed</span>\n </>\n ) : (\n <>\n <ErrorIcon className=\"w-4 h-4 text-status-error-text\" />\n <span className=\"text-sm font-medium text-status-error-text\">Test Failed</span>\n </>\n )}\n {testResult.totalExecutionTimeMs && (\n <span className=\"text-xs text-text-secondary\">({testResult.totalExecutionTimeMs}ms)</span>\n )}\n </div>\n\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">Output</label>\n <pre className=\"w-full p-3 text-xs font-mono text-text-primary bg-bg-sunken border border-border-default rounded-md overflow-auto max-h-48\">\n {JSON.stringify(testResult.outputData, null, 2) || 'null'}\n </pre>\n </div>\n\n {testResult.error && (\n <div className=\"mt-2\">\n <label className=\"block text-sm font-medium text-status-error-text mb-2\">Error</label>\n <pre className=\"w-full p-3 text-xs font-mono text-status-error-text bg-status-error-bg/10 border border-status-error-border/20 rounded-md overflow-auto\">\n {testResult.error}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n\n {/* Sidebar */}\n <div className=\"space-y-6\">\n {/* Details */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-6\">\n <h2 className=\"text-lg font-semibold text-text-primary mb-4\">Details</h2>\n\n <dl className=\"space-y-3\">\n <div>\n <dt className=\"text-xs text-text-secondary\">Status</dt>\n <dd className=\"mt-1\">\n <PipelineStatusBadge status={pipeline.status} />\n </dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Stages</dt>\n <dd className=\"text-sm text-text-primary\">{pipeline.stages?.length || 0}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Last Executed</dt>\n <dd className=\"text-sm text-text-primary\">\n {pipeline.lastExecutedAt ? new Date(pipeline.lastExecutedAt).toLocaleString() : 'Never'}\n </dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Version</dt>\n <dd className=\"text-sm text-text-primary\">{pipeline.version}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Created</dt>\n <dd className=\"text-sm text-text-primary\">{new Date(pipeline.createdAt).toLocaleString()}</dd>\n </div>\n\n <div>\n <dt className=\"text-xs text-text-secondary\">Updated</dt>\n <dd className=\"text-sm text-text-primary\">{new Date(pipeline.updatedAt).toLocaleString()}</dd>\n </div>\n </dl>\n </div>\n </div>\n </div>\n\n {/* Delete Dialog */}\n {pipeline && (\n <PipelineDeleteDialog\n pipeline={pipeline}\n isOpen={deleteDialogOpen}\n onClose={closeDeleteDialog}\n onConfirm={handleDeleteConfirm}\n />\n )}\n </div>\n );\n});\n\nexport default PipelineViewPage;\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAM,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAG,GAAE;EAAgC,CAAA;CACjG,CAAA,EAGF,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EACE,eAAc;EACd,gBAAe;EACf,aAAa;EACb,GAAE;EACF,CAAA;CACE,CAAA,EAGF,KAAc,EAAE,mBACpB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EACE,eAAc;EACd,gBAAe;EACf,aAAa;EACb,GAAE;EACF,CAAA;CACE,CAAA,EAGF,KAAY,EAAE,mBAClB,kBAAC,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kBAAC,GAAD;GACE,cAAa;GACb,OAAM;GACN,aAAY;GACZ,QACE,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,WAAU;cACX;IAEQ,CAAA;GAEX,CAAA;EACE,CAAA;EA4RV"}
@@ -289,7 +289,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
289
289
  type: "button",
290
290
  onClick: Q,
291
291
  disabled: P,
292
- className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-state-success hover:bg-state-success/90 rounded-md transition-colors disabled:opacity-50",
292
+ className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-status-success-bg hover:bg-status-success-bg/90 rounded-md transition-colors disabled:opacity-50",
293
293
  children: [/* @__PURE__ */ _(w, { className: "w-4 h-4" }), P ? "Executing..." : "Execute"]
294
294
  }),
295
295
  /* @__PURE__ */ v("button", {
@@ -301,7 +301,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
301
301
  /* @__PURE__ */ v("button", {
302
302
  type: "button",
303
303
  onClick: () => M(!0),
304
- className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-state-error bg-state-error/10 hover:bg-state-error/20 rounded-md transition-colors",
304
+ className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-status-error-text bg-status-error-bg/10 hover:bg-status-error-bg/20 rounded-md transition-colors",
305
305
  children: [/* @__PURE__ */ _(C, { className: "w-4 h-4" }), "Delete"]
306
306
  })
307
307
  ]
@@ -342,7 +342,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
342
342
  ]
343
343
  }),
344
344
  H && /* @__PURE__ */ v("div", {
345
- className: `mb-6 p-4 rounded-lg border ${H.success ? "bg-state-success/10 border-state-success/20" : "bg-state-error/10 border-state-error/20"}`,
345
+ className: `mb-6 p-4 rounded-lg border ${H.success ? "bg-status-success-bg/10 border-status-success-border/20" : "bg-status-error-bg/10 border-status-error-border/20"}`,
346
346
  children: [
347
347
  /* @__PURE__ */ v("div", {
348
348
  className: "flex items-center justify-between mb-2",
@@ -355,7 +355,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
355
355
  })]
356
356
  }),
357
357
  H.error ? /* @__PURE__ */ _("p", {
358
- className: "text-sm text-state-error",
358
+ className: "text-sm text-status-error-text",
359
359
  children: H.error
360
360
  }) : /* @__PURE__ */ _("pre", {
361
361
  className: "text-xs text-text-secondary font-mono bg-bg-sunken p-2 rounded overflow-auto max-h-[200px]",
@@ -420,7 +420,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
420
420
  type: "button",
421
421
  onClick: ce,
422
422
  className: "flex items-center gap-1 px-3 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors",
423
- children: I ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(E, { className: "w-4 h-4 text-state-success" }), "Copied!"] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(T, { className: "w-4 h-4" }), "Copy"] })
423
+ children: I ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(E, { className: "w-4 h-4 text-status-success-text" }), "Copied!"] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(T, { className: "w-4 h-4" }), "Copy"] })
424
424
  })]
425
425
  })]
426
426
  }),
@@ -476,7 +476,7 @@ var x = ({ className: e }) => /* @__PURE__ */ _("svg", {
476
476
  children: [/* @__PURE__ */ v("div", {
477
477
  className: "flex items-center gap-2",
478
478
  children: [e.isEnabled ? /* @__PURE__ */ _("span", {
479
- className: "text-xs text-state-success",
479
+ className: "text-xs text-status-success-text",
480
480
  children: "Enabled"
481
481
  }) : /* @__PURE__ */ _("span", {
482
482
  className: "text-xs text-text-secondary",
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowViewPage.js","names":[],"sources":["../../../src/bigconsole/pages/WorkflowViewPage.tsx"],"sourcesContent":["/**\n * Workflow View Page\n *\n * Page for viewing FluidGrids Workflow details, linked DataSinks,\n * read-only workflow design preview, and real execution with polling.\n */\n\nimport { memo, useState, useEffect, useCallback } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { GlassCard, IllustratedEmptyState, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeCopyText, nativeNotify, nativeToast } from '../../utils/nativeBridge';\nimport { useBigConsole } from '../context';\nimport { formatDistanceToNow } from 'date-fns';\nimport { useWorkflowOperations } from '../hooks/useWorkflowOperations';\nimport { WorkflowStatusBadge } from '../components/workflow/WorkflowStatusBadge';\nimport { WorkflowDeleteDialog } from '../components/workflow/WorkflowDeleteDialog';\nimport type { FluidGridsWorkflow } from '../types';\n\n// FluidGrids FE SDK — read-only embedded builder preview\nimport { WorkflowBuilder } from '@burdenoff/fluidgrids-fe-sdk';\nimport { BOOTSTRAP_RETRY_DELAY_MS } from '../constants';\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst ArrowLeftIcon = ({ 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=\"M15 19l-7-7 7-7\" />\n </svg>\n);\n\nconst EditIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n);\n\nconst TrashIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n);\n\nconst PlayIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z\"\n />\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n);\n\nconst CopyIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\"\n />\n </svg>\n);\n\nconst CheckIcon = ({ 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=\"M5 13l4 4L19 7\" />\n </svg>\n);\n\nconst DatabaseIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4\"\n />\n </svg>\n);\n\nconst ErrorIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n);\n\nconst ChevronDownIcon = ({ 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=\"M19 9l-7 7-7-7\" />\n </svg>\n);\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const WorkflowViewPage = memo(function WorkflowViewPage() {\n const navigate = useAppNavigate();\n const { workflowId } = useParams<{ workflowId: string }>();\n\n // BigConsole context for apiGatewayUrl and authToken\n const { apiGatewayUrl, authToken, workspaceId } = useBigConsole();\n\n // Local state\n const [workflow, setWorkflow] = useState<FluidGridsWorkflow | null>(null);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n const [, setIsDeleting] = useState(false);\n const [isExecuting, setIsExecuting] = useState(false);\n const [webhookCopied, setWebhookCopied] = useState(false);\n const [showDesignPreview, setShowDesignPreview] = useState(false);\n // Track whether initial fetch has completed — prevents \"not found\" flash\n // before data has even been requested (loading starts as false with skipFetch: true)\n const [isReady, setIsReady] = useState(false);\n const [executionResult, setExecutionResult] = useState<{\n success: boolean;\n output: unknown;\n error: string | null;\n executionTimeMs: number;\n runId?: string;\n } | null>(null);\n\n // Operations\n const { loading, error, fetchWorkflow, deleteWorkflow, executeWorkflow, pollWorkflowExecution } =\n useWorkflowOperations({\n skipFetch: true,\n });\n\n // Load workflow on mount.\n // On a full page reload the workspace token may not be issued yet when this\n // effect first runs, causing the gateway to lack workspace context and\n // the resolver to return null. We retry once after a short delay to give\n // the auth bootstrap time to complete.\n useEffect(() => {\n if (!workflowId) {\n setIsReady(true);\n return;\n }\n\n let cancelled = false;\n\n const load = async (attempt: number) => {\n try {\n const result = await fetchWorkflow(workflowId);\n if (cancelled) return;\n\n if (result) {\n setWorkflow(result);\n setIsReady(true);\n } else if (attempt === 0) {\n // First attempt failed — likely workspace token race on full-page load.\n // Retry once after a short delay.\n setTimeout(() => {\n if (!cancelled) load(1);\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n // Second attempt also failed — genuinely not found\n setIsReady(true);\n }\n } catch {\n // Network error, GraphQL error, etc. — surface the \"not found\" UI\n // rather than spinning forever with no escape hatch.\n if (!cancelled) setIsReady(true);\n }\n };\n\n load(0);\n return () => {\n cancelled = true;\n };\n }, [workflowId, fetchWorkflow]);\n\n // Handlers\n const handleBack = useCallback(() => {\n navigate(`/workflows`);\n }, [navigate]);\n\n const handleEdit = useCallback(() => {\n navigate(`/workflows/${workflowId}/edit`);\n }, [navigate, workflowId]);\n\n const handleDelete = useCallback(async () => {\n if (!workflowId) return;\n setIsDeleting(true);\n try {\n const success = await deleteWorkflow(workflowId);\n if (success) {\n if (isNative()) void nativeNotify('success');\n navigate(`/workflows`);\n } else if (isNative()) {\n void nativeNotify('error');\n }\n } catch {\n if (isNative()) void nativeNotify('error');\n } finally {\n setIsDeleting(false);\n setShowDeleteConfirm(false);\n }\n }, [workflowId, deleteWorkflow, navigate]);\n\n const handleExecute = useCallback(async () => {\n if (!workflowId) return;\n setIsExecuting(true);\n setExecutionResult(null);\n\n const startTime = Date.now();\n\n try {\n const result = await executeWorkflow(workflowId);\n\n if (result) {\n const executionTimeMs = Date.now() - startTime;\n\n // If workflow has external FluidGrids ID, the execution is async\n if (result.externalWorkflowId) {\n setExecutionResult({\n success: true,\n output: {\n externalWorkflowId: result.externalWorkflowId,\n executionCount: result.executionCount,\n status: 'Triggered — polling for completion...',\n },\n error: null,\n executionTimeMs,\n });\n\n // Poll for completion in the background\n pollWorkflowExecution(workflowId, {\n intervalMs: 3000,\n timeoutMs: 120000,\n onProgress: (updated) => {\n setWorkflow(updated);\n },\n }).then((final) => {\n if (final) {\n setWorkflow(final);\n setExecutionResult((prev) =>\n prev\n ? {\n ...prev,\n output: {\n ...((prev.output as Record<string, unknown>) || {}),\n status: final.status === 'error' ? 'Failed' : 'Completed',\n executionCount: final.executionCount,\n lastExecutedAt: final.lastExecutedAt,\n },\n executionTimeMs: Date.now() - startTime,\n }\n : prev\n );\n }\n });\n } else {\n // Local execution (no external FluidGrids workflow)\n setExecutionResult({\n success: true,\n output: {\n executionCount: result.executionCount,\n lastExecutedAt: result.lastExecutedAt,\n status: 'Completed',\n },\n error: null,\n executionTimeMs,\n });\n }\n\n // Refresh workflow\n const updated = await fetchWorkflow(workflowId);\n if (updated) {\n setWorkflow(updated);\n }\n }\n } catch (err) {\n setExecutionResult({\n success: false,\n output: null,\n error: err instanceof Error ? err.message : 'Execution failed',\n executionTimeMs: Date.now() - startTime,\n });\n } finally {\n setIsExecuting(false);\n }\n }, [workflowId, executeWorkflow, fetchWorkflow, pollWorkflowExecution]);\n\n const handleCopyWebhook = useCallback(async () => {\n if (!workflow?.webhookUrl) return;\n try {\n await nativeCopyText(workflow.webhookUrl);\n setWebhookCopied(true);\n if (isNative()) void nativeToast('Webhook copied');\n setTimeout(() => setWebhookCopied(false), 2000);\n } catch {\n // Clipboard not available\n }\n }, [workflow?.webhookUrl]);\n\n const handleViewDataSink = useCallback(\n (dataSinkId: string) => {\n navigate(`/datasinks/${dataSinkId}`);\n },\n [navigate]\n );\n\n // Loading state — show spinner until initial fetch completes OR during a refetch\n if (!isReady || (loading && !workflow)) {\n return (\n <div className=\"p-6 flex items-center justify-center min-h-[400px]\">\n <svg className=\"w-8 h-8 text-action-primary-bg 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 );\n }\n\n // Error or not found state — only shown AFTER initial fetch completed\n if (error || !workflow) {\n return (\n <div className=\"p-6\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary mb-4\"\n >\n <ArrowLeftIcon className=\"w-4 h-4\" />\n Back to Workflows\n </button>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"Workflow not found\"\n description={error?.message || 'The workflow you are looking for does not exist.'}\n />\n </div>\n );\n }\n\n const linkedDataSinkCount = workflow.dataSinkLinks?.length || 0;\n\n return (\n <div className=\"p-6 max-w-5xl mx-auto\">\n {/* Header */}\n <div className=\"mb-8\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary mb-4\"\n >\n <ArrowLeftIcon className=\"w-4 h-4\" />\n Back to Workflows\n </button>\n\n <div className=\"flex items-start justify-between\">\n <div>\n <div className=\"flex items-center gap-3 mb-2\">\n <h1 className=\"text-2xl font-bold text-text-primary\">{workflow.name}</h1>\n <WorkflowStatusBadge status={workflow.status} />\n </div>\n <p className=\"text-sm text-text-secondary font-mono\">{workflow.key}</p>\n {workflow.externalWorkflowId && (\n <p className=\"text-xs text-text-tertiary mt-1\">\n FluidGrids ID: <span className=\"font-mono\">{workflow.externalWorkflowId}</span>\n </p>\n )}\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handleExecute}\n disabled={isExecuting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-state-success hover:bg-state-success/90 rounded-md transition-colors disabled:opacity-50\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n {isExecuting ? 'Executing...' : 'Execute'}\n </button>\n <button\n type=\"button\"\n onClick={handleEdit}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n <EditIcon className=\"w-4 h-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(true)}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-state-error bg-state-error/10 hover:bg-state-error/20 rounded-md transition-colors\"\n >\n <TrashIcon className=\"w-4 h-4\" />\n Delete\n </button>\n </div>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6\">\n A workflow is the visual ETL job that feeds this BigConsole — it fetches, transforms, and delivers data into\n linked data sinks. From here you can run it on demand, inspect its design and execution history, copy its\n webhook trigger, and edit it in the visual builder.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"bigconsole-workflow-view\"\n steps={[\n {\n id: 'execute',\n label: 'Run the workflow',\n description: 'Trigger an execution to pull fresh data now.',\n onClick: handleExecute,\n },\n {\n id: 'design',\n label: 'Inspect the design',\n description: 'Expand the read-only preview to see each step.',\n onClick: () => setShowDesignPreview(true),\n },\n {\n id: 'edit',\n label: 'Edit in the builder',\n description: 'Open the FluidGrids visual builder to change the flow.',\n onClick: handleEdit,\n },\n {\n id: 'sinks',\n label: 'Check the linked data sinks',\n description: 'See where this workflow writes its output.',\n onClick: () => navigate('/datasinks'),\n },\n ]}\n />\n\n {/* Execution Result */}\n {executionResult && (\n <div\n className={`mb-6 p-4 rounded-lg border ${\n executionResult.success\n ? 'bg-state-success/10 border-state-success/20'\n : 'bg-state-error/10 border-state-error/20'\n }`}\n >\n <div className=\"flex items-center justify-between mb-2\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {executionResult.success ? 'Execution Triggered' : 'Execution Failed'}\n </h3>\n <span className=\"text-xs text-text-secondary\">{executionResult.executionTimeMs}ms</span>\n </div>\n {executionResult.error ? (\n <p className=\"text-sm text-state-error\">{executionResult.error}</p>\n ) : (\n <pre className=\"text-xs text-text-secondary font-mono bg-bg-sunken p-2 rounded overflow-auto max-h-[200px]\">\n {JSON.stringify(executionResult.output, null, 2)}\n </pre>\n )}\n {executionResult.runId && (\n <p className=\"text-xs text-text-tertiary mt-2\">\n Run ID: <span className=\"font-mono\">{executionResult.runId}</span>\n </p>\n )}\n </div>\n )}\n\n {/* Info Grid */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8\">\n {/* Description */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Description</h3>\n <p className=\"text-sm text-text-primary\">{workflow.description || 'No description'}</p>\n </div>\n\n {/* Execution Stats — primary emphasis zone */}\n <GlassCard treatment=\"glass\" glow className=\"p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Execution Stats</h3>\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <p className=\"text-2xl font-bold text-text-primary\">{workflow.executionCount}</p>\n <p className=\"text-xs text-text-secondary\">Total Executions</p>\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {workflow.lastExecutedAt\n ? formatDistanceToNow(new Date(workflow.lastExecutedAt), { addSuffix: true })\n : 'Never'}\n </p>\n <p className=\"text-xs text-text-secondary\">Last Executed</p>\n </div>\n </div>\n </GlassCard>\n </div>\n\n {/* Webhook URL */}\n {workflow.webhookUrl && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4 mb-8\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Webhook URL</h3>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 text-sm text-text-primary font-mono bg-bg-sunken px-3 py-2 rounded overflow-auto\">\n {workflow.webhookUrl}\n </code>\n <button\n type=\"button\"\n onClick={handleCopyWebhook}\n className=\"flex items-center gap-1 px-3 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors\"\n >\n {webhookCopied ? (\n <>\n <CheckIcon className=\"w-4 h-4 text-state-success\" />\n Copied!\n </>\n ) : (\n <>\n <CopyIcon className=\"w-4 h-4\" />\n Copy\n </>\n )}\n </button>\n </div>\n </div>\n )}\n\n {/* Workflow Design Preview (collapsible) */}\n {workflow.externalWorkflowId && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg mb-8 overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => setShowDesignPreview((prev) => !prev)}\n className=\"w-full flex items-center justify-between px-4 py-3 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors\"\n >\n <span>Workflow Design Preview</span>\n <ChevronDownIcon\n className={`w-4 h-4 text-text-secondary transition-transform ${showDesignPreview ? 'rotate-180' : ''}`}\n />\n </button>\n {showDesignPreview && (\n <div className=\"border-t border-border-default\" style={{ height: '450px' }}>\n <WorkflowBuilder\n apiGatewayUrl={apiGatewayUrl}\n workspaceId={workspaceId || 'default'}\n authToken={authToken}\n workflowId={workflow.externalWorkflowId}\n readonly\n hideHeader\n className=\"h-full\"\n />\n </div>\n )}\n </div>\n )}\n\n {/* Linked DataSinks */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4 mb-8\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-4\">Linked DataSinks ({linkedDataSinkCount})</h3>\n {linkedDataSinkCount === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No data sinks linked\"\n description=\"This workflow has no data sinks linked yet — its output isn't being stored.\"\n />\n ) : (\n <div className=\"space-y-2\">\n {workflow.dataSinkLinks?.map((link) => (\n <div key={link.id} className=\"flex items-center justify-between px-3 py-2 bg-bg-sunken rounded-md\">\n <div className=\"flex items-center gap-3\">\n <DatabaseIcon className=\"w-4 h-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {link.dataSink?.name || link.dataSink?.key || link.dataSinkId}\n </p>\n {link.dataSink?.key && <p className=\"text-xs text-text-secondary font-mono\">{link.dataSink.key}</p>}\n </div>\n </div>\n <div className=\"flex items-center gap-4\">\n <div className=\"flex items-center gap-2\">\n {link.isEnabled ? (\n <span className=\"text-xs text-state-success\">Enabled</span>\n ) : (\n <span className=\"text-xs text-text-secondary\">Disabled</span>\n )}\n <span className=\"text-xs text-text-secondary\">Priority: {link.priority}</span>\n </div>\n {link.dataSink && (\n <button\n type=\"button\"\n onClick={() => handleViewDataSink(link.dataSinkId)}\n className=\"text-xs text-action-primary-bg hover:underline\"\n >\n View\n </button>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n\n {/* Timestamps */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-6\">\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Created</h3>\n <p className=\"text-sm text-text-primary\">\n {formatDistanceToNow(new Date(workflow.createdAt), { addSuffix: true })}\n </p>\n <p className=\"text-xs text-text-secondary\">by {workflow.createdBy}</p>\n </div>\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Last Updated</h3>\n <p className=\"text-sm text-text-primary\">\n {formatDistanceToNow(new Date(workflow.updatedAt), { addSuffix: true })}\n </p>\n <p className=\"text-xs text-text-secondary\">by {workflow.updatedBy || workflow.createdBy}</p>\n </div>\n </div>\n\n {/* Delete Confirmation Dialog */}\n {workflow && (\n <WorkflowDeleteDialog\n workflow={workflow}\n isOpen={showDeleteConfirm}\n onClose={() => setShowDeleteConfirm(false)}\n onConfirm={handleDelete}\n />\n )}\n </div>\n );\n});\n\nexport default WorkflowViewPage;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAM,KAAiB,EAAE,mBACvB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAG,GAAE;EAAoB,CAAA;CACrF,CAAA,EAGF,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EACE,eAAc;EACd,gBAAe;EACf,aAAa;EACb,GAAE;EACF,CAAA;CACE,CAAA,EAGF,KAAa,EAAE,mBACnB,kBAAC,OAAD;CAAgB;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console/pages/WorkflowViewPage.tsx"],"sourcesContent":["/**\n * Workflow View Page\n *\n * Page for viewing FluidGrids Workflow details, linked DataSinks,\n * read-only workflow design preview, and real execution with polling.\n */\n\nimport { memo, useState, useEffect, useCallback } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { GlassCard, IllustratedEmptyState, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeCopyText, nativeNotify, nativeToast } from '../../utils/nativeBridge';\nimport { useBigConsole } from '../context';\nimport { formatDistanceToNow } from 'date-fns';\nimport { useWorkflowOperations } from '../hooks/useWorkflowOperations';\nimport { WorkflowStatusBadge } from '../components/workflow/WorkflowStatusBadge';\nimport { WorkflowDeleteDialog } from '../components/workflow/WorkflowDeleteDialog';\nimport type { FluidGridsWorkflow } from '../types';\n\n// FluidGrids FE SDK — read-only embedded builder preview\nimport { WorkflowBuilder } from '@burdenoff/fluidgrids-fe-sdk';\nimport { BOOTSTRAP_RETRY_DELAY_MS } from '../constants';\n\n// ============================================================================\n// ICONS\n// ============================================================================\n\nconst ArrowLeftIcon = ({ 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=\"M15 19l-7-7 7-7\" />\n </svg>\n);\n\nconst EditIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n);\n\nconst TrashIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n);\n\nconst PlayIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z\"\n />\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n);\n\nconst CopyIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\"\n />\n </svg>\n);\n\nconst CheckIcon = ({ 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=\"M5 13l4 4L19 7\" />\n </svg>\n);\n\nconst DatabaseIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4\"\n />\n </svg>\n);\n\nconst ErrorIcon = ({ className }: { className?: string }) => (\n <svg className={className} fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n);\n\nconst ChevronDownIcon = ({ 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=\"M19 9l-7 7-7-7\" />\n </svg>\n);\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const WorkflowViewPage = memo(function WorkflowViewPage() {\n const navigate = useAppNavigate();\n const { workflowId } = useParams<{ workflowId: string }>();\n\n // BigConsole context for apiGatewayUrl and authToken\n const { apiGatewayUrl, authToken, workspaceId } = useBigConsole();\n\n // Local state\n const [workflow, setWorkflow] = useState<FluidGridsWorkflow | null>(null);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n const [, setIsDeleting] = useState(false);\n const [isExecuting, setIsExecuting] = useState(false);\n const [webhookCopied, setWebhookCopied] = useState(false);\n const [showDesignPreview, setShowDesignPreview] = useState(false);\n // Track whether initial fetch has completed — prevents \"not found\" flash\n // before data has even been requested (loading starts as false with skipFetch: true)\n const [isReady, setIsReady] = useState(false);\n const [executionResult, setExecutionResult] = useState<{\n success: boolean;\n output: unknown;\n error: string | null;\n executionTimeMs: number;\n runId?: string;\n } | null>(null);\n\n // Operations\n const { loading, error, fetchWorkflow, deleteWorkflow, executeWorkflow, pollWorkflowExecution } =\n useWorkflowOperations({\n skipFetch: true,\n });\n\n // Load workflow on mount.\n // On a full page reload the workspace token may not be issued yet when this\n // effect first runs, causing the gateway to lack workspace context and\n // the resolver to return null. We retry once after a short delay to give\n // the auth bootstrap time to complete.\n useEffect(() => {\n if (!workflowId) {\n setIsReady(true);\n return;\n }\n\n let cancelled = false;\n\n const load = async (attempt: number) => {\n try {\n const result = await fetchWorkflow(workflowId);\n if (cancelled) return;\n\n if (result) {\n setWorkflow(result);\n setIsReady(true);\n } else if (attempt === 0) {\n // First attempt failed — likely workspace token race on full-page load.\n // Retry once after a short delay.\n setTimeout(() => {\n if (!cancelled) load(1);\n }, BOOTSTRAP_RETRY_DELAY_MS);\n } else {\n // Second attempt also failed — genuinely not found\n setIsReady(true);\n }\n } catch {\n // Network error, GraphQL error, etc. — surface the \"not found\" UI\n // rather than spinning forever with no escape hatch.\n if (!cancelled) setIsReady(true);\n }\n };\n\n load(0);\n return () => {\n cancelled = true;\n };\n }, [workflowId, fetchWorkflow]);\n\n // Handlers\n const handleBack = useCallback(() => {\n navigate(`/workflows`);\n }, [navigate]);\n\n const handleEdit = useCallback(() => {\n navigate(`/workflows/${workflowId}/edit`);\n }, [navigate, workflowId]);\n\n const handleDelete = useCallback(async () => {\n if (!workflowId) return;\n setIsDeleting(true);\n try {\n const success = await deleteWorkflow(workflowId);\n if (success) {\n if (isNative()) void nativeNotify('success');\n navigate(`/workflows`);\n } else if (isNative()) {\n void nativeNotify('error');\n }\n } catch {\n if (isNative()) void nativeNotify('error');\n } finally {\n setIsDeleting(false);\n setShowDeleteConfirm(false);\n }\n }, [workflowId, deleteWorkflow, navigate]);\n\n const handleExecute = useCallback(async () => {\n if (!workflowId) return;\n setIsExecuting(true);\n setExecutionResult(null);\n\n const startTime = Date.now();\n\n try {\n const result = await executeWorkflow(workflowId);\n\n if (result) {\n const executionTimeMs = Date.now() - startTime;\n\n // If workflow has external FluidGrids ID, the execution is async\n if (result.externalWorkflowId) {\n setExecutionResult({\n success: true,\n output: {\n externalWorkflowId: result.externalWorkflowId,\n executionCount: result.executionCount,\n status: 'Triggered — polling for completion...',\n },\n error: null,\n executionTimeMs,\n });\n\n // Poll for completion in the background\n pollWorkflowExecution(workflowId, {\n intervalMs: 3000,\n timeoutMs: 120000,\n onProgress: (updated) => {\n setWorkflow(updated);\n },\n }).then((final) => {\n if (final) {\n setWorkflow(final);\n setExecutionResult((prev) =>\n prev\n ? {\n ...prev,\n output: {\n ...((prev.output as Record<string, unknown>) || {}),\n status: final.status === 'error' ? 'Failed' : 'Completed',\n executionCount: final.executionCount,\n lastExecutedAt: final.lastExecutedAt,\n },\n executionTimeMs: Date.now() - startTime,\n }\n : prev\n );\n }\n });\n } else {\n // Local execution (no external FluidGrids workflow)\n setExecutionResult({\n success: true,\n output: {\n executionCount: result.executionCount,\n lastExecutedAt: result.lastExecutedAt,\n status: 'Completed',\n },\n error: null,\n executionTimeMs,\n });\n }\n\n // Refresh workflow\n const updated = await fetchWorkflow(workflowId);\n if (updated) {\n setWorkflow(updated);\n }\n }\n } catch (err) {\n setExecutionResult({\n success: false,\n output: null,\n error: err instanceof Error ? err.message : 'Execution failed',\n executionTimeMs: Date.now() - startTime,\n });\n } finally {\n setIsExecuting(false);\n }\n }, [workflowId, executeWorkflow, fetchWorkflow, pollWorkflowExecution]);\n\n const handleCopyWebhook = useCallback(async () => {\n if (!workflow?.webhookUrl) return;\n try {\n await nativeCopyText(workflow.webhookUrl);\n setWebhookCopied(true);\n if (isNative()) void nativeToast('Webhook copied');\n setTimeout(() => setWebhookCopied(false), 2000);\n } catch {\n // Clipboard not available\n }\n }, [workflow?.webhookUrl]);\n\n const handleViewDataSink = useCallback(\n (dataSinkId: string) => {\n navigate(`/datasinks/${dataSinkId}`);\n },\n [navigate]\n );\n\n // Loading state — show spinner until initial fetch completes OR during a refetch\n if (!isReady || (loading && !workflow)) {\n return (\n <div className=\"p-6 flex items-center justify-center min-h-[400px]\">\n <svg className=\"w-8 h-8 text-action-primary-bg 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 );\n }\n\n // Error or not found state — only shown AFTER initial fetch completed\n if (error || !workflow) {\n return (\n <div className=\"p-6\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary mb-4\"\n >\n <ArrowLeftIcon className=\"w-4 h-4\" />\n Back to Workflows\n </button>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"Workflow not found\"\n description={error?.message || 'The workflow you are looking for does not exist.'}\n />\n </div>\n );\n }\n\n const linkedDataSinkCount = workflow.dataSinkLinks?.length || 0;\n\n return (\n <div className=\"p-6 max-w-5xl mx-auto\">\n {/* Header */}\n <div className=\"mb-8\">\n <button\n type=\"button\"\n onClick={handleBack}\n className=\"inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary mb-4\"\n >\n <ArrowLeftIcon className=\"w-4 h-4\" />\n Back to Workflows\n </button>\n\n <div className=\"flex items-start justify-between\">\n <div>\n <div className=\"flex items-center gap-3 mb-2\">\n <h1 className=\"text-2xl font-bold text-text-primary\">{workflow.name}</h1>\n <WorkflowStatusBadge status={workflow.status} />\n </div>\n <p className=\"text-sm text-text-secondary font-mono\">{workflow.key}</p>\n {workflow.externalWorkflowId && (\n <p className=\"text-xs text-text-tertiary mt-1\">\n FluidGrids ID: <span className=\"font-mono\">{workflow.externalWorkflowId}</span>\n </p>\n )}\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handleExecute}\n disabled={isExecuting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-status-success-bg hover:bg-status-success-bg/90 rounded-md transition-colors disabled:opacity-50\"\n >\n <PlayIcon className=\"w-4 h-4\" />\n {isExecuting ? 'Executing...' : 'Execute'}\n </button>\n <button\n type=\"button\"\n onClick={handleEdit}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors\"\n >\n <EditIcon className=\"w-4 h-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(true)}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-status-error-text bg-status-error-bg/10 hover:bg-status-error-bg/20 rounded-md transition-colors\"\n >\n <TrashIcon className=\"w-4 h-4\" />\n Delete\n </button>\n </div>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6\">\n A workflow is the visual ETL job that feeds this BigConsole — it fetches, transforms, and delivers data into\n linked data sinks. From here you can run it on demand, inspect its design and execution history, copy its\n webhook trigger, and edit it in the visual builder.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"bigconsole-workflow-view\"\n steps={[\n {\n id: 'execute',\n label: 'Run the workflow',\n description: 'Trigger an execution to pull fresh data now.',\n onClick: handleExecute,\n },\n {\n id: 'design',\n label: 'Inspect the design',\n description: 'Expand the read-only preview to see each step.',\n onClick: () => setShowDesignPreview(true),\n },\n {\n id: 'edit',\n label: 'Edit in the builder',\n description: 'Open the FluidGrids visual builder to change the flow.',\n onClick: handleEdit,\n },\n {\n id: 'sinks',\n label: 'Check the linked data sinks',\n description: 'See where this workflow writes its output.',\n onClick: () => navigate('/datasinks'),\n },\n ]}\n />\n\n {/* Execution Result */}\n {executionResult && (\n <div\n className={`mb-6 p-4 rounded-lg border ${\n executionResult.success\n ? 'bg-status-success-bg/10 border-status-success-border/20'\n : 'bg-status-error-bg/10 border-status-error-border/20'\n }`}\n >\n <div className=\"flex items-center justify-between mb-2\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {executionResult.success ? 'Execution Triggered' : 'Execution Failed'}\n </h3>\n <span className=\"text-xs text-text-secondary\">{executionResult.executionTimeMs}ms</span>\n </div>\n {executionResult.error ? (\n <p className=\"text-sm text-status-error-text\">{executionResult.error}</p>\n ) : (\n <pre className=\"text-xs text-text-secondary font-mono bg-bg-sunken p-2 rounded overflow-auto max-h-[200px]\">\n {JSON.stringify(executionResult.output, null, 2)}\n </pre>\n )}\n {executionResult.runId && (\n <p className=\"text-xs text-text-tertiary mt-2\">\n Run ID: <span className=\"font-mono\">{executionResult.runId}</span>\n </p>\n )}\n </div>\n )}\n\n {/* Info Grid */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8\">\n {/* Description */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Description</h3>\n <p className=\"text-sm text-text-primary\">{workflow.description || 'No description'}</p>\n </div>\n\n {/* Execution Stats — primary emphasis zone */}\n <GlassCard treatment=\"glass\" glow className=\"p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Execution Stats</h3>\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <p className=\"text-2xl font-bold text-text-primary\">{workflow.executionCount}</p>\n <p className=\"text-xs text-text-secondary\">Total Executions</p>\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {workflow.lastExecutedAt\n ? formatDistanceToNow(new Date(workflow.lastExecutedAt), { addSuffix: true })\n : 'Never'}\n </p>\n <p className=\"text-xs text-text-secondary\">Last Executed</p>\n </div>\n </div>\n </GlassCard>\n </div>\n\n {/* Webhook URL */}\n {workflow.webhookUrl && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4 mb-8\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Webhook URL</h3>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 text-sm text-text-primary font-mono bg-bg-sunken px-3 py-2 rounded overflow-auto\">\n {workflow.webhookUrl}\n </code>\n <button\n type=\"button\"\n onClick={handleCopyWebhook}\n className=\"flex items-center gap-1 px-3 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors\"\n >\n {webhookCopied ? (\n <>\n <CheckIcon className=\"w-4 h-4 text-status-success-text\" />\n Copied!\n </>\n ) : (\n <>\n <CopyIcon className=\"w-4 h-4\" />\n Copy\n </>\n )}\n </button>\n </div>\n </div>\n )}\n\n {/* Workflow Design Preview (collapsible) */}\n {workflow.externalWorkflowId && (\n <div className=\"bg-bg-surface border border-border-default rounded-lg mb-8 overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => setShowDesignPreview((prev) => !prev)}\n className=\"w-full flex items-center justify-between px-4 py-3 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors\"\n >\n <span>Workflow Design Preview</span>\n <ChevronDownIcon\n className={`w-4 h-4 text-text-secondary transition-transform ${showDesignPreview ? 'rotate-180' : ''}`}\n />\n </button>\n {showDesignPreview && (\n <div className=\"border-t border-border-default\" style={{ height: '450px' }}>\n <WorkflowBuilder\n apiGatewayUrl={apiGatewayUrl}\n workspaceId={workspaceId || 'default'}\n authToken={authToken}\n workflowId={workflow.externalWorkflowId}\n readonly\n hideHeader\n className=\"h-full\"\n />\n </div>\n )}\n </div>\n )}\n\n {/* Linked DataSinks */}\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4 mb-8\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-4\">Linked DataSinks ({linkedDataSinkCount})</h3>\n {linkedDataSinkCount === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No data sinks linked\"\n description=\"This workflow has no data sinks linked yet — its output isn't being stored.\"\n />\n ) : (\n <div className=\"space-y-2\">\n {workflow.dataSinkLinks?.map((link) => (\n <div key={link.id} className=\"flex items-center justify-between px-3 py-2 bg-bg-sunken rounded-md\">\n <div className=\"flex items-center gap-3\">\n <DatabaseIcon className=\"w-4 h-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {link.dataSink?.name || link.dataSink?.key || link.dataSinkId}\n </p>\n {link.dataSink?.key && <p className=\"text-xs text-text-secondary font-mono\">{link.dataSink.key}</p>}\n </div>\n </div>\n <div className=\"flex items-center gap-4\">\n <div className=\"flex items-center gap-2\">\n {link.isEnabled ? (\n <span className=\"text-xs text-status-success-text\">Enabled</span>\n ) : (\n <span className=\"text-xs text-text-secondary\">Disabled</span>\n )}\n <span className=\"text-xs text-text-secondary\">Priority: {link.priority}</span>\n </div>\n {link.dataSink && (\n <button\n type=\"button\"\n onClick={() => handleViewDataSink(link.dataSinkId)}\n className=\"text-xs text-action-primary-bg hover:underline\"\n >\n View\n </button>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n\n {/* Timestamps */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-6\">\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Created</h3>\n <p className=\"text-sm text-text-primary\">\n {formatDistanceToNow(new Date(workflow.createdAt), { addSuffix: true })}\n </p>\n <p className=\"text-xs text-text-secondary\">by {workflow.createdBy}</p>\n </div>\n <div className=\"bg-bg-surface border border-border-default rounded-lg p-4\">\n <h3 className=\"text-sm font-medium text-text-secondary mb-2\">Last Updated</h3>\n <p className=\"text-sm text-text-primary\">\n {formatDistanceToNow(new Date(workflow.updatedAt), { addSuffix: true })}\n </p>\n <p className=\"text-xs text-text-secondary\">by {workflow.updatedBy || workflow.createdBy}</p>\n </div>\n </div>\n\n {/* Delete Confirmation Dialog */}\n {workflow && (\n <WorkflowDeleteDialog\n workflow={workflow}\n isOpen={showDeleteConfirm}\n onClose={() => setShowDeleteConfirm(false)}\n onConfirm={handleDelete}\n />\n )}\n </div>\n );\n});\n\nexport default WorkflowViewPage;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAM,KAAiB,EAAE,mBACvB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,QAAO;CAAe,SAAQ;WACnE,kBAAC,QAAD;EAAM,eAAc;EAAQ,gBAAe;EAAQ,aAAa;EAAG,GAAE;EAAoB,CAAA;CACrF,CAAA,EAGF,KAAY,EAAE,mBAClB,kBAAC,OAAD;CAAgB;CAAW,MAAK;CAAO,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L,KACC,kBAAC,GAAD;IACY;IACV,QAAQ;IACR,eAAe,EAAqB,GAAM;IAC1C,WAAW;IACX,CAAA;GAEA;;EAER"}
@@ -406,7 +406,7 @@ var d = new s.HostConfig({
406
406
  })
407
407
  }),
408
408
  /* @__PURE__ */ a("p", {
409
- className: "font-medium text-state-error",
409
+ className: "font-medium text-status-error-text",
410
410
  children: "Error rendering card"
411
411
  }),
412
412
  /* @__PURE__ */ a("p", {
@@ -1 +1 @@
1
- {"version":3,"file":"AdaptiveCardRenderer.js","names":[],"sources":["../../../../src/bigconsole/renderers/adapters/AdaptiveCardRenderer.tsx"],"sourcesContent":["/**\n * Adaptive Card Renderer (v2.1)\n *\n * Renders widgets using the official Microsoft Adaptive Cards SDK.\n * Based on patterns from https://github.com/microsoft/AdaptiveCards\n *\n * Supports full template binding with data context including:\n * - Nested object access: ${creator.name}\n * - Array iteration with $data\n * - Conditional rendering with $when\n * - Date formatting: {{DATE(${field},SHORT)}}\n * - All Adaptive Card elements and actions\n * - Markdown rendering in TextBlocks\n *\n * @see https://adaptivecards.io/\n */\n\nimport React, { memo, useEffect, useRef, useCallback, useState } from 'react';\nimport * as AdaptiveCards from 'adaptivecards';\nimport type { RendererProps } from '../types/renderer';\n\n// Type for the templating module\ntype ACDataModule = typeof import('adaptivecards-templating');\n\n// ============================================================================\n// Fallback Template Expansion (when adaptivecards-templating fails)\n// ============================================================================\n\n/**\n * Simple template expansion fallback.\n * Handles basic ${property}, ${object.property} syntax, and $data iteration.\n * Used when adaptivecards-templating library fails to load.\n */\nfunction expandTemplateFallback(\n template: unknown,\n data: Record<string, unknown>,\n rootData?: Record<string, unknown>\n): unknown {\n // Keep reference to root data for nested expansions\n const root = rootData || data;\n\n if (typeof template === 'string') {\n // Replace ${property} patterns\n return template.replace(/\\$\\{([^}]+)\\}/g, (match, path) => {\n const trimmedPath = path.trim();\n // Try current data first, then root data\n let value = getNestedValue(data, trimmedPath);\n if (value === undefined && root !== data) {\n value = getNestedValue(root, trimmedPath);\n }\n return value !== undefined ? String(value) : match;\n });\n }\n\n if (Array.isArray(template)) {\n return template.flatMap((item) => {\n const expanded = expandTemplateFallback(item, data, root);\n return Array.isArray(expanded) ? expanded : [expanded];\n });\n }\n\n if (template && typeof template === 'object') {\n const templateObj = template as Record<string, unknown>;\n\n // Handle $data iteration\n if ('$data' in templateObj) {\n const dataPath = templateObj.$data;\n let arrayData: unknown[] = [];\n\n if (typeof dataPath === 'string') {\n // Extract array path from ${arrayName} pattern\n const match = dataPath.match(/^\\$\\{([^}]+)\\}$/);\n if (match) {\n const arrValue = getNestedValue(data, match[1].trim()) || getNestedValue(root, match[1].trim());\n if (Array.isArray(arrValue)) {\n arrayData = arrValue;\n }\n }\n } else if (Array.isArray(dataPath)) {\n arrayData = dataPath;\n }\n\n if (arrayData.length > 0) {\n // Create a copy of template without $data for each array item\n const templateWithoutData = Object.fromEntries(Object.entries(templateObj).filter(([key]) => key !== '$data'));\n return arrayData.map((item) => {\n const itemData =\n typeof item === 'object' && item !== null ? (item as Record<string, unknown>) : { value: item };\n // Merge item data with root data for nested references\n const mergedData = { ...root, ...itemData };\n return expandTemplateFallback(templateWithoutData, mergedData, root);\n });\n }\n }\n\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(templateObj)) {\n if (key === '$data') continue; // Already handled above\n if (key === '$when') continue; // Skip conditional rendering in fallback\n result[key] = expandTemplateFallback(value, data, root);\n }\n return result;\n }\n\n return template;\n}\n\n/**\n * Get nested property value from object using dot notation.\n * e.g., getNestedValue({a: {b: 1}}, 'a.b') => 1\n */\nfunction getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.');\n let current: unknown = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return undefined;\n if (typeof current !== 'object') return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n\n// ============================================================================\n// Markdown Processing Setup (from official adaptivecards-react)\n// ============================================================================\n\n/**\n * Simple markdown processor for Adaptive Cards.\n * Handles basic markdown syntax: **bold**, *italic*, [links](url), `code`\n */\nconst processMarkdown = (text: string): string => {\n if (!text) return '';\n\n const html = text\n // Escape HTML first\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n // Bold: **text** or __text__\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/__(.+?)__/g, '<strong>$1</strong>')\n // Italic: *text* or _text_\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>')\n .replace(/_(.+?)_/g, '<em>$1</em>')\n // Code: `code`\n .replace(\n /`(.+?)`/g,\n '<code style=\"background:#f3f4f6;padding:0.125rem 0.25rem;border-radius:0.25rem;font-family:monospace;\">$1</code>'\n )\n // Links: [text](url)\n .replace(\n /\\[(.+?)\\]\\((.+?)\\)/g,\n '<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color:#2563eb;text-decoration:underline;\">$1</a>'\n )\n // Line breaks\n .replace(/\\n/g, '<br/>');\n\n return html;\n};\n\n// Set up global markdown processor for Adaptive Cards\nif (!AdaptiveCards.AdaptiveCard.onProcessMarkdown) {\n AdaptiveCards.AdaptiveCard.onProcessMarkdown = (text, result) => {\n result.outputHtml = processMarkdown(text);\n result.didProcess = true;\n };\n}\n\n// ============================================================================\n// Host Config - Customize Adaptive Card appearance\n// ============================================================================\n\nconst hostConfig = new AdaptiveCards.HostConfig({\n fontFamily: 'Inter, system-ui, -apple-system, sans-serif',\n containerStyles: {\n default: {\n backgroundColor: '#ffffff',\n foregroundColors: {\n default: {\n default: '#1f2937',\n subtle: '#6b7280',\n },\n accent: {\n default: '#2563eb',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#dc2626',\n subtle: '#ef4444',\n },\n good: {\n default: '#16a34a',\n subtle: '#22c55e',\n },\n warning: {\n default: '#d97706',\n subtle: '#f59e0b',\n },\n light: {\n default: '#9ca3af',\n subtle: '#d1d5db',\n },\n dark: {\n default: '#111827',\n subtle: '#374151',\n },\n },\n },\n emphasis: {\n backgroundColor: '#f3f4f6',\n foregroundColors: {\n default: {\n default: '#1f2937',\n subtle: '#6b7280',\n },\n accent: {\n default: '#2563eb',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#dc2626',\n subtle: '#ef4444',\n },\n good: {\n default: '#16a34a',\n subtle: '#22c55e',\n },\n warning: {\n default: '#d97706',\n subtle: '#f59e0b',\n },\n light: {\n default: '#9ca3af',\n subtle: '#d1d5db',\n },\n dark: {\n default: '#111827',\n subtle: '#374151',\n },\n },\n },\n },\n spacing: {\n small: 4,\n default: 8,\n medium: 12,\n large: 16,\n extraLarge: 24,\n padding: 16,\n },\n separator: {\n lineThickness: 1,\n lineColor: '#e5e7eb',\n },\n imageSizes: {\n small: 40,\n medium: 80,\n large: 160,\n },\n actions: {\n maxActions: 5,\n spacing: AdaptiveCards.Spacing.Default,\n buttonSpacing: 8,\n showCard: {\n actionMode: AdaptiveCards.ShowCardActionMode.Inline,\n inlineTopMargin: 12,\n },\n actionsOrientation: AdaptiveCards.Orientation.Horizontal,\n actionAlignment: AdaptiveCards.ActionAlignment.Left,\n },\n adaptiveCard: {\n allowCustomStyle: true,\n },\n textBlock: {\n headingLevel: 2,\n },\n factSet: {\n title: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: true,\n weight: AdaptiveCards.TextWeight.Bolder,\n wrap: true,\n },\n value: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: false,\n weight: AdaptiveCards.TextWeight.Default,\n wrap: true,\n },\n spacing: 8,\n },\n});\n\n// Dark mode host config - duplicating base config with dark overrides\nconst darkHostConfig = new AdaptiveCards.HostConfig({\n fontFamily: 'Inter, system-ui, -apple-system, sans-serif',\n spacing: {\n small: 4,\n default: 8,\n medium: 12,\n large: 16,\n extraLarge: 24,\n padding: 16,\n },\n imageSizes: {\n small: 40,\n medium: 80,\n large: 160,\n },\n actions: {\n maxActions: 5,\n spacing: AdaptiveCards.Spacing.Default,\n buttonSpacing: 8,\n showCard: {\n actionMode: AdaptiveCards.ShowCardActionMode.Inline,\n inlineTopMargin: 12,\n },\n actionsOrientation: AdaptiveCards.Orientation.Horizontal,\n actionAlignment: AdaptiveCards.ActionAlignment.Left,\n },\n adaptiveCard: {\n allowCustomStyle: true,\n },\n textBlock: {\n headingLevel: 2,\n },\n factSet: {\n title: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: true,\n weight: AdaptiveCards.TextWeight.Bolder,\n wrap: true,\n },\n value: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: false,\n weight: AdaptiveCards.TextWeight.Default,\n wrap: true,\n },\n spacing: 8,\n },\n containerStyles: {\n default: {\n backgroundColor: '#111827',\n foregroundColors: {\n default: {\n default: '#f9fafb',\n subtle: '#9ca3af',\n },\n accent: {\n default: '#60a5fa',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#f87171',\n subtle: '#ef4444',\n },\n good: {\n default: '#4ade80',\n subtle: '#22c55e',\n },\n warning: {\n default: '#fbbf24',\n subtle: '#f59e0b',\n },\n light: {\n default: '#d1d5db',\n subtle: '#9ca3af',\n },\n dark: {\n default: '#f9fafb',\n subtle: '#e5e7eb',\n },\n },\n },\n emphasis: {\n backgroundColor: '#1f2937',\n foregroundColors: {\n default: {\n default: '#f9fafb',\n subtle: '#9ca3af',\n },\n accent: {\n default: '#60a5fa',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#f87171',\n subtle: '#ef4444',\n },\n good: {\n default: '#4ade80',\n subtle: '#22c55e',\n },\n warning: {\n default: '#fbbf24',\n subtle: '#f59e0b',\n },\n light: {\n default: '#d1d5db',\n subtle: '#9ca3af',\n },\n dark: {\n default: '#f9fafb',\n subtle: '#e5e7eb',\n },\n },\n },\n },\n separator: {\n lineThickness: 1,\n lineColor: '#374151',\n },\n});\n\n// ============================================================================\n// Main Renderer Component\n// ============================================================================\n\nexport const AdaptiveCardRenderer: React.FC<RendererProps> = memo(function AdaptiveCardRenderer({\n widget,\n data,\n template,\n isLoading,\n error,\n onAction,\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const cardRef = useRef<AdaptiveCards.AdaptiveCard | null>(null);\n const [renderError, setRenderError] = useState<string | null>(null);\n const [isDarkMode, setIsDarkMode] = useState(false);\n const [templateWarnings, setTemplateWarnings] = useState<string[]>([]);\n const [acDataModule, setAcDataModule] = useState<ACDataModule | null>(null);\n const [templatingError, setTemplatingError] = useState<string | null>(null);\n\n // Load adaptivecards-templating dynamically to avoid Node.js polyfill issues\n useEffect(() => {\n let mounted = true;\n\n import('adaptivecards-templating')\n .then((module) => {\n if (mounted) {\n setAcDataModule(module);\n }\n })\n .catch((err) => {\n if (mounted) {\n setTemplatingError(err.message || 'Failed to load templating library');\n }\n });\n\n return () => {\n mounted = false;\n };\n }, []);\n\n // Detect dark mode\n useEffect(() => {\n const checkDarkMode = () => {\n setIsDarkMode(document.documentElement.classList.contains('dark'));\n };\n checkDarkMode();\n\n // Watch for changes\n const observer = new MutationObserver(checkDarkMode);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return () => observer.disconnect();\n }, []);\n\n // Handle action execution\n const handleAction = useCallback(\n (action: AdaptiveCards.Action) => {\n if (action instanceof AdaptiveCards.OpenUrlAction) {\n // Open URL in new tab\n if (action.url) {\n window.open(action.url, '_blank', 'noopener,noreferrer');\n }\n } else if (action instanceof AdaptiveCards.SubmitAction) {\n // Call onAction callback with action data\n if (onAction) {\n onAction(action.title || 'submit', (action.data as Record<string, unknown>) || {});\n }\n } else if (action instanceof AdaptiveCards.ExecuteAction) {\n // Call onAction callback with verb and data\n if (onAction) {\n onAction(action.verb || 'execute', (action.data as Record<string, unknown>) || {});\n }\n } else if (action instanceof AdaptiveCards.ShowCardAction) {\n // ShowCard is handled inline by the SDK\n } else {\n }\n },\n [onAction]\n );\n\n // Render the Adaptive Card\n useEffect(() => {\n if (!containerRef.current) return;\n if (isLoading) return;\n\n // Clear previous content safely\n containerRef.current.innerHTML = '';\n setRenderError(null);\n setTemplateWarnings([]);\n\n // Debug logging\n\n try {\n let cardPayload: object | null = null;\n let warnings: string[] = [];\n\n // Determine the card payload\n if (template) {\n // We have a template - use templating engine if available\n const templateObj = typeof template === 'string' ? JSON.parse(template) : template;\n\n if (acDataModule) {\n try {\n // Create template instance using dynamically loaded module\n const cardTemplate = new acDataModule.Template(templateObj);\n\n // Create evaluation context with data\n // Supports $root for data, $host for host application context\n const context = {\n $root: data || {},\n $host: {\n widgetId: widget?.id,\n widgetTitle: widget?.title,\n theme: isDarkMode ? 'dark' : 'light',\n },\n };\n\n // Expand template with data\n cardPayload = cardTemplate.expand(context);\n\n // Capture any template expansion warnings\n warnings = cardTemplate.getLastTemplateExpansionWarnings();\n if (warnings.length > 0) {\n setTemplateWarnings(warnings);\n }\n } catch (templatingErr) {\n // Templating library threw an error - use fallback\n cardPayload = expandTemplateFallback(templateObj, (data || {}) as Record<string, unknown>) as object;\n warnings.push('Using simplified template expansion (some features may not work)');\n setTemplateWarnings(warnings);\n }\n } else {\n // Templating not available - use fallback expansion\n cardPayload = expandTemplateFallback(templateObj, (data || {}) as Record<string, unknown>) as object;\n if (templatingError) {\n warnings.push(`Using fallback expansion: ${templatingError}`);\n setTemplateWarnings(warnings);\n }\n }\n } else if (data && typeof data === 'object' && 'type' in data && data.type === 'AdaptiveCard') {\n // Data is already an Adaptive Card\n cardPayload = data;\n } else if (data && typeof data === 'object' && 'body' in data) {\n // Data has body property - treat as Adaptive Card\n cardPayload = {\n type: 'AdaptiveCard',\n version: '1.6',\n ...data,\n };\n }\n\n if (!cardPayload) {\n setRenderError('No template or valid Adaptive Card data provided');\n return;\n }\n\n // Create or reuse Adaptive Card instance\n if (!cardRef.current) {\n cardRef.current = new AdaptiveCards.AdaptiveCard();\n }\n const adaptiveCard = cardRef.current;\n\n // Set host config based on theme\n adaptiveCard.hostConfig = isDarkMode ? darkHostConfig : hostConfig;\n\n // Set action handler\n adaptiveCard.onExecuteAction = handleAction;\n\n // Parse the card payload\n adaptiveCard.parse(cardPayload);\n\n // Render to HTML element\n const renderedCard = adaptiveCard.render();\n\n if (renderedCard) {\n // Apply additional styling\n renderedCard.style.height = '100%';\n renderedCard.style.overflow = 'auto';\n\n // Add class for styling consistency\n renderedCard.classList.add('adaptive-card-container');\n\n // Append to container\n containerRef.current.appendChild(renderedCard);\n } else {\n setRenderError('Failed to render Adaptive Card');\n }\n } catch (e) {\n setRenderError((e as Error).message || 'Unknown error rendering card');\n }\n }, [template, data, widget, isLoading, isDarkMode, handleAction, acDataModule, templatingError]);\n\n // Loading state\n if (isLoading) {\n return (\n <div className=\"flex items-center justify-center h-full p-4 animate-in fade-in duration-200\">\n <div className=\"animate-pulse space-y-3 w-full\">\n <div className=\"h-5 bg-bg-sunken rounded w-3/4\" />\n <div className=\"flex gap-3\">\n <div className=\"h-10 w-10 bg-bg-sunken rounded-full\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 bg-bg-sunken rounded w-1/2\" />\n <div className=\"h-3 bg-bg-sunken rounded w-1/3\" />\n </div>\n </div>\n <div className=\"h-4 bg-bg-sunken rounded w-full\" />\n <div className=\"h-4 bg-bg-sunken rounded w-5/6\" />\n <div className=\"grid grid-cols-2 gap-2 mt-4\">\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n </div>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error || renderError) {\n return (\n <div className=\"flex items-center justify-center h-full p-4\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-12 h-12 mx-auto mb-3 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center\">\n <svg\n className=\"w-6 h-6 text-red-600 dark:text-red-400\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <p className=\"font-medium text-state-error\">Error rendering card</p>\n <p className=\"text-sm text-secondary mt-1\">{error || renderError}</p>\n {templateWarnings.length > 0 && (\n <div className=\"mt-3 p-2 bg-yellow-50 dark:bg-yellow-900/20 rounded text-left\">\n <p className=\"text-xs font-medium text-yellow-700 dark:text-yellow-400 mb-1\">Template Warnings:</p>\n {templateWarnings.map((warning, i) => (\n <p key={i} className=\"text-xs text-yellow-600 dark:text-yellow-300\">\n {warning}\n </p>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n }\n\n // Empty state - no template or data\n if (!template && !data) {\n return (\n <div className=\"flex items-center justify-center h-full p-4 animate-in fade-in duration-200\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-12 h-12 mx-auto mb-3 rounded-full bg-bg-sunken flex items-center justify-center\">\n <svg className=\"w-6 h-6 text-text-secondary\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z\"\n />\n </svg>\n </div>\n <p className=\"font-medium text-secondary\">No content</p>\n <p className=\"text-sm text-text-secondary mt-1\">\n Configure a template or provide data to display an Adaptive Card\n </p>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className=\"adaptive-card-wrapper h-full overflow-auto\"\n style={{\n // CSS custom properties for further customization\n ['--ac-font-family' as string]: 'Inter, system-ui, -apple-system, sans-serif',\n }}\n />\n );\n});\n\n// ============================================================================\n// Global Styles for Adaptive Cards\n// ============================================================================\n\n// Inject global styles for Adaptive Cards\nconst styleId = 'adaptive-card-global-styles';\nif (typeof document !== 'undefined' && !document.getElementById(styleId)) {\n const style = document.createElement('style');\n style.id = styleId;\n style.textContent = `\n .adaptive-card-wrapper {\n font-family: Inter, system-ui, -apple-system, sans-serif;\n }\n\n .adaptive-card-wrapper .ac-textBlock {\n font-family: inherit;\n }\n\n .adaptive-card-wrapper .ac-image.ac-image-person {\n border-radius: 50%;\n object-fit: cover;\n }\n\n .adaptive-card-wrapper .ac-pushButton {\n font-family: inherit;\n font-weight: 500;\n border-radius: 0.375rem;\n padding: 0.5rem 1rem;\n transition: all 0.15s ease-in-out;\n }\n\n .adaptive-card-wrapper .ac-pushButton:hover {\n filter: brightness(0.95);\n }\n\n .adaptive-card-wrapper .ac-input {\n font-family: inherit;\n border-radius: 0.375rem;\n border: 1px solid #d1d5db;\n padding: 0.5rem 0.75rem;\n }\n\n .dark .adaptive-card-wrapper .ac-input {\n border-color: #4b5563;\n background-color: #1f2937;\n color: #f9fafb;\n }\n\n .adaptive-card-wrapper .ac-input:focus {\n outline: none;\n ring: 2px;\n ring-color: #3b82f6;\n }\n\n .adaptive-card-wrapper .ac-separator {\n margin: 0.5rem 0;\n }\n\n .adaptive-card-wrapper .ac-factSet {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 0.25rem 1rem;\n }\n\n .adaptive-card-wrapper .ac-fact-title {\n color: #6b7280;\n }\n\n .dark .adaptive-card-wrapper .ac-fact-title {\n color: #9ca3af;\n }\n\n .adaptive-card-wrapper .ac-actionSet {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 1rem;\n padding-top: 1rem;\n border-top: 1px solid #e5e7eb;\n }\n\n .dark .adaptive-card-wrapper .ac-actionSet {\n border-top-color: #374151;\n }\n\n /* Markdown rendered code blocks in dark mode */\n .dark .adaptive-card-wrapper code {\n background: #374151 !important;\n color: #f9fafb !important;\n }\n\n /* Markdown links in dark mode */\n .dark .adaptive-card-wrapper a {\n color: #60a5fa !important;\n }\n\n /* TextBlock with markdown - ensure proper wrapping */\n .adaptive-card-wrapper .ac-textBlock p {\n margin: 0;\n }\n\n .adaptive-card-wrapper .ac-textBlock strong {\n font-weight: 600;\n }\n\n .adaptive-card-wrapper .ac-textBlock em {\n font-style: italic;\n }\n `;\n document.head.appendChild(style);\n}\n\nexport default AdaptiveCardRenderer;\n"],"mappings":";;;;AAiCA,SAAS,EACP,GACA,GACA,GACS;CAET,IAAM,IAAO,KAAY;AAEzB,KAAI,OAAO,KAAa,SAEtB,QAAO,EAAS,QAAQ,mBAAmB,GAAO,MAAS;EACzD,IAAM,IAAc,EAAK,MAAM,EAE3B,IAAQ,EAAe,GAAM,EAAY;AAI7C,SAHI,MAAU,KAAA,KAAa,MAAS,MAClC,IAAQ,EAAe,GAAM,EAAY,GAEpC,MAAU,KAAA,IAA4B,IAAhB,OAAO,EAAM;GAC1C;AAGJ,KAAI,MAAM,QAAQ,EAAS,CACzB,QAAO,EAAS,SAAS,MAAS;EAChC,IAAM,IAAW,EAAuB,GAAM,GAAM,EAAK;AACzD,SAAO,MAAM,QAAQ,EAAS,GAAG,IAAW,CAAC,EAAS;GACtD;AAGJ,KAAI,KAAY,OAAO,KAAa,UAAU;EAC5C,IAAM,IAAc;AAGpB,MAAI,WAAW,GAAa;GAC1B,IAAM,IAAW,EAAY,OACzB,IAAuB,EAAE;AAE7B,OAAI,OAAO,KAAa,UAAU;IAEhC,IAAM,IAAQ,EAAS,MAAM,kBAAkB;AAC/C,QAAI,GAAO;KACT,IAAM,IAAW,EAAe,GAAM,EAAM,GAAG,MAAM,CAAC,IAAI,EAAe,GAAM,EAAM,GAAG,MAAM,CAAC;AAC/F,KAAI,MAAM,QAAQ,EAAS,KACzB,IAAY;;UAGP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AAG,WAAU;eAA+B;KAAwB,CAAA;IACpE,kBAAC,KAAD;KAAG,WAAU;eAA+B,KAAS;KAAgB,CAAA;IACpE,EAAiB,SAAS,KACzB,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,KAAD;MAAG,WAAU;gBAAgE;MAAsB,CAAA,EAClG,EAAiB,KAAK,GAAS,MAC9B,kBAAC,KAAD;MAAW,WAAU;gBAClB;MACC,EAFI,EAEJ,CACJ,CACE;;IAEJ;;EACF,CAAA,GAKN,CAAC,KAAY,CAAC,IAEd,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,OAAD;MAAK,WAAU;MAA8B,MAAK;MAAO,SAAQ;MAAY,QAAO;gBAClF,kBAAC,QAAD;OACE,eAAc;OACd,gBAAe;OACf,aAAa;OACb,GAAE;OACF,CAAA;MACE,CAAA;KACF,CAAA;IACN,kBAAC,KAAD;KAAG,WAAU;eAA6B;KAAc,CAAA;IACxD,kBAAC,KAAD;KAAG,WAAU;eAAmC;KAE5C,CAAA;IACA;;EACF,CAAA,GAKR,kBAAC,OAAD;EACE,KAAK;EACL,WAAU;EACV,OAAO,EAEJ,oBAA+B,+CACjC;EACD,CAAA;EAEJ,EAOI,IAAU;AAChB,IAAI,OAAO,WAAa,OAAe,CAAC,SAAS,eAAe,EAAQ,EAAE;CACxE,IAAM,IAAQ,SAAS,cAAc,QAAQ;AAsG7C,CArGA,EAAM,KAAK,GACX,EAAM,cAAc,2xEAoGpB,SAAS,KAAK,YAAY,EAAM"}
1
+ {"version":3,"file":"AdaptiveCardRenderer.js","names":[],"sources":["../../../../src/bigconsole/renderers/adapters/AdaptiveCardRenderer.tsx"],"sourcesContent":["/**\n * Adaptive Card Renderer (v2.1)\n *\n * Renders widgets using the official Microsoft Adaptive Cards SDK.\n * Based on patterns from https://github.com/microsoft/AdaptiveCards\n *\n * Supports full template binding with data context including:\n * - Nested object access: ${creator.name}\n * - Array iteration with $data\n * - Conditional rendering with $when\n * - Date formatting: {{DATE(${field},SHORT)}}\n * - All Adaptive Card elements and actions\n * - Markdown rendering in TextBlocks\n *\n * @see https://adaptivecards.io/\n */\n\nimport React, { memo, useEffect, useRef, useCallback, useState } from 'react';\nimport * as AdaptiveCards from 'adaptivecards';\nimport type { RendererProps } from '../types/renderer';\n\n// Type for the templating module\ntype ACDataModule = typeof import('adaptivecards-templating');\n\n// ============================================================================\n// Fallback Template Expansion (when adaptivecards-templating fails)\n// ============================================================================\n\n/**\n * Simple template expansion fallback.\n * Handles basic ${property}, ${object.property} syntax, and $data iteration.\n * Used when adaptivecards-templating library fails to load.\n */\nfunction expandTemplateFallback(\n template: unknown,\n data: Record<string, unknown>,\n rootData?: Record<string, unknown>\n): unknown {\n // Keep reference to root data for nested expansions\n const root = rootData || data;\n\n if (typeof template === 'string') {\n // Replace ${property} patterns\n return template.replace(/\\$\\{([^}]+)\\}/g, (match, path) => {\n const trimmedPath = path.trim();\n // Try current data first, then root data\n let value = getNestedValue(data, trimmedPath);\n if (value === undefined && root !== data) {\n value = getNestedValue(root, trimmedPath);\n }\n return value !== undefined ? String(value) : match;\n });\n }\n\n if (Array.isArray(template)) {\n return template.flatMap((item) => {\n const expanded = expandTemplateFallback(item, data, root);\n return Array.isArray(expanded) ? expanded : [expanded];\n });\n }\n\n if (template && typeof template === 'object') {\n const templateObj = template as Record<string, unknown>;\n\n // Handle $data iteration\n if ('$data' in templateObj) {\n const dataPath = templateObj.$data;\n let arrayData: unknown[] = [];\n\n if (typeof dataPath === 'string') {\n // Extract array path from ${arrayName} pattern\n const match = dataPath.match(/^\\$\\{([^}]+)\\}$/);\n if (match) {\n const arrValue = getNestedValue(data, match[1].trim()) || getNestedValue(root, match[1].trim());\n if (Array.isArray(arrValue)) {\n arrayData = arrValue;\n }\n }\n } else if (Array.isArray(dataPath)) {\n arrayData = dataPath;\n }\n\n if (arrayData.length > 0) {\n // Create a copy of template without $data for each array item\n const templateWithoutData = Object.fromEntries(Object.entries(templateObj).filter(([key]) => key !== '$data'));\n return arrayData.map((item) => {\n const itemData =\n typeof item === 'object' && item !== null ? (item as Record<string, unknown>) : { value: item };\n // Merge item data with root data for nested references\n const mergedData = { ...root, ...itemData };\n return expandTemplateFallback(templateWithoutData, mergedData, root);\n });\n }\n }\n\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(templateObj)) {\n if (key === '$data') continue; // Already handled above\n if (key === '$when') continue; // Skip conditional rendering in fallback\n result[key] = expandTemplateFallback(value, data, root);\n }\n return result;\n }\n\n return template;\n}\n\n/**\n * Get nested property value from object using dot notation.\n * e.g., getNestedValue({a: {b: 1}}, 'a.b') => 1\n */\nfunction getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.');\n let current: unknown = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return undefined;\n if (typeof current !== 'object') return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n\n// ============================================================================\n// Markdown Processing Setup (from official adaptivecards-react)\n// ============================================================================\n\n/**\n * Simple markdown processor for Adaptive Cards.\n * Handles basic markdown syntax: **bold**, *italic*, [links](url), `code`\n */\nconst processMarkdown = (text: string): string => {\n if (!text) return '';\n\n const html = text\n // Escape HTML first\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n // Bold: **text** or __text__\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/__(.+?)__/g, '<strong>$1</strong>')\n // Italic: *text* or _text_\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>')\n .replace(/_(.+?)_/g, '<em>$1</em>')\n // Code: `code`\n .replace(\n /`(.+?)`/g,\n '<code style=\"background:#f3f4f6;padding:0.125rem 0.25rem;border-radius:0.25rem;font-family:monospace;\">$1</code>'\n )\n // Links: [text](url)\n .replace(\n /\\[(.+?)\\]\\((.+?)\\)/g,\n '<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color:#2563eb;text-decoration:underline;\">$1</a>'\n )\n // Line breaks\n .replace(/\\n/g, '<br/>');\n\n return html;\n};\n\n// Set up global markdown processor for Adaptive Cards\nif (!AdaptiveCards.AdaptiveCard.onProcessMarkdown) {\n AdaptiveCards.AdaptiveCard.onProcessMarkdown = (text, result) => {\n result.outputHtml = processMarkdown(text);\n result.didProcess = true;\n };\n}\n\n// ============================================================================\n// Host Config - Customize Adaptive Card appearance\n// ============================================================================\n\nconst hostConfig = new AdaptiveCards.HostConfig({\n fontFamily: 'Inter, system-ui, -apple-system, sans-serif',\n containerStyles: {\n default: {\n backgroundColor: '#ffffff',\n foregroundColors: {\n default: {\n default: '#1f2937',\n subtle: '#6b7280',\n },\n accent: {\n default: '#2563eb',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#dc2626',\n subtle: '#ef4444',\n },\n good: {\n default: '#16a34a',\n subtle: '#22c55e',\n },\n warning: {\n default: '#d97706',\n subtle: '#f59e0b',\n },\n light: {\n default: '#9ca3af',\n subtle: '#d1d5db',\n },\n dark: {\n default: '#111827',\n subtle: '#374151',\n },\n },\n },\n emphasis: {\n backgroundColor: '#f3f4f6',\n foregroundColors: {\n default: {\n default: '#1f2937',\n subtle: '#6b7280',\n },\n accent: {\n default: '#2563eb',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#dc2626',\n subtle: '#ef4444',\n },\n good: {\n default: '#16a34a',\n subtle: '#22c55e',\n },\n warning: {\n default: '#d97706',\n subtle: '#f59e0b',\n },\n light: {\n default: '#9ca3af',\n subtle: '#d1d5db',\n },\n dark: {\n default: '#111827',\n subtle: '#374151',\n },\n },\n },\n },\n spacing: {\n small: 4,\n default: 8,\n medium: 12,\n large: 16,\n extraLarge: 24,\n padding: 16,\n },\n separator: {\n lineThickness: 1,\n lineColor: '#e5e7eb',\n },\n imageSizes: {\n small: 40,\n medium: 80,\n large: 160,\n },\n actions: {\n maxActions: 5,\n spacing: AdaptiveCards.Spacing.Default,\n buttonSpacing: 8,\n showCard: {\n actionMode: AdaptiveCards.ShowCardActionMode.Inline,\n inlineTopMargin: 12,\n },\n actionsOrientation: AdaptiveCards.Orientation.Horizontal,\n actionAlignment: AdaptiveCards.ActionAlignment.Left,\n },\n adaptiveCard: {\n allowCustomStyle: true,\n },\n textBlock: {\n headingLevel: 2,\n },\n factSet: {\n title: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: true,\n weight: AdaptiveCards.TextWeight.Bolder,\n wrap: true,\n },\n value: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: false,\n weight: AdaptiveCards.TextWeight.Default,\n wrap: true,\n },\n spacing: 8,\n },\n});\n\n// Dark mode host config - duplicating base config with dark overrides\nconst darkHostConfig = new AdaptiveCards.HostConfig({\n fontFamily: 'Inter, system-ui, -apple-system, sans-serif',\n spacing: {\n small: 4,\n default: 8,\n medium: 12,\n large: 16,\n extraLarge: 24,\n padding: 16,\n },\n imageSizes: {\n small: 40,\n medium: 80,\n large: 160,\n },\n actions: {\n maxActions: 5,\n spacing: AdaptiveCards.Spacing.Default,\n buttonSpacing: 8,\n showCard: {\n actionMode: AdaptiveCards.ShowCardActionMode.Inline,\n inlineTopMargin: 12,\n },\n actionsOrientation: AdaptiveCards.Orientation.Horizontal,\n actionAlignment: AdaptiveCards.ActionAlignment.Left,\n },\n adaptiveCard: {\n allowCustomStyle: true,\n },\n textBlock: {\n headingLevel: 2,\n },\n factSet: {\n title: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: true,\n weight: AdaptiveCards.TextWeight.Bolder,\n wrap: true,\n },\n value: {\n color: AdaptiveCards.TextColor.Default,\n size: AdaptiveCards.TextSize.Default,\n isSubtle: false,\n weight: AdaptiveCards.TextWeight.Default,\n wrap: true,\n },\n spacing: 8,\n },\n containerStyles: {\n default: {\n backgroundColor: '#111827',\n foregroundColors: {\n default: {\n default: '#f9fafb',\n subtle: '#9ca3af',\n },\n accent: {\n default: '#60a5fa',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#f87171',\n subtle: '#ef4444',\n },\n good: {\n default: '#4ade80',\n subtle: '#22c55e',\n },\n warning: {\n default: '#fbbf24',\n subtle: '#f59e0b',\n },\n light: {\n default: '#d1d5db',\n subtle: '#9ca3af',\n },\n dark: {\n default: '#f9fafb',\n subtle: '#e5e7eb',\n },\n },\n },\n emphasis: {\n backgroundColor: '#1f2937',\n foregroundColors: {\n default: {\n default: '#f9fafb',\n subtle: '#9ca3af',\n },\n accent: {\n default: '#60a5fa',\n subtle: '#3b82f6',\n },\n attention: {\n default: '#f87171',\n subtle: '#ef4444',\n },\n good: {\n default: '#4ade80',\n subtle: '#22c55e',\n },\n warning: {\n default: '#fbbf24',\n subtle: '#f59e0b',\n },\n light: {\n default: '#d1d5db',\n subtle: '#9ca3af',\n },\n dark: {\n default: '#f9fafb',\n subtle: '#e5e7eb',\n },\n },\n },\n },\n separator: {\n lineThickness: 1,\n lineColor: '#374151',\n },\n});\n\n// ============================================================================\n// Main Renderer Component\n// ============================================================================\n\nexport const AdaptiveCardRenderer: React.FC<RendererProps> = memo(function AdaptiveCardRenderer({\n widget,\n data,\n template,\n isLoading,\n error,\n onAction,\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const cardRef = useRef<AdaptiveCards.AdaptiveCard | null>(null);\n const [renderError, setRenderError] = useState<string | null>(null);\n const [isDarkMode, setIsDarkMode] = useState(false);\n const [templateWarnings, setTemplateWarnings] = useState<string[]>([]);\n const [acDataModule, setAcDataModule] = useState<ACDataModule | null>(null);\n const [templatingError, setTemplatingError] = useState<string | null>(null);\n\n // Load adaptivecards-templating dynamically to avoid Node.js polyfill issues\n useEffect(() => {\n let mounted = true;\n\n import('adaptivecards-templating')\n .then((module) => {\n if (mounted) {\n setAcDataModule(module);\n }\n })\n .catch((err) => {\n if (mounted) {\n setTemplatingError(err.message || 'Failed to load templating library');\n }\n });\n\n return () => {\n mounted = false;\n };\n }, []);\n\n // Detect dark mode\n useEffect(() => {\n const checkDarkMode = () => {\n setIsDarkMode(document.documentElement.classList.contains('dark'));\n };\n checkDarkMode();\n\n // Watch for changes\n const observer = new MutationObserver(checkDarkMode);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return () => observer.disconnect();\n }, []);\n\n // Handle action execution\n const handleAction = useCallback(\n (action: AdaptiveCards.Action) => {\n if (action instanceof AdaptiveCards.OpenUrlAction) {\n // Open URL in new tab\n if (action.url) {\n window.open(action.url, '_blank', 'noopener,noreferrer');\n }\n } else if (action instanceof AdaptiveCards.SubmitAction) {\n // Call onAction callback with action data\n if (onAction) {\n onAction(action.title || 'submit', (action.data as Record<string, unknown>) || {});\n }\n } else if (action instanceof AdaptiveCards.ExecuteAction) {\n // Call onAction callback with verb and data\n if (onAction) {\n onAction(action.verb || 'execute', (action.data as Record<string, unknown>) || {});\n }\n } else if (action instanceof AdaptiveCards.ShowCardAction) {\n // ShowCard is handled inline by the SDK\n } else {\n }\n },\n [onAction]\n );\n\n // Render the Adaptive Card\n useEffect(() => {\n if (!containerRef.current) return;\n if (isLoading) return;\n\n // Clear previous content safely\n containerRef.current.innerHTML = '';\n setRenderError(null);\n setTemplateWarnings([]);\n\n // Debug logging\n\n try {\n let cardPayload: object | null = null;\n let warnings: string[] = [];\n\n // Determine the card payload\n if (template) {\n // We have a template - use templating engine if available\n const templateObj = typeof template === 'string' ? JSON.parse(template) : template;\n\n if (acDataModule) {\n try {\n // Create template instance using dynamically loaded module\n const cardTemplate = new acDataModule.Template(templateObj);\n\n // Create evaluation context with data\n // Supports $root for data, $host for host application context\n const context = {\n $root: data || {},\n $host: {\n widgetId: widget?.id,\n widgetTitle: widget?.title,\n theme: isDarkMode ? 'dark' : 'light',\n },\n };\n\n // Expand template with data\n cardPayload = cardTemplate.expand(context);\n\n // Capture any template expansion warnings\n warnings = cardTemplate.getLastTemplateExpansionWarnings();\n if (warnings.length > 0) {\n setTemplateWarnings(warnings);\n }\n } catch (templatingErr) {\n // Templating library threw an error - use fallback\n cardPayload = expandTemplateFallback(templateObj, (data || {}) as Record<string, unknown>) as object;\n warnings.push('Using simplified template expansion (some features may not work)');\n setTemplateWarnings(warnings);\n }\n } else {\n // Templating not available - use fallback expansion\n cardPayload = expandTemplateFallback(templateObj, (data || {}) as Record<string, unknown>) as object;\n if (templatingError) {\n warnings.push(`Using fallback expansion: ${templatingError}`);\n setTemplateWarnings(warnings);\n }\n }\n } else if (data && typeof data === 'object' && 'type' in data && data.type === 'AdaptiveCard') {\n // Data is already an Adaptive Card\n cardPayload = data;\n } else if (data && typeof data === 'object' && 'body' in data) {\n // Data has body property - treat as Adaptive Card\n cardPayload = {\n type: 'AdaptiveCard',\n version: '1.6',\n ...data,\n };\n }\n\n if (!cardPayload) {\n setRenderError('No template or valid Adaptive Card data provided');\n return;\n }\n\n // Create or reuse Adaptive Card instance\n if (!cardRef.current) {\n cardRef.current = new AdaptiveCards.AdaptiveCard();\n }\n const adaptiveCard = cardRef.current;\n\n // Set host config based on theme\n adaptiveCard.hostConfig = isDarkMode ? darkHostConfig : hostConfig;\n\n // Set action handler\n adaptiveCard.onExecuteAction = handleAction;\n\n // Parse the card payload\n adaptiveCard.parse(cardPayload);\n\n // Render to HTML element\n const renderedCard = adaptiveCard.render();\n\n if (renderedCard) {\n // Apply additional styling\n renderedCard.style.height = '100%';\n renderedCard.style.overflow = 'auto';\n\n // Add class for styling consistency\n renderedCard.classList.add('adaptive-card-container');\n\n // Append to container\n containerRef.current.appendChild(renderedCard);\n } else {\n setRenderError('Failed to render Adaptive Card');\n }\n } catch (e) {\n setRenderError((e as Error).message || 'Unknown error rendering card');\n }\n }, [template, data, widget, isLoading, isDarkMode, handleAction, acDataModule, templatingError]);\n\n // Loading state\n if (isLoading) {\n return (\n <div className=\"flex items-center justify-center h-full p-4 animate-in fade-in duration-200\">\n <div className=\"animate-pulse space-y-3 w-full\">\n <div className=\"h-5 bg-bg-sunken rounded w-3/4\" />\n <div className=\"flex gap-3\">\n <div className=\"h-10 w-10 bg-bg-sunken rounded-full\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 bg-bg-sunken rounded w-1/2\" />\n <div className=\"h-3 bg-bg-sunken rounded w-1/3\" />\n </div>\n </div>\n <div className=\"h-4 bg-bg-sunken rounded w-full\" />\n <div className=\"h-4 bg-bg-sunken rounded w-5/6\" />\n <div className=\"grid grid-cols-2 gap-2 mt-4\">\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n <div className=\"h-3 bg-bg-sunken rounded\" />\n </div>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error || renderError) {\n return (\n <div className=\"flex items-center justify-center h-full p-4\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-12 h-12 mx-auto mb-3 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center\">\n <svg\n className=\"w-6 h-6 text-red-600 dark:text-red-400\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <p className=\"font-medium text-status-error-text\">Error rendering card</p>\n <p className=\"text-sm text-secondary mt-1\">{error || renderError}</p>\n {templateWarnings.length > 0 && (\n <div className=\"mt-3 p-2 bg-yellow-50 dark:bg-yellow-900/20 rounded text-left\">\n <p className=\"text-xs font-medium text-yellow-700 dark:text-yellow-400 mb-1\">Template Warnings:</p>\n {templateWarnings.map((warning, i) => (\n <p key={i} className=\"text-xs text-yellow-600 dark:text-yellow-300\">\n {warning}\n </p>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n }\n\n // Empty state - no template or data\n if (!template && !data) {\n return (\n <div className=\"flex items-center justify-center h-full p-4 animate-in fade-in duration-200\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-12 h-12 mx-auto mb-3 rounded-full bg-bg-sunken flex items-center justify-center\">\n <svg className=\"w-6 h-6 text-text-secondary\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z\"\n />\n </svg>\n </div>\n <p className=\"font-medium text-secondary\">No content</p>\n <p className=\"text-sm text-text-secondary mt-1\">\n Configure a template or provide data to display an Adaptive Card\n </p>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className=\"adaptive-card-wrapper h-full overflow-auto\"\n style={{\n // CSS custom properties for further customization\n ['--ac-font-family' as string]: 'Inter, system-ui, -apple-system, sans-serif',\n }}\n />\n );\n});\n\n// ============================================================================\n// Global Styles for Adaptive Cards\n// ============================================================================\n\n// Inject global styles for Adaptive Cards\nconst styleId = 'adaptive-card-global-styles';\nif (typeof document !== 'undefined' && !document.getElementById(styleId)) {\n const style = document.createElement('style');\n style.id = styleId;\n style.textContent = `\n .adaptive-card-wrapper {\n font-family: Inter, system-ui, -apple-system, sans-serif;\n }\n\n .adaptive-card-wrapper .ac-textBlock {\n font-family: inherit;\n }\n\n .adaptive-card-wrapper .ac-image.ac-image-person {\n border-radius: 50%;\n object-fit: cover;\n }\n\n .adaptive-card-wrapper .ac-pushButton {\n font-family: inherit;\n font-weight: 500;\n border-radius: 0.375rem;\n padding: 0.5rem 1rem;\n transition: all 0.15s ease-in-out;\n }\n\n .adaptive-card-wrapper .ac-pushButton:hover {\n filter: brightness(0.95);\n }\n\n .adaptive-card-wrapper .ac-input {\n font-family: inherit;\n border-radius: 0.375rem;\n border: 1px solid #d1d5db;\n padding: 0.5rem 0.75rem;\n }\n\n .dark .adaptive-card-wrapper .ac-input {\n border-color: #4b5563;\n background-color: #1f2937;\n color: #f9fafb;\n }\n\n .adaptive-card-wrapper .ac-input:focus {\n outline: none;\n ring: 2px;\n ring-color: #3b82f6;\n }\n\n .adaptive-card-wrapper .ac-separator {\n margin: 0.5rem 0;\n }\n\n .adaptive-card-wrapper .ac-factSet {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 0.25rem 1rem;\n }\n\n .adaptive-card-wrapper .ac-fact-title {\n color: #6b7280;\n }\n\n .dark .adaptive-card-wrapper .ac-fact-title {\n color: #9ca3af;\n }\n\n .adaptive-card-wrapper .ac-actionSet {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 1rem;\n padding-top: 1rem;\n border-top: 1px solid #e5e7eb;\n }\n\n .dark .adaptive-card-wrapper .ac-actionSet {\n border-top-color: #374151;\n }\n\n /* Markdown rendered code blocks in dark mode */\n .dark .adaptive-card-wrapper code {\n background: #374151 !important;\n color: #f9fafb !important;\n }\n\n /* Markdown links in dark mode */\n .dark .adaptive-card-wrapper a {\n color: #60a5fa !important;\n }\n\n /* TextBlock with markdown - ensure proper wrapping */\n .adaptive-card-wrapper .ac-textBlock p {\n margin: 0;\n }\n\n .adaptive-card-wrapper .ac-textBlock strong {\n font-weight: 600;\n }\n\n .adaptive-card-wrapper .ac-textBlock em {\n font-style: italic;\n }\n `;\n document.head.appendChild(style);\n}\n\nexport default AdaptiveCardRenderer;\n"],"mappings":";;;;AAiCA,SAAS,EACP,GACA,GACA,GACS;CAET,IAAM,IAAO,KAAY;AAEzB,KAAI,OAAO,KAAa,SAEtB,QAAO,EAAS,QAAQ,mBAAmB,GAAO,MAAS;EAC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AD;OACE,eAAc;OACd,gBAAe;OACf,aAAa;OACb,GAAE;OACF,CAAA;MACE,CAAA;KACF,CAAA;IACN,kBAAC,KAAD;KAAG,WAAU;eAA6B;KAAc,CAAA;IACxD,kBAAC,KAAD;KAAG,WAAU;eAAmC;KAE5C,CAAA;IACA;;EACF,CAAA,GAKR,kBAAC,OAAD;EACE,KAAK;EACL,WAAU;EACV,OAAO,EAEJ,oBAA+B,+CACjC;EACD,CAAA;EAEJ,EAOI,IAAU;AAChB,IAAI,OAAO,WAAa,OAAe,CAAC,SAAS,eAAe,EAAQ,EAAE;CACxE,IAAM,IAAQ,SAAS,cAAc,QAAQ;AAsG7C,CArGA,EAAM,KAAK,GACX,EAAM,cAAc,2xEAoGpB,SAAS,KAAK,YAAY,EAAM"}
@@ -65,8 +65,8 @@ function o(t) {
65
65
  }
66
66
  function s(e) {
67
67
  switch (e) {
68
- case "primary": return "bg-state-success hover:bg-state-success/90 text-white transition-colors";
69
- case "danger": return "bg-state-error hover:bg-state-error/90 text-white transition-colors";
68
+ case "primary": return "bg-status-success-bg hover:bg-status-success-bg/90 text-white transition-colors";
69
+ case "danger": return "bg-status-error-bg hover:bg-status-error-bg/90 text-white transition-colors";
70
70
  default: return "bg-bg-sunken hover:bg-bg-sunken/80 text-primary transition-colors";
71
71
  }
72
72
  }