@decido/shell 1.0.0 → 4.0.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 (209) hide show
  1. package/README.md +31 -0
  2. package/package.json +27 -18
  3. package/.turbo/turbo-build.log +0 -13
  4. package/src/AgentPlayer.tsx +0 -105
  5. package/src/DecidoPlayer.tsx +0 -117
  6. package/src/bridge/BridgeAgent.ts +0 -443
  7. package/src/components/DecidoIcon.tsx +0 -56
  8. package/src/components/JsonTreeEditor.tsx +0 -117
  9. package/src/components/PanelSplitter.tsx +0 -71
  10. package/src/components/PluginErrorBoundary.tsx +0 -69
  11. package/src/components/SafeLiquidUI.tsx +0 -114
  12. package/src/components/TransientLayer.tsx +0 -92
  13. package/src/components/agent/AgentChat.tsx +0 -134
  14. package/src/components/chat-extensions/IntentCatalogPanel.tsx +0 -81
  15. package/src/components/chat-extensions/chatSlashCommands.ts +0 -101
  16. package/src/components/controls/CreatorInputBar.tsx +0 -144
  17. package/src/components/controls/OSToolbar.tsx +0 -90
  18. package/src/components/controls/TimelineTape.tsx +0 -43
  19. package/src/components/debug/ActionTimelineTab.tsx +0 -111
  20. package/src/components/debug/CSSInspectorTab.tsx +0 -436
  21. package/src/components/debug/ExportTab.tsx +0 -192
  22. package/src/components/debug/FlowHealthTab.tsx +0 -86
  23. package/src/components/debug/LogsTab.tsx +0 -110
  24. package/src/components/debug/MorphStackTab.tsx +0 -241
  25. package/src/components/debug/NetworkTab.tsx +0 -173
  26. package/src/components/debug/PerformanceTab.tsx +0 -171
  27. package/src/components/debug/ProfilesTab.tsx +0 -238
  28. package/src/components/debug/ReplayTab.tsx +0 -70
  29. package/src/components/debug/StoresTab.tsx +0 -255
  30. package/src/components/debug/TopologyTab.tsx +0 -59
  31. package/src/components/debug/debugConfig.tsx +0 -66
  32. package/src/components/playground/DebugPanel.tsx +0 -112
  33. package/src/components/playground/HeaderCenterControls.tsx +0 -92
  34. package/src/components/playground/KeyframeListItem.tsx +0 -70
  35. package/src/components/playground/PlaygroundAppSidebar.tsx +0 -171
  36. package/src/components/playground/PlaygroundBottomControls.tsx +0 -132
  37. package/src/components/playground/PlaygroundCanvas.tsx +0 -87
  38. package/src/components/playground/PlaygroundChat.tsx +0 -236
  39. package/src/components/playground/PlaygroundErrorBoundary.tsx +0 -63
  40. package/src/components/playground/PlaygroundFloatingInput.tsx +0 -352
  41. package/src/components/playground/PlaygroundHeader.tsx +0 -222
  42. package/src/components/playground/PlaygroundSidebar.tsx +0 -136
  43. package/src/components/playground/PlaygroundTerminal.tsx +0 -44
  44. package/src/components/playground/SuggestionCards.tsx +0 -29
  45. package/src/components/playground/demos/ClinicaAINode.tsx +0 -221
  46. package/src/components/playground/demos/FinanceAINode.tsx +0 -226
  47. package/src/components/playground/demos/KiaAcademyNode.tsx +0 -250
  48. package/src/components/playground/demos/KiaBotNode.tsx +0 -207
  49. package/src/components/playground/demos/KiaCampaignNode.tsx +0 -191
  50. package/src/components/playground/demos/KiaComplianceNode.tsx +0 -140
  51. package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +0 -220
  52. package/src/components/playground/demos/KiaCyberNode.tsx +0 -203
  53. package/src/components/playground/demos/KiaDashboardNode.tsx +0 -399
  54. package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +0 -168
  55. package/src/components/playground/demos/KiaExecutiveNode.tsx +0 -169
  56. package/src/components/playground/demos/KiaGamificationNode.tsx +0 -229
  57. package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +0 -165
  58. package/src/components/playground/demos/KiaInventoryNode.tsx +0 -183
  59. package/src/components/playground/demos/KiaLeadScoringNode.tsx +0 -226
  60. package/src/components/playground/demos/KiaLiveSimulationNode.tsx +0 -177
  61. package/src/components/playground/demos/KiaMultiDealerNode.tsx +0 -223
  62. package/src/components/playground/demos/KiaNPSVoiceNode.tsx +0 -214
  63. package/src/components/playground/demos/KiaOmnichannelNode.tsx +0 -162
  64. package/src/components/playground/demos/KiaPBIBudgetNode.tsx +0 -152
  65. package/src/components/playground/demos/KiaPBIConversionNode.tsx +0 -206
  66. package/src/components/playground/demos/KiaPBIFunnelNode.tsx +0 -184
  67. package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +0 -113
  68. package/src/components/playground/demos/KiaPBIPartnerNode.tsx +0 -143
  69. package/src/components/playground/demos/KiaPBIPreciosNode.tsx +0 -120
  70. package/src/components/playground/demos/KiaPBIRuntNode.tsx +0 -205
  71. package/src/components/playground/demos/KiaPartnerScoreNode.tsx +0 -206
  72. package/src/components/playground/demos/KiaPredictiveNode.tsx +0 -226
  73. package/src/components/playground/demos/KiaShowroomNode.tsx +0 -194
  74. package/src/components/playground/demos/KiaStoreNode.tsx +0 -215
  75. package/src/components/playground/demos/KiaSustainabilityNode.tsx +0 -173
  76. package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +0 -163
  77. package/src/components/playground/demos/KiaWorkshopNode.tsx +0 -221
  78. package/src/components/playground/demos/SmartCityNode.tsx +0 -205
  79. package/src/components/playground/demos/kia_campaign_manifest.json +0 -112
  80. package/src/components/playground/input-parts/AIModelSelector.tsx +0 -156
  81. package/src/components/playground/input-parts/InputActions.tsx +0 -80
  82. package/src/components/playground/input-parts/InputToolbar.tsx +0 -245
  83. package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +0 -287
  84. package/src/components/playground/sidebarDsdIO.ts +0 -82
  85. package/src/components/settings/SettingsPanel.tsx +0 -267
  86. package/src/components/shell/AppHeader.tsx +0 -9
  87. package/src/components/shell/AppShell.tsx +0 -139
  88. package/src/components/shell/ArtifactBar.tsx +0 -97
  89. package/src/components/shell/BootScreen.tsx +0 -19
  90. package/src/components/shell/CenterComposite.tsx +0 -87
  91. package/src/components/shell/CodeEditorPanel.tsx +0 -88
  92. package/src/components/shell/GlobalOverlays.tsx +0 -228
  93. package/src/components/shell/LayoutConfigurator.tsx +0 -209
  94. package/src/components/shell/LayoutGrid.tsx +0 -178
  95. package/src/components/shell/MorphShell.tsx +0 -368
  96. package/src/components/shell/PluginViewer.tsx +0 -147
  97. package/src/components/shell/ShellNexusPreview.tsx +0 -458
  98. package/src/components/shell/SlotRenderer.tsx +0 -115
  99. package/src/components/shell/TabBar.tsx +0 -94
  100. package/src/components/shell/TemplateLibrary.tsx +0 -195
  101. package/src/components/shell/layoutConstants.ts +0 -35
  102. package/src/components/shell/morphStageMeta.ts +0 -15
  103. package/src/components/shell/shells/BuiltInShells.tsx +0 -443
  104. package/src/components/shell/shells/DatawayChatShell.tsx +0 -42
  105. package/src/components/shell/shells/TokenPreview.tsx +0 -339
  106. package/src/components/shell/shells/bootShells.ts +0 -31
  107. package/src/components/shells/CreatorShell.tsx +0 -37
  108. package/src/components/shells/DecidoShell.tsx +0 -447
  109. package/src/components/shells/ExperimentalChatShell.tsx +0 -245
  110. package/src/components/shells/UserCanvas.tsx +0 -44
  111. package/src/components/studio/BlueprintManagerPanel.tsx +0 -137
  112. package/src/components/studio/DependencyTreePanel.tsx +0 -192
  113. package/src/components/studio/NodePalette.tsx +0 -92
  114. package/src/components/studio/NodePropertiesPanel.tsx +0 -81
  115. package/src/components/studio/ReactFlowEditor.tsx +0 -242
  116. package/src/components/studio/TimelineEditor.tsx +0 -122
  117. package/src/components/studio/TimelineKeyframeCard.tsx +0 -99
  118. package/src/components/studio/VariablePanel.tsx +0 -181
  119. package/src/components/studio/blueprint/BlueprintCard.tsx +0 -82
  120. package/src/components/studio/editor/CanvasContextMenu.tsx +0 -107
  121. package/src/components/studio/editor/EditorToolbar.tsx +0 -80
  122. package/src/components/studio/editor/StageContentRenderer.tsx +0 -134
  123. package/src/components/studio/editor/TrackPropertyEditors.tsx +0 -133
  124. package/src/components/studio/editor/TreeNodeItem.tsx +0 -91
  125. package/src/components/studio/editor/edgeStyles.ts +0 -43
  126. package/src/components/studio/editor/editorKeyHandler.ts +0 -95
  127. package/src/components/studio/editor/nodeTypeRegistry.ts +0 -137
  128. package/src/components/studio/editor/paletteCatalog.tsx +0 -84
  129. package/src/components/studio/nodes/shell/InteractionNodes.tsx +0 -82
  130. package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +0 -69
  131. package/src/components/studio/nodes/shell/RegisterActionNode.tsx +0 -20
  132. package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +0 -22
  133. package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +0 -19
  134. package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +0 -19
  135. package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +0 -22
  136. package/src/components/studio/nodes/shell/RegisterTabNode.tsx +0 -21
  137. package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +0 -22
  138. package/src/components/studio/nodes/shell/ShellConfigNode.tsx +0 -51
  139. package/src/components/studio/nodes/shell/ShellNodeBase.tsx +0 -100
  140. package/src/components/studio/nodes/shell/ThemeNodes.tsx +0 -51
  141. package/src/components/studio/nodes/shell/index.ts +0 -12
  142. package/src/components/widgets/BroadcastWidget.tsx +0 -93
  143. package/src/components/widgets/MarketplaceWidget.tsx +0 -298
  144. package/src/components/widgets/McpToolsWidget.tsx +0 -231
  145. package/src/components/widgets/OpsDashboard.tsx +0 -59
  146. package/src/components/widgets/QuickActionsWidget.tsx +0 -60
  147. package/src/components/widgets/UsageWidget.tsx +0 -112
  148. package/src/components/widgets/WidgetRenderer.tsx +0 -892
  149. package/src/components/widgets/WidgetSlotPanel.tsx +0 -213
  150. package/src/config/IconRegistry.ts +0 -126
  151. package/src/contexts/NetworkProvider.tsx +0 -162
  152. package/src/core/AIDirector.ts +0 -71
  153. package/src/core/EventBus.ts +0 -37
  154. package/src/core/PluginContext.tsx +0 -141
  155. package/src/hooks/listeners/useUIStateListener.ts +0 -59
  156. package/src/hooks/listeners/useWhatsAppListener.ts +0 -110
  157. package/src/hooks/morphBridge.ts +0 -82
  158. package/src/hooks/useAIModelSelector.ts +0 -144
  159. package/src/hooks/useAgentStream.ts +0 -220
  160. package/src/hooks/useAutoUpdater.ts +0 -89
  161. package/src/hooks/useBootSequence.ts +0 -20
  162. package/src/hooks/useExportDSD.ts +0 -53
  163. package/src/hooks/useFullscreen.ts +0 -35
  164. package/src/hooks/useGeminiStream.ts +0 -282
  165. package/src/hooks/useIntentLens.ts +0 -224
  166. package/src/hooks/useKeyboardShortcuts.ts +0 -69
  167. package/src/hooks/useLoggerBridge.ts +0 -32
  168. package/src/hooks/useMcpClient.ts +0 -112
  169. package/src/hooks/useNexusaiDeploy.ts +0 -118
  170. package/src/hooks/usePlaybackEngine.ts +0 -21
  171. package/src/hooks/usePlaygroundCommander.ts +0 -475
  172. package/src/hooks/usePluginEngine.ts +0 -165
  173. package/src/hooks/useScreenRecorder.ts +0 -73
  174. package/src/hooks/useShellKeyboard.ts +0 -40
  175. package/src/hooks/useShellShortcuts.ts +0 -118
  176. package/src/hooks/useSoundEffects.ts +0 -35
  177. package/src/hooks/useStudioConfig.ts +0 -72
  178. package/src/hooks/useSystemBoot.ts +0 -84
  179. package/src/hooks/useSystemTelemetry.ts +0 -62
  180. package/src/index.ts +0 -97
  181. package/src/lib/debugLogger.ts +0 -80
  182. package/src/lib/networkInterceptor.ts +0 -100
  183. package/src/mocks/decido.tsx +0 -41
  184. package/src/plugins/pluginAPI.ts +0 -190
  185. package/src/store/McpStore.ts +0 -69
  186. package/src/store/UpdaterStore.ts +0 -60
  187. package/src/store/engine.ts +0 -392
  188. package/src/store/index.ts +0 -4
  189. package/src/store/layoutPresets.ts +0 -66
  190. package/src/store/playgroundTypes.ts +0 -98
  191. package/src/store/useActionTimelineStore.ts +0 -48
  192. package/src/store/useDebugPanelStore.ts +0 -98
  193. package/src/store/useDebugProfileStore.ts +0 -130
  194. package/src/store/useLayoutStore.ts +0 -205
  195. package/src/store/useMorphInstanceStore.ts +0 -289
  196. package/src/store/useMorphologyStore.ts +0 -103
  197. package/src/store/usePlaygroundStore.ts +0 -236
  198. package/src/store/useShellRegistry.ts +0 -123
  199. package/src/store/useSuggestionsStore.ts +0 -57
  200. package/src/store/useThemeStore.ts +0 -399
  201. package/src/store/useUIComponentStore.ts +0 -179
  202. package/src/types/DecidoStoryDefinition.ts +0 -43
  203. package/src/utils/ai/ai-architect.ts +0 -92
  204. package/src/utils/ai/ai-code.ts +0 -187
  205. package/src/utils/ai/ai-core.ts +0 -50
  206. package/src/utils/ai/ai-media.ts +0 -292
  207. package/src/utils/layoutGraph.ts +0 -67
  208. package/tsconfig.json +0 -17
  209. package/tsconfig.tsbuildinfo +0 -1
@@ -1,203 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { BaseNode } from '@decido/macia-core';
3
- import {
4
- Shield, AlertTriangle, Lock, Wifi, Activity, Eye, Globe,
5
- Terminal, ShieldCheck, ShieldOff, Server, Radio, Cpu,
6
- FileWarning, Scan, KeyRound
7
- } from 'lucide-react';
8
-
9
- /* ═══════════════════════════════════════════════════════════════
10
- KIA CYBER OPS NODE — CyberSecurity Operations · Grecco Motors
11
- SOC Level 3 con threat intel, lockdown, y modules
12
- ═══════════════════════════════════════════════════════════════ */
13
-
14
- const THREAT_SOURCES = [
15
- { country: 'CN', label: 'China', attempts: 342, color: '#ef4444' },
16
- { country: 'RU', label: 'Rusia', attempts: 198, color: '#f59e0b' },
17
- { country: 'KP', label: 'Corea Norte', attempts: 87, color: '#a855f7' },
18
- { country: 'US', label: 'USA', attempts: 67, color: '#3b82f6' },
19
- { country: 'BR', label: 'Brasil', attempts: 45, color: '#22c55e' },
20
- { country: 'IR', label: 'Irán', attempts: 31, color: '#06b6d4' },
21
- ];
22
-
23
- const LOG_TEMPLATES = [
24
- { level: 'info', msg: 'OTA Update Signature verified — EV6 Fleet Batch #42' },
25
- { level: 'warning', msg: 'Anomalous CAN bus activity — Sportage KIA-5502' },
26
- { level: 'critical', msg: 'Brute force on Kia Connect API — IP 45.33.X.X blocked' },
27
- { level: 'info', msg: 'TLS 1.3 handshake OK — Kia Charge Station CS-02' },
28
- { level: 'warning', msg: 'UDS diagnostic from unauthorized tool — EV9-002' },
29
- { level: 'critical', msg: 'Firmware tampering signature mismatch — ECU #7' },
30
- { level: 'info', msg: 'V2X integrity check passed — Intersection #14' },
31
- { level: 'warning', msg: 'GPS spoofing mitigated — Fleet zone NE' },
32
- { level: 'info', msg: 'Key fob relay attack prevention active — 847 vehicles' },
33
- { level: 'critical', msg: 'SQL injection attempt on CRM endpoint — WAF blocked' },
34
- { level: 'info', msg: 'Certificate rotation complete — Grecco Connect cluster' },
35
- { level: 'warning', msg: 'Unusual data exfiltration pattern — DLP alert L2' },
36
- ];
37
-
38
- const SECURITY_MODULES = [
39
- { icon: ShieldCheck, label: 'Firewall NGF', status: 'active', threats: 1247 },
40
- { icon: Eye, label: 'IDS/IPS', status: 'active', threats: 342 },
41
- { icon: Lock, label: 'E2E Encryption', status: 'active', threats: 0 },
42
- { icon: Wifi, label: 'V2X Guard', status: 'active', threats: 12 },
43
- { icon: Scan, label: 'DLP Scanner', status: 'active', threats: 8 },
44
- { icon: KeyRound, label: 'Zero Trust', status: 'active', threats: 156 },
45
- { icon: FileWarning, label: 'WAF', status: 'active', threats: 89 },
46
- { icon: Cpu, label: 'SIEM/SOAR', status: 'active', threats: 0 },
47
- ];
48
-
49
- export const KiaCyberNode = (props: any) => {
50
- const [logs, setLogs] = useState<{ id: number; time: string; level: string; msg: string }[]>([]);
51
- const [threats, setThreats] = useState(THREAT_SOURCES);
52
- const [lockdown, setLockdown] = useState(false);
53
- const [stats, setStats] = useState({ blocked: 1247, scanned: 98420, uptime: 99.97, incidents: 3 });
54
- const [view, setView] = useState<'overview' | 'modules'>('overview');
55
- const logRef = useRef<HTMLDivElement>(null);
56
-
57
- useEffect(() => {
58
- const interval = setInterval(() => {
59
- const template = LOG_TEMPLATES[Math.floor(Math.random() * LOG_TEMPLATES.length)];
60
- setLogs(prev => [...prev, {
61
- id: Date.now(), time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' }),
62
- ...template,
63
- }].slice(-40));
64
- }, 2000);
65
- return () => clearInterval(interval);
66
- }, []);
67
-
68
- useEffect(() => { if (logRef.current) logRef.current.scrollTop = logRef.current.scrollHeight; }, [logs]);
69
-
70
- useEffect(() => {
71
- const interval = setInterval(() => {
72
- setThreats(prev => prev.map(t => ({ ...t, attempts: t.attempts + Math.floor(Math.random() * 5) })));
73
- setStats(prev => ({
74
- ...prev,
75
- blocked: prev.blocked + Math.floor(Math.random() * 3),
76
- scanned: prev.scanned + Math.floor(Math.random() * 50),
77
- }));
78
- }, 4000);
79
- return () => clearInterval(interval);
80
- }, []);
81
-
82
- const triggerLockdown = () => {
83
- setLockdown(true);
84
- setLogs(prev => [...prev, {
85
- id: Date.now(), time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' }),
86
- level: 'critical', msg: '🔒 LOCKDOWN ACTIVATED — All external connections severed. OTA paused. Fleet isolated.',
87
- }]);
88
- setTimeout(() => setLockdown(false), 5000);
89
- };
90
-
91
- const totalThreats = threats.reduce((a, t) => a + t.attempts, 0);
92
- const maxAttempts = Math.max(...threats.map(t => t.attempts));
93
-
94
- return (
95
- <BaseNode {...props} title="Kia CyberSecurity Operations" width={580} height={600}>
96
- <div className={`flex flex-col h-full bg-[#060a12] text-white overflow-hidden transition-all duration-500 ${lockdown ? 'ring-2 ring-red-500 ring-inset' : ''}`}>
97
-
98
- {/* Header */}
99
- <div className={`flex items-center gap-3 p-3 border-b transition-all ${lockdown ? 'bg-red-900/30 border-red-500/30' : 'bg-[#0c1222] border-slate-800'}`}>
100
- <div className="w-9 h-9 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
101
- <span className="text-red-500 font-bold text-[7px] tracking-widest">KIA</span>
102
- </div>
103
- <div className="flex-1">
104
- <div className="text-xs font-bold tracking-wide flex items-center gap-2">
105
- CYBER OPS CENTER
106
- {lockdown && <span className="text-[9px] bg-red-500 text-white px-1.5 py-0.5 rounded animate-pulse">LOCKDOWN</span>}
107
- </div>
108
- <div className="text-[10px] text-slate-400">Grecco Motors SOC · Level 3 · 24/7</div>
109
- </div>
110
- <div className="flex gap-1">
111
- {(['overview', 'modules'] as const).map(v => (
112
- <button key={v} onClick={() => setView(v)}
113
- className={`px-2 py-1 text-[9px] rounded font-semibold ${view === v ? 'bg-white text-black' : 'bg-slate-800 text-slate-300'}`}>
114
- {v === 'overview' ? '🌐' : '🛡️'} {v.charAt(0).toUpperCase() + v.slice(1)}
115
- </button>
116
- ))}
117
- </div>
118
- <button onClick={triggerLockdown} disabled={lockdown}
119
- className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[10px] font-bold transition-all ${lockdown
120
- ? 'bg-red-500/20 text-red-400 cursor-not-allowed' : 'bg-red-600 hover:bg-red-500 text-white'}`}>
121
- <Lock size={12} /> {lockdown ? 'ACTIVO' : 'LOCKDOWN'}
122
- </button>
123
- </div>
124
-
125
- {/* Stats Bar */}
126
- <div className="flex gap-1.5 p-2 bg-[#0a0f1a] border-b border-slate-800">
127
- {[
128
- { val: stats.blocked.toLocaleString(), label: 'Bloqueados', color: 'red' },
129
- { val: stats.scanned.toLocaleString(), label: 'Escaneados', color: 'green' },
130
- { val: `${stats.uptime}%`, label: 'Uptime', color: 'blue' },
131
- { val: totalThreats.toString(), label: 'Amenazas', color: 'violet' },
132
- { val: stats.incidents.toString(), label: 'Incidentes', color: 'yellow' },
133
- ].map(s => (
134
- <div key={s.label} className={`flex-1 bg-${s.color}-500/5 border border-${s.color}-500/10 rounded p-1.5 text-center`}>
135
- <div className={`text-xs font-bold text-${s.color}-400`}>{s.val}</div>
136
- <div className="text-[8px] text-slate-500">{s.label}</div>
137
- </div>
138
- ))}
139
- </div>
140
-
141
- <div className="flex flex-1 overflow-hidden">
142
- {/* Left Panel */}
143
- <div className="w-[42%] border-r border-slate-800 p-2 flex flex-col">
144
- {view === 'overview' ? (
145
- <>
146
- <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><Globe size={10} /> Origen de Amenazas</div>
147
- <div className="space-y-1.5 flex-1">
148
- {threats.map(t => (
149
- <div key={t.country}>
150
- <div className="flex items-center justify-between text-[10px] mb-0.5">
151
- <div className="flex items-center gap-1.5">
152
- <div className="w-1.5 h-1.5 rounded-full animate-pulse" style={{ background: t.color, boxShadow: `0 0 6px ${t.color}` }} />
153
- <span className="font-semibold">{t.label}</span>
154
- </div>
155
- <span className="font-mono text-slate-400">{t.attempts}</span>
156
- </div>
157
- <div className="w-full bg-slate-800 rounded-full h-1">
158
- <div className="h-full rounded-full transition-all duration-500" style={{ width: `${(t.attempts / maxAttempts) * 100}%`, background: t.color }} />
159
- </div>
160
- </div>
161
- ))}
162
- </div>
163
- </>
164
- ) : (
165
- <>
166
- <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><Shield size={10} /> Módulos de Seguridad ({SECURITY_MODULES.length})</div>
167
- <div className="space-y-1 flex-1 overflow-y-auto">
168
- {SECURITY_MODULES.map(m => (
169
- <div key={m.label} className="flex items-center gap-2 text-[10px] bg-slate-900/50 rounded p-1.5 border border-slate-800">
170
- <m.icon size={11} className={lockdown && m.label === 'V2X Guard' ? 'text-red-400' : 'text-green-400'} />
171
- <span className="flex-1 text-slate-300">{m.label}</span>
172
- <span className="text-[9px] text-slate-500 font-mono">{m.threats > 0 ? m.threats : '—'}</span>
173
- <span className={`w-1.5 h-1.5 rounded-full ${lockdown && m.label === 'V2X Guard' ? 'bg-red-400' : 'bg-green-400'} animate-pulse`} />
174
- </div>
175
- ))}
176
- </div>
177
- </>
178
- )}
179
- </div>
180
-
181
- {/* Log Stream */}
182
- <div className="flex-1 flex flex-col overflow-hidden">
183
- <div className="p-2 border-b border-slate-800 flex items-center justify-between">
184
- <div className="text-[9px] text-slate-500 font-bold uppercase flex items-center gap-1"><Terminal size={10} /> Log Stream</div>
185
- <div className="flex items-center gap-1 text-[9px] text-green-400"><Activity size={9} className="animate-pulse" /> LIVE</div>
186
- </div>
187
- <div ref={logRef} className="flex-1 overflow-y-auto p-1.5 space-y-0.5 font-mono text-[9px]">
188
- {logs.map(log => (
189
- <div key={log.id}
190
- className={`px-1.5 py-1 rounded border-l-2 ${log.level === 'critical' ? 'bg-red-500/5 border-red-500 text-red-200' :
191
- log.level === 'warning' ? 'bg-yellow-500/5 border-yellow-500 text-yellow-200' :
192
- 'bg-slate-900/50 border-slate-700 text-slate-400'}`}>
193
- <span className="text-slate-600">{log.time}</span> {log.msg}
194
- </div>
195
- ))}
196
- {logs.length === 0 && <div className="text-slate-600 text-center py-8">Esperando eventos...</div>}
197
- </div>
198
- </div>
199
- </div>
200
- </div>
201
- </BaseNode>
202
- );
203
- };
@@ -1,399 +0,0 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
2
- import { BaseNode } from '@decido/macia-core';
3
- import {
4
- BarChart3,
5
- Users,
6
- Car,
7
- AlertTriangle,
8
- TrendingUp,
9
- MessageSquare,
10
- FileSpreadsheet,
11
- RefreshCw,
12
- Target,
13
- Star,
14
- Award,
15
- Zap,
16
- Activity,
17
- Timer,
18
- } from 'lucide-react';
19
-
20
- /* ═══════════════════════════════════════════════════════════════
21
- KIA DASHBOARD NODE — Grecco Motors Executive Dashboard
22
- Real KPIs from Partner Program & Business Data
23
- ═══════════════════════════════════════════════════════════════ */
24
-
25
- /** Simulated live jitter for KPI values */
26
- const jitter = (base: number, range: number) =>
27
- base + Math.round((Math.random() - 0.5) * range);
28
-
29
- export const KiaDashboardNode = (props: any) => {
30
- /* ─── State ──────────────────────────────────────────── */
31
- const [tick, setTick] = useState(0);
32
- const [loading, setLoading] = useState(false);
33
- const [activeTab, setActiveTab] = useState('vision360');
34
-
35
- /* ─── Simulated Live KPIs ───────────────────────────── */
36
- const kpis = {
37
- ventasMes: jitter(132, 6),
38
- meta: 150,
39
- oportunidades: jitter(437, 12),
40
- pedidos: jitter(15, 3),
41
- entregas: jitter(30, 4),
42
- tallerEntradas: jitter(49, 5),
43
- recallsPendientes: jitter(12, 2),
44
- leadsNuevos: jitter(87, 8),
45
- nps: jitter(953, 8) / 10,
46
- npsMeta: 91,
47
- marketShareNacional: 13.3,
48
- marketShareRegional: jitter(106, 4) / 10,
49
- ticketPromedio: jitter(712, 20) / 10, // $71.2M
50
- citasCumpl: jitter(65, 3),
51
- showUpCumpl: jitter(93, 2),
52
- testDriveCumpl: jitter(129, 5),
53
- calificacion: 'S',
54
- };
55
-
56
- /* ─── Leads ─────────────────────────────────────────── */
57
- const leads = [
58
- { id: 1, name: 'Juan Pérez', source: 'Facebook', vehicle: 'Sportage', score: 95, status: 'Alta Prioridad' },
59
- { id: 2, name: 'María Mendez', source: 'Instagram', vehicle: 'Picanto', score: 30, status: 'Baja' },
60
- { id: 3, name: 'Carlos Ruiz', source: 'Web', vehicle: 'K3', score: 88, status: 'Alta Prioridad' },
61
- { id: 4, name: 'Pedro Gómez', source: 'Walk-in', vehicle: 'Seltos', score: 45, status: 'Media' },
62
- { id: 5, name: 'Andrea López', source: 'Google Ads', vehicle: 'EV6', score: 92, status: 'Alta Prioridad' },
63
- ];
64
-
65
- const vendedores = [
66
- { name: 'Johan S. Blanco', pct: 66.8, color: '#22c55e' },
67
- { name: 'Camila Torres', pct: 18.5, color: '#3b82f6' },
68
- { name: 'Andrés Parra', pct: 14.7, color: '#a855f7' },
69
- ];
70
-
71
- const canales = [
72
- { name: 'Redes Sociales', pct: 54.7, color: '#6366f1' },
73
- { name: 'Walk-in', pct: 26.3, color: '#22c55e' },
74
- { name: 'Google Ads', pct: 12.0, color: '#f59e0b' },
75
- { name: 'Otros', pct: 7.0, color: '#64748b' },
76
- ];
77
-
78
- /* ─── Auto-refresh ──────────────────────────────────── */
79
- useEffect(() => {
80
- const iv = setInterval(() => setTick(t => t + 1), 8000);
81
- return () => clearInterval(iv);
82
- }, []);
83
-
84
- const refreshData = useCallback(() => {
85
- setLoading(true);
86
- setTimeout(() => { setTick(t => t + 1); setLoading(false); }, 1200);
87
- }, []);
88
-
89
- /* ─── Render ────────────────────────────────────────── */
90
- return (
91
- <BaseNode {...props} title="Kia Ownership Management" width={900} height={700}>
92
- <div className="flex flex-col h-full bg-slate-900 text-white p-4 gap-3 overflow-hidden">
93
-
94
- {/* ── Header ──────────────────────────── */}
95
- <div className="flex justify-between items-center bg-slate-800 p-3 rounded-lg border border-slate-700">
96
- <div className="flex items-center gap-3">
97
- <div className="w-12 h-12 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
98
- <span className="text-red-500 font-bold text-xs tracking-widest">KIA</span>
99
- </div>
100
- <div className="flex flex-col">
101
- <span className="text-sm font-bold tracking-wide text-white">GRECCO MOTORS — OWNERSHIP MANAGEMENT</span>
102
- <div className="flex items-center gap-2 mt-0.5">
103
- <span className="text-[10px] text-slate-400">Visión 360° · Metrokia</span>
104
- <span className="flex items-center gap-1 text-[10px] text-green-400 bg-green-500/10 px-1.5 rounded">
105
- <Activity size={8} className="animate-pulse" /> LIVE
106
- </span>
107
- </div>
108
- </div>
109
- </div>
110
- <div className="flex gap-1.5">
111
- {['vision360', 'financiero', 'operativo', 'equipo'].map(tab => (
112
- <button
113
- key={tab}
114
- onClick={() => setActiveTab(tab)}
115
- className={`px-3 py-1.5 text-[11px] font-semibold rounded capitalize transition-all ${activeTab === tab
116
- ? 'bg-white text-black shadow-lg'
117
- : 'bg-slate-700 text-slate-300 hover:bg-slate-600'
118
- }`}
119
- >
120
- {tab === 'vision360' ? '360°' : tab}
121
- </button>
122
- ))}
123
- <button
124
- onClick={refreshData}
125
- className={`flex items-center gap-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-500 rounded text-xs font-semibold transition-all ${loading ? 'opacity-50' : ''}`}
126
- >
127
- <RefreshCw size={12} className={loading ? 'animate-spin' : ''} />
128
- </button>
129
- </div>
130
- </div>
131
-
132
- {/* ── Content ─────────────────────────── */}
133
- <div className="flex-1 overflow-y-auto pr-1" key={tick}>
134
-
135
- {/* ─── Tab: Visión 360 ─────────────── */}
136
- {activeTab === 'vision360' && (
137
- <div className="grid grid-cols-4 gap-3">
138
- <KPICard label="Ventas Mes" value={kpis.ventasMes} target={kpis.meta} icon={BarChart3} color="text-green-400" />
139
- <KPICard label="Oportunidades" value={kpis.oportunidades} target={500} icon={Users} color="text-purple-400" />
140
- <KPICard label="Pedidos" value={kpis.pedidos} target={25} icon={Target} color="text-blue-400" />
141
- <KPICard label="Entregas" value={kpis.entregas} target={40} icon={Car} color="text-cyan-400" />
142
-
143
- {/* Cumplimiento Row */}
144
- <div className="col-span-4 grid grid-cols-3 gap-3">
145
- <ProgressCard label="Citas" value={kpis.citasCumpl} unit="%" target={80} color="#22c55e" />
146
- <ProgressCard label="Show Up" value={kpis.showUpCumpl} unit="%" target={85} color="#3b82f6" />
147
- <ProgressCard label="Test Drive" value={kpis.testDriveCumpl} unit="%" target={100} color="#f59e0b" />
148
- </div>
149
-
150
- {/* NPS + Market Share */}
151
- <div className="col-span-2 bg-slate-800 p-4 rounded-xl border border-slate-700">
152
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3 flex items-center gap-2">
153
- <Star size={12} /> NPS & Market Share
154
- </h3>
155
- <div className="grid grid-cols-2 gap-4">
156
- <div>
157
- <div className="text-2xl font-bold text-green-400">{kpis.nps}%</div>
158
- <div className="text-[10px] text-slate-500">NPS Comercial <span className="text-slate-600">(meta: {kpis.npsMeta}%)</span></div>
159
- </div>
160
- <div>
161
- <div className="text-2xl font-bold text-blue-400">{kpis.marketShareNacional}%</div>
162
- <div className="text-[10px] text-slate-500">MS Nacional <span className="text-green-500">#1</span></div>
163
- </div>
164
- </div>
165
- </div>
166
-
167
- {/* AI Insights */}
168
- <div className="col-span-2 bg-slate-800 p-4 rounded-xl border border-slate-700">
169
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3 flex items-center gap-2">
170
- <MessageSquare size={12} /> AI Detección Oportunidades
171
- </h3>
172
- <div className="space-y-1.5">
173
- {leads.slice(0, 3).map(lead => (
174
- <div key={lead.id} className="flex justify-between items-center bg-slate-900/50 p-2 rounded hover:bg-slate-700/50 transition-colors cursor-pointer border-l-2 border-transparent hover:border-blue-500">
175
- <div className="flex items-center gap-2">
176
- <div className={`w-7 h-7 rounded-full flex items-center justify-center font-bold text-[10px] ${lead.score > 80 ? 'bg-green-500/20 text-green-400' : lead.score > 50 ? 'bg-yellow-500/20 text-yellow-400' : 'bg-red-500/20 text-red-400'}`}>
177
- {lead.score}
178
- </div>
179
- <div>
180
- <div className="text-xs font-medium">{lead.name}</div>
181
- <div className="text-[9px] text-slate-500">{lead.vehicle} · {lead.source}</div>
182
- </div>
183
- </div>
184
- <div className="text-[9px] font-mono text-slate-500">{lead.status}</div>
185
- </div>
186
- ))}
187
- </div>
188
- </div>
189
-
190
- {/* Reportes Rápidos */}
191
- <div className="col-span-4 bg-slate-800 p-3 rounded-xl border border-slate-700">
192
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-2 flex items-center gap-2">
193
- <FileSpreadsheet size={12} /> Reportes Rápidos
194
- </h3>
195
- <div className="grid grid-cols-5 gap-2">
196
- {['One Page Report', 'Resumen Indicadores', 'Partner Program', 'Budget Comarketing', 'RUNT Cruce'].map(r => (
197
- <button key={r} className="bg-slate-900 hover:bg-slate-700 text-slate-300 hover:text-white px-2 py-1.5 rounded text-[10px] border border-slate-700 transition-all text-left truncate">{r}</button>
198
- ))}
199
- </div>
200
- </div>
201
- </div>
202
- )}
203
-
204
- {/* ─── Tab: Financiero ──────────────── */}
205
- {activeTab === 'financiero' && (
206
- <div className="grid grid-cols-3 gap-3">
207
- <KPICard label="Ticket Promedio" value={`$${kpis.ticketPromedio}M`} target="$75M" icon={TrendingUp} color="text-green-400" />
208
- <KPICard label="MS Regional" value={`${kpis.marketShareRegional}%`} target="12%" icon={Award} color="text-blue-400" />
209
- <KPICard label="Calificación" value={kpis.calificacion} target="S+" icon={Star} color="text-yellow-400" />
210
-
211
- {/* Revenue Bars */}
212
- <div className="col-span-3 bg-slate-800 p-4 rounded-xl border border-slate-700">
213
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3">Ingresos por Línea de Negocio</h3>
214
- {[
215
- { label: 'Vehículos Nuevos', pct: 62, color: '#22c55e' },
216
- { label: 'Servicio & Taller', pct: 18, color: '#3b82f6' },
217
- { label: 'Repuestos', pct: 12, color: '#f59e0b' },
218
- { label: 'Vehículos Usados', pct: 8, color: '#a855f7' },
219
- ].map(item => (
220
- <div key={item.label} className="mb-2.5">
221
- <div className="flex justify-between text-[10px] mb-1">
222
- <span className="text-slate-300">{item.label}</span>
223
- <span className="text-slate-500">{item.pct}%</span>
224
- </div>
225
- <div className="h-2 bg-slate-900 rounded-full overflow-hidden">
226
- <div className="h-full rounded-full transition-all duration-1000" style={{ width: `${item.pct}%`, background: item.color }} />
227
- </div>
228
- </div>
229
- ))}
230
- </div>
231
-
232
- {/* Alerta Predictiva */}
233
- <div className="col-span-3 bg-red-500/10 border border-red-500/20 p-3 rounded-xl text-sm text-red-200 flex items-start gap-2">
234
- <AlertTriangle className="shrink-0 mt-0.5" size={16} />
235
- <div>
236
- <span className="font-bold block text-xs">⚠️ Desviación Garantías Sportage GT</span>
237
- <span className="opacity-80 text-[11px]">+15% reclamaciones vs. promedio. Posible campaña técnica requerida. Impacto estimado: $24M.</span>
238
- </div>
239
- </div>
240
- </div>
241
- )}
242
-
243
- {/* ─── Tab: Operativo ───────────────── */}
244
- {activeTab === 'operativo' && (
245
- <div className="grid grid-cols-4 gap-3">
246
- <KPICard label="Taller Entradas" value={kpis.tallerEntradas} target={60} icon={Car} color="text-blue-400" />
247
- <KPICard label="Recalls Activos" value={kpis.recallsPendientes} target={0} icon={AlertTriangle} color="text-red-400" />
248
- <KPICard label="Leads Nuevos" value={kpis.leadsNuevos} target={100} icon={Zap} color="text-purple-400" />
249
- <KPICard label="Lead Time" value="4.2h" target="3h" icon={Timer} color="text-cyan-400" />
250
-
251
- {/* Mini Embudo */}
252
- <div className="col-span-4 bg-slate-800 p-4 rounded-xl border border-slate-700">
253
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3">Mini Embudo — Febrero 2026</h3>
254
- <div className="flex items-center gap-1">
255
- {[
256
- { label: 'Opps', val: kpis.oportunidades, w: 100 },
257
- { label: 'Citas', val: Math.round(kpis.oportunidades * 0.35), w: 80 },
258
- { label: 'Show Up', val: Math.round(kpis.oportunidades * 0.32), w: 65 },
259
- { label: 'Test Drive', val: Math.round(kpis.oportunidades * 0.18), w: 50 },
260
- { label: 'Pedidos', val: kpis.pedidos, w: 25 },
261
- { label: 'Entregas', val: kpis.entregas, w: 35 },
262
- ].map((step, i) => (
263
- <div key={step.label} className="flex items-center gap-1 flex-1">
264
- <div className="flex flex-col items-center flex-1">
265
- <div className="text-lg font-bold text-white">{step.val}</div>
266
- <div
267
- className="w-full rounded transition-all duration-1000"
268
- style={{ height: '6px', background: `hsl(${220 - i * 30}, 70%, ${50 + i * 5}%)` }}
269
- />
270
- <div className="text-[9px] text-slate-500 mt-1">{step.label}</div>
271
- </div>
272
- {i < 5 && <span className="text-slate-600 text-xs">→</span>}
273
- </div>
274
- ))}
275
- </div>
276
- </div>
277
-
278
- {/* Dashboards operativos */}
279
- <div className="col-span-4 grid grid-cols-3 gap-2">
280
- {['Capacidad Instalada', 'Varados', 'Garantías', 'Campañas', 'Budget Disponible', 'Budget Vencido'].map(item => (
281
- <div key={item} className="bg-slate-800 p-3 rounded-lg border border-slate-700 hover:border-blue-500/50 transition-all cursor-pointer">
282
- <div className="text-xs font-medium text-slate-200">{item}</div>
283
- <div className="text-[10px] text-slate-500 mt-0.5">Ver detalle →</div>
284
- </div>
285
- ))}
286
- </div>
287
- </div>
288
- )}
289
-
290
- {/* ─── Tab: Equipo ──────────────────── */}
291
- {activeTab === 'equipo' && (
292
- <div className="grid grid-cols-2 gap-3">
293
- {/* Vendedores */}
294
- <div className="bg-slate-800 p-4 rounded-xl border border-slate-700">
295
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3 flex items-center gap-2">
296
- <Users size={12} /> Top Vendedores
297
- </h3>
298
- {vendedores.map((v, i) => (
299
- <div key={v.name} className="mb-3">
300
- <div className="flex justify-between text-xs mb-1">
301
- <span className="text-slate-200 flex items-center gap-2">
302
- {i === 0 && <span className="text-yellow-400">🏆</span>}
303
- {v.name}
304
- </span>
305
- <span className="font-mono text-slate-400">{v.pct}%</span>
306
- </div>
307
- <div className="h-2 bg-slate-900 rounded-full overflow-hidden">
308
- <div className="h-full rounded-full transition-all duration-1000" style={{ width: `${v.pct}%`, background: v.color }} />
309
- </div>
310
- </div>
311
- ))}
312
- </div>
313
-
314
- {/* Canales */}
315
- <div className="bg-slate-800 p-4 rounded-xl border border-slate-700">
316
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3 flex items-center gap-2">
317
- <TrendingUp size={12} /> Canales de Origen
318
- </h3>
319
- {canales.map(c => (
320
- <div key={c.name} className="mb-3">
321
- <div className="flex justify-between text-xs mb-1">
322
- <span className="text-slate-200">{c.name}</span>
323
- <span className="font-mono text-slate-400">{c.pct}%</span>
324
- </div>
325
- <div className="h-2 bg-slate-900 rounded-full overflow-hidden">
326
- <div className="h-full rounded-full transition-all duration-1000" style={{ width: `${c.pct}%`, background: c.color }} />
327
- </div>
328
- </div>
329
- ))}
330
- </div>
331
-
332
- {/* Partner Program */}
333
- <div className="col-span-2 bg-slate-800 p-4 rounded-xl border border-slate-700">
334
- <h3 className="text-[10px] uppercase text-slate-400 font-bold mb-3 flex items-center gap-2">
335
- <Award size={12} /> Partner Program — Greco Motors
336
- </h3>
337
- <div className="grid grid-cols-5 gap-3">
338
- {[
339
- { area: 'Ventas', peso: 30, score: 87, color: '#22c55e' },
340
- { area: 'Posventa', peso: 25, score: 78, color: '#3b82f6' },
341
- { area: 'CX', peso: 20, score: 95, color: '#a855f7' },
342
- { area: 'Financiero', peso: 15, score: 82, color: '#f59e0b' },
343
- { area: 'Digital', peso: 10, score: 65, color: '#ec4899' },
344
- ].map(a => (
345
- <div key={a.area} className="flex flex-col items-center">
346
- <div className="w-12 h-12 rounded-full border-2 flex items-center justify-center mb-1" style={{ borderColor: a.color }}>
347
- <span className="text-sm font-bold" style={{ color: a.color }}>{a.score}</span>
348
- </div>
349
- <span className="text-[10px] text-slate-300">{a.area}</span>
350
- <span className="text-[9px] text-slate-500">{a.peso}%</span>
351
- </div>
352
- ))}
353
- </div>
354
- <div className="mt-3 text-center">
355
- <span className="text-sm text-slate-400">Calificación Actual: </span>
356
- <span className="text-2xl font-bold text-yellow-400 ml-1">S</span>
357
- </div>
358
- </div>
359
- </div>
360
- )}
361
- </div>
362
- </div>
363
- </BaseNode>
364
- );
365
- };
366
-
367
- /* ═══════════════════════════════════════════════════════════════
368
- SUB-COMPONENTS
369
- ═══════════════════════════════════════════════════════════════ */
370
-
371
- const KPICard = ({ label, value, target, icon: Icon, color }: any) => (
372
- <div className="bg-slate-800 p-3 rounded-xl border border-slate-700">
373
- <div className="flex items-center justify-between mb-1.5">
374
- <span className="text-slate-400 text-[10px] uppercase font-bold">{label}</span>
375
- <Icon className={color} size={14} />
376
- </div>
377
- <div className="text-xl font-bold">{value} <span className="text-slate-500 text-xs font-normal">/ {target}</span></div>
378
- </div>
379
- );
380
-
381
- const ProgressCard = ({ label, value, unit, target, color }: { label: string; value: number; unit: string; target: number; color: string }) => {
382
- const pct = Math.min(value, 150);
383
- const over = value >= target;
384
- return (
385
- <div className="bg-slate-800 p-3 rounded-xl border border-slate-700">
386
- <div className="flex justify-between items-center mb-2">
387
- <span className="text-[10px] uppercase text-slate-400 font-bold">{label}</span>
388
- <span className={`text-sm font-bold ${over ? 'text-green-400' : 'text-yellow-400'}`}>{value}{unit}</span>
389
- </div>
390
- <div className="h-1.5 bg-slate-900 rounded-full overflow-hidden">
391
- <div
392
- className="h-full rounded-full transition-all duration-1000"
393
- style={{ width: `${Math.min(pct, 100)}%`, background: over ? color : '#eab308' }}
394
- />
395
- </div>
396
- <div className="text-[9px] text-slate-600 mt-1">Meta: {target}{unit}</div>
397
- </div>
398
- );
399
- };