@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.
- package/README.md +31 -0
- package/package.json +27 -18
- package/.turbo/turbo-build.log +0 -13
- package/src/AgentPlayer.tsx +0 -105
- package/src/DecidoPlayer.tsx +0 -117
- package/src/bridge/BridgeAgent.ts +0 -443
- package/src/components/DecidoIcon.tsx +0 -56
- package/src/components/JsonTreeEditor.tsx +0 -117
- package/src/components/PanelSplitter.tsx +0 -71
- package/src/components/PluginErrorBoundary.tsx +0 -69
- package/src/components/SafeLiquidUI.tsx +0 -114
- package/src/components/TransientLayer.tsx +0 -92
- package/src/components/agent/AgentChat.tsx +0 -134
- package/src/components/chat-extensions/IntentCatalogPanel.tsx +0 -81
- package/src/components/chat-extensions/chatSlashCommands.ts +0 -101
- package/src/components/controls/CreatorInputBar.tsx +0 -144
- package/src/components/controls/OSToolbar.tsx +0 -90
- package/src/components/controls/TimelineTape.tsx +0 -43
- package/src/components/debug/ActionTimelineTab.tsx +0 -111
- package/src/components/debug/CSSInspectorTab.tsx +0 -436
- package/src/components/debug/ExportTab.tsx +0 -192
- package/src/components/debug/FlowHealthTab.tsx +0 -86
- package/src/components/debug/LogsTab.tsx +0 -110
- package/src/components/debug/MorphStackTab.tsx +0 -241
- package/src/components/debug/NetworkTab.tsx +0 -173
- package/src/components/debug/PerformanceTab.tsx +0 -171
- package/src/components/debug/ProfilesTab.tsx +0 -238
- package/src/components/debug/ReplayTab.tsx +0 -70
- package/src/components/debug/StoresTab.tsx +0 -255
- package/src/components/debug/TopologyTab.tsx +0 -59
- package/src/components/debug/debugConfig.tsx +0 -66
- package/src/components/playground/DebugPanel.tsx +0 -112
- package/src/components/playground/HeaderCenterControls.tsx +0 -92
- package/src/components/playground/KeyframeListItem.tsx +0 -70
- package/src/components/playground/PlaygroundAppSidebar.tsx +0 -171
- package/src/components/playground/PlaygroundBottomControls.tsx +0 -132
- package/src/components/playground/PlaygroundCanvas.tsx +0 -87
- package/src/components/playground/PlaygroundChat.tsx +0 -236
- package/src/components/playground/PlaygroundErrorBoundary.tsx +0 -63
- package/src/components/playground/PlaygroundFloatingInput.tsx +0 -352
- package/src/components/playground/PlaygroundHeader.tsx +0 -222
- package/src/components/playground/PlaygroundSidebar.tsx +0 -136
- package/src/components/playground/PlaygroundTerminal.tsx +0 -44
- package/src/components/playground/SuggestionCards.tsx +0 -29
- package/src/components/playground/demos/ClinicaAINode.tsx +0 -221
- package/src/components/playground/demos/FinanceAINode.tsx +0 -226
- package/src/components/playground/demos/KiaAcademyNode.tsx +0 -250
- package/src/components/playground/demos/KiaBotNode.tsx +0 -207
- package/src/components/playground/demos/KiaCampaignNode.tsx +0 -191
- package/src/components/playground/demos/KiaComplianceNode.tsx +0 -140
- package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +0 -220
- package/src/components/playground/demos/KiaCyberNode.tsx +0 -203
- package/src/components/playground/demos/KiaDashboardNode.tsx +0 -399
- package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +0 -168
- package/src/components/playground/demos/KiaExecutiveNode.tsx +0 -169
- package/src/components/playground/demos/KiaGamificationNode.tsx +0 -229
- package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +0 -165
- package/src/components/playground/demos/KiaInventoryNode.tsx +0 -183
- package/src/components/playground/demos/KiaLeadScoringNode.tsx +0 -226
- package/src/components/playground/demos/KiaLiveSimulationNode.tsx +0 -177
- package/src/components/playground/demos/KiaMultiDealerNode.tsx +0 -223
- package/src/components/playground/demos/KiaNPSVoiceNode.tsx +0 -214
- package/src/components/playground/demos/KiaOmnichannelNode.tsx +0 -162
- package/src/components/playground/demos/KiaPBIBudgetNode.tsx +0 -152
- package/src/components/playground/demos/KiaPBIConversionNode.tsx +0 -206
- package/src/components/playground/demos/KiaPBIFunnelNode.tsx +0 -184
- package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +0 -113
- package/src/components/playground/demos/KiaPBIPartnerNode.tsx +0 -143
- package/src/components/playground/demos/KiaPBIPreciosNode.tsx +0 -120
- package/src/components/playground/demos/KiaPBIRuntNode.tsx +0 -205
- package/src/components/playground/demos/KiaPartnerScoreNode.tsx +0 -206
- package/src/components/playground/demos/KiaPredictiveNode.tsx +0 -226
- package/src/components/playground/demos/KiaShowroomNode.tsx +0 -194
- package/src/components/playground/demos/KiaStoreNode.tsx +0 -215
- package/src/components/playground/demos/KiaSustainabilityNode.tsx +0 -173
- package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +0 -163
- package/src/components/playground/demos/KiaWorkshopNode.tsx +0 -221
- package/src/components/playground/demos/SmartCityNode.tsx +0 -205
- package/src/components/playground/demos/kia_campaign_manifest.json +0 -112
- package/src/components/playground/input-parts/AIModelSelector.tsx +0 -156
- package/src/components/playground/input-parts/InputActions.tsx +0 -80
- package/src/components/playground/input-parts/InputToolbar.tsx +0 -245
- package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +0 -287
- package/src/components/playground/sidebarDsdIO.ts +0 -82
- package/src/components/settings/SettingsPanel.tsx +0 -267
- package/src/components/shell/AppHeader.tsx +0 -9
- package/src/components/shell/AppShell.tsx +0 -139
- package/src/components/shell/ArtifactBar.tsx +0 -97
- package/src/components/shell/BootScreen.tsx +0 -19
- package/src/components/shell/CenterComposite.tsx +0 -87
- package/src/components/shell/CodeEditorPanel.tsx +0 -88
- package/src/components/shell/GlobalOverlays.tsx +0 -228
- package/src/components/shell/LayoutConfigurator.tsx +0 -209
- package/src/components/shell/LayoutGrid.tsx +0 -178
- package/src/components/shell/MorphShell.tsx +0 -368
- package/src/components/shell/PluginViewer.tsx +0 -147
- package/src/components/shell/ShellNexusPreview.tsx +0 -458
- package/src/components/shell/SlotRenderer.tsx +0 -115
- package/src/components/shell/TabBar.tsx +0 -94
- package/src/components/shell/TemplateLibrary.tsx +0 -195
- package/src/components/shell/layoutConstants.ts +0 -35
- package/src/components/shell/morphStageMeta.ts +0 -15
- package/src/components/shell/shells/BuiltInShells.tsx +0 -443
- package/src/components/shell/shells/DatawayChatShell.tsx +0 -42
- package/src/components/shell/shells/TokenPreview.tsx +0 -339
- package/src/components/shell/shells/bootShells.ts +0 -31
- package/src/components/shells/CreatorShell.tsx +0 -37
- package/src/components/shells/DecidoShell.tsx +0 -447
- package/src/components/shells/ExperimentalChatShell.tsx +0 -245
- package/src/components/shells/UserCanvas.tsx +0 -44
- package/src/components/studio/BlueprintManagerPanel.tsx +0 -137
- package/src/components/studio/DependencyTreePanel.tsx +0 -192
- package/src/components/studio/NodePalette.tsx +0 -92
- package/src/components/studio/NodePropertiesPanel.tsx +0 -81
- package/src/components/studio/ReactFlowEditor.tsx +0 -242
- package/src/components/studio/TimelineEditor.tsx +0 -122
- package/src/components/studio/TimelineKeyframeCard.tsx +0 -99
- package/src/components/studio/VariablePanel.tsx +0 -181
- package/src/components/studio/blueprint/BlueprintCard.tsx +0 -82
- package/src/components/studio/editor/CanvasContextMenu.tsx +0 -107
- package/src/components/studio/editor/EditorToolbar.tsx +0 -80
- package/src/components/studio/editor/StageContentRenderer.tsx +0 -134
- package/src/components/studio/editor/TrackPropertyEditors.tsx +0 -133
- package/src/components/studio/editor/TreeNodeItem.tsx +0 -91
- package/src/components/studio/editor/edgeStyles.ts +0 -43
- package/src/components/studio/editor/editorKeyHandler.ts +0 -95
- package/src/components/studio/editor/nodeTypeRegistry.ts +0 -137
- package/src/components/studio/editor/paletteCatalog.tsx +0 -84
- package/src/components/studio/nodes/shell/InteractionNodes.tsx +0 -82
- package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +0 -69
- package/src/components/studio/nodes/shell/RegisterActionNode.tsx +0 -20
- package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterTabNode.tsx +0 -21
- package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/ShellConfigNode.tsx +0 -51
- package/src/components/studio/nodes/shell/ShellNodeBase.tsx +0 -100
- package/src/components/studio/nodes/shell/ThemeNodes.tsx +0 -51
- package/src/components/studio/nodes/shell/index.ts +0 -12
- package/src/components/widgets/BroadcastWidget.tsx +0 -93
- package/src/components/widgets/MarketplaceWidget.tsx +0 -298
- package/src/components/widgets/McpToolsWidget.tsx +0 -231
- package/src/components/widgets/OpsDashboard.tsx +0 -59
- package/src/components/widgets/QuickActionsWidget.tsx +0 -60
- package/src/components/widgets/UsageWidget.tsx +0 -112
- package/src/components/widgets/WidgetRenderer.tsx +0 -892
- package/src/components/widgets/WidgetSlotPanel.tsx +0 -213
- package/src/config/IconRegistry.ts +0 -126
- package/src/contexts/NetworkProvider.tsx +0 -162
- package/src/core/AIDirector.ts +0 -71
- package/src/core/EventBus.ts +0 -37
- package/src/core/PluginContext.tsx +0 -141
- package/src/hooks/listeners/useUIStateListener.ts +0 -59
- package/src/hooks/listeners/useWhatsAppListener.ts +0 -110
- package/src/hooks/morphBridge.ts +0 -82
- package/src/hooks/useAIModelSelector.ts +0 -144
- package/src/hooks/useAgentStream.ts +0 -220
- package/src/hooks/useAutoUpdater.ts +0 -89
- package/src/hooks/useBootSequence.ts +0 -20
- package/src/hooks/useExportDSD.ts +0 -53
- package/src/hooks/useFullscreen.ts +0 -35
- package/src/hooks/useGeminiStream.ts +0 -282
- package/src/hooks/useIntentLens.ts +0 -224
- package/src/hooks/useKeyboardShortcuts.ts +0 -69
- package/src/hooks/useLoggerBridge.ts +0 -32
- package/src/hooks/useMcpClient.ts +0 -112
- package/src/hooks/useNexusaiDeploy.ts +0 -118
- package/src/hooks/usePlaybackEngine.ts +0 -21
- package/src/hooks/usePlaygroundCommander.ts +0 -475
- package/src/hooks/usePluginEngine.ts +0 -165
- package/src/hooks/useScreenRecorder.ts +0 -73
- package/src/hooks/useShellKeyboard.ts +0 -40
- package/src/hooks/useShellShortcuts.ts +0 -118
- package/src/hooks/useSoundEffects.ts +0 -35
- package/src/hooks/useStudioConfig.ts +0 -72
- package/src/hooks/useSystemBoot.ts +0 -84
- package/src/hooks/useSystemTelemetry.ts +0 -62
- package/src/index.ts +0 -97
- package/src/lib/debugLogger.ts +0 -80
- package/src/lib/networkInterceptor.ts +0 -100
- package/src/mocks/decido.tsx +0 -41
- package/src/plugins/pluginAPI.ts +0 -190
- package/src/store/McpStore.ts +0 -69
- package/src/store/UpdaterStore.ts +0 -60
- package/src/store/engine.ts +0 -392
- package/src/store/index.ts +0 -4
- package/src/store/layoutPresets.ts +0 -66
- package/src/store/playgroundTypes.ts +0 -98
- package/src/store/useActionTimelineStore.ts +0 -48
- package/src/store/useDebugPanelStore.ts +0 -98
- package/src/store/useDebugProfileStore.ts +0 -130
- package/src/store/useLayoutStore.ts +0 -205
- package/src/store/useMorphInstanceStore.ts +0 -289
- package/src/store/useMorphologyStore.ts +0 -103
- package/src/store/usePlaygroundStore.ts +0 -236
- package/src/store/useShellRegistry.ts +0 -123
- package/src/store/useSuggestionsStore.ts +0 -57
- package/src/store/useThemeStore.ts +0 -399
- package/src/store/useUIComponentStore.ts +0 -179
- package/src/types/DecidoStoryDefinition.ts +0 -43
- package/src/utils/ai/ai-architect.ts +0 -92
- package/src/utils/ai/ai-code.ts +0 -187
- package/src/utils/ai/ai-core.ts +0 -50
- package/src/utils/ai/ai-media.ts +0 -292
- package/src/utils/layoutGraph.ts +0 -67
- package/tsconfig.json +0 -17
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { BaseNode } from '@decido/macia-core';
|
|
3
|
-
import {
|
|
4
|
-
Car, Thermometer, Activity, Brain, Wifi, AlertTriangle,
|
|
5
|
-
CheckCircle2, Gauge, Battery, Wrench, TrendingUp,
|
|
6
|
-
Clock, Zap, Shield, MapPin, BarChart3
|
|
7
|
-
} from 'lucide-react';
|
|
8
|
-
|
|
9
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
10
|
-
KIA FLEET HEALTH NODE — Diagnóstico Predictivo
|
|
11
|
-
Telemetría IoT + mantenimiento predictivo con IA
|
|
12
|
-
═══════════════════════════════════════════════════════════════ */
|
|
13
|
-
|
|
14
|
-
interface FleetVehicle {
|
|
15
|
-
id: string; model: string; year: number; km: number;
|
|
16
|
-
status: 'ok' | 'warning' | 'critical';
|
|
17
|
-
battery: number; engine: string; oil: number;
|
|
18
|
-
tires: number[]; temp: number; dtcCodes: string[];
|
|
19
|
-
nextService: string; owner: string;
|
|
20
|
-
prediction?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const FLEET: FleetVehicle[] = [
|
|
24
|
-
{ id: 'KIA-3201', model: 'Sportage', year: 2024, km: 18420, status: 'ok', battery: 92, engine: 'OK', oil: 78, tires: [32, 31, 33, 32], temp: 88, dtcCodes: [], nextService: '12.000 km', owner: 'Mauricio Díaz' },
|
|
25
|
-
{ id: 'KIA-1105', model: 'Seltos', year: 2023, km: 42310, status: 'warning', battery: 67, engine: 'CHECK', oil: 35, tires: [28, 27, 30, 29], temp: 95, dtcCodes: ['P0301'], nextService: '1.200 km', owner: 'Ana Torres', prediction: 'Bujía cilindro 1 desgastada (87% prob). Intervención preventiva evitaría daño catalítico.' },
|
|
26
|
-
{ id: 'KIA-7788', model: 'EV6', year: 2024, km: 9800, status: 'ok', battery: 98, engine: 'EV', oil: -1, tires: [35, 35, 34, 35], temp: 42, dtcCodes: [], nextService: '20.200 km', owner: 'Carlos Ruiz', prediction: 'Batería HV degradación mínima. Proyección: 94% salud a 100K km. Óptimo.' },
|
|
27
|
-
{ id: 'KIA-5502', model: 'K3', year: 2023, km: 55120, status: 'critical', battery: 45, engine: 'FAIL', oil: 12, tires: [25, 22, 26, 24], temp: 108, dtcCodes: ['P0420', 'P0171'], nextService: 'URGENTE', owner: 'Jorge Vélez', prediction: 'Aceite al 12% → riesgo cigüeñal en ~500 km. Catalítico degradado. Cita automática agendada.' },
|
|
28
|
-
{ id: 'KIA-9901', model: 'Sorento', year: 2024, km: 31200, status: 'ok', battery: 85, engine: 'OK', oil: 62, tires: [30, 31, 30, 31], temp: 91, dtcCodes: [], nextService: '8.800 km', owner: 'Luisa Perea' },
|
|
29
|
-
{ id: 'KIA-4420', model: 'EV3', year: 2025, km: 3200, status: 'ok', battery: 100, engine: 'EV', oil: -1, tires: [34, 34, 34, 34], temp: 38, dtcCodes: [], nextService: '26.800 km', owner: 'Andrea López' },
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
const jitter = (n: number, r: number) => n + Math.floor((Math.random() - 0.5) * r);
|
|
33
|
-
|
|
34
|
-
export const KiaFleetHealthNode = (props: any) => {
|
|
35
|
-
const [fleet] = useState(FLEET);
|
|
36
|
-
const [selected, setSelected] = useState('KIA-5502');
|
|
37
|
-
const [diagnosing, setDiagnosing] = useState(false);
|
|
38
|
-
const [aiInsight, setAiInsight] = useState<string | null>(null);
|
|
39
|
-
const [liveTemp, setLiveTemp] = useState(FLEET.map(f => f.temp));
|
|
40
|
-
const [tick, setTick] = useState(0);
|
|
41
|
-
|
|
42
|
-
const vehicle = fleet.find(v => v.id === selected)!;
|
|
43
|
-
const vehicleIdx = fleet.findIndex(v => v.id === selected);
|
|
44
|
-
|
|
45
|
-
/* Live telemetry */
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const iv = setInterval(() => {
|
|
48
|
-
setTick(t => t + 1);
|
|
49
|
-
setLiveTemp(prev => prev.map(t => Math.max(30, Math.min(120, t + Math.floor(Math.random() * 5 - 2)))));
|
|
50
|
-
}, 3000);
|
|
51
|
-
return () => clearInterval(iv);
|
|
52
|
-
}, []);
|
|
53
|
-
|
|
54
|
-
const runDiagnostic = useCallback(() => {
|
|
55
|
-
setDiagnosing(true);
|
|
56
|
-
setAiInsight(null);
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
setAiInsight(vehicle.prediction || 'Todos los sistemas operan dentro de parámetros normales. Próximo servicio programado correctamente.');
|
|
59
|
-
setDiagnosing(false);
|
|
60
|
-
}, 2200);
|
|
61
|
-
}, [vehicle]);
|
|
62
|
-
|
|
63
|
-
/* Stats */
|
|
64
|
-
const fleetOk = fleet.filter(v => v.status === 'ok').length;
|
|
65
|
-
const fleetWarn = fleet.filter(v => v.status === 'warning').length;
|
|
66
|
-
const fleetCrit = fleet.filter(v => v.status === 'critical').length;
|
|
67
|
-
|
|
68
|
-
const statusConfig = {
|
|
69
|
-
ok: { color: '#22c55e', bg: '#22c55e22', label: 'Normal', icon: CheckCircle2 },
|
|
70
|
-
warning: { color: '#f59e0b', bg: '#f59e0b22', label: 'Atención', icon: AlertTriangle },
|
|
71
|
-
critical: { color: '#ef4444', bg: '#ef444422', label: 'Crítico', icon: Zap },
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const cfg = statusConfig[vehicle.status];
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<BaseNode {...props} title="Kia Fleet Diagnostics" width={560} height={680}>
|
|
78
|
-
<div className="flex flex-col h-full bg-slate-950 text-white overflow-hidden">
|
|
79
|
-
|
|
80
|
-
{/* Header */}
|
|
81
|
-
<div className="flex items-center gap-3 p-3 bg-slate-900 border-b border-slate-800">
|
|
82
|
-
<div className="w-10 h-10 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
|
|
83
|
-
<span className="text-red-500 font-bold text-[8px] tracking-widest">KIA</span>
|
|
84
|
-
</div>
|
|
85
|
-
<div className="flex-1">
|
|
86
|
-
<div className="text-sm font-bold tracking-wide">Fleet Health Monitor</div>
|
|
87
|
-
<div className="text-[10px] text-slate-400">IoT Telematics · {fleet.length} conectados · Grecco Motors</div>
|
|
88
|
-
</div>
|
|
89
|
-
<div className="flex gap-2">
|
|
90
|
-
<div className="bg-green-500/10 px-2 py-0.5 rounded text-[10px] text-green-400 font-bold">{fleetOk} OK</div>
|
|
91
|
-
<div className="bg-yellow-500/10 px-2 py-0.5 rounded text-[10px] text-yellow-400 font-bold">{fleetWarn} ⚠️</div>
|
|
92
|
-
<div className="bg-red-500/10 px-2 py-0.5 rounded text-[10px] text-red-400 font-bold">{fleetCrit} 🔴</div>
|
|
93
|
-
</div>
|
|
94
|
-
<div className="flex items-center gap-1 text-[9px] text-green-400">
|
|
95
|
-
<Wifi size={10} className="animate-pulse" /> LIVE
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
<div className="flex flex-1 overflow-hidden">
|
|
100
|
-
{/* Vehicle List */}
|
|
101
|
-
<div className="w-[38%] border-r border-slate-800 overflow-y-auto">
|
|
102
|
-
{fleet.map((v, i) => {
|
|
103
|
-
const sc = statusConfig[v.status];
|
|
104
|
-
return (
|
|
105
|
-
<div
|
|
106
|
-
key={v.id}
|
|
107
|
-
onClick={() => { setSelected(v.id); setAiInsight(null); }}
|
|
108
|
-
className={`p-2.5 border-b border-slate-800/50 cursor-pointer transition-all ${selected === v.id ? 'bg-slate-800 border-l-2' : 'hover:bg-slate-900/80 border-l-2 border-l-transparent'}`}
|
|
109
|
-
style={selected === v.id ? { borderLeftColor: sc.color } : {}}
|
|
110
|
-
>
|
|
111
|
-
<div className="flex items-center gap-2">
|
|
112
|
-
<Car size={14} className="text-slate-400 shrink-0" />
|
|
113
|
-
<div className="flex-1 min-w-0">
|
|
114
|
-
<div className="text-[11px] font-semibold truncate">{v.model} <span className="text-slate-500 font-normal">{v.year}</span></div>
|
|
115
|
-
<div className="text-[9px] text-slate-500">{v.id} · {v.km.toLocaleString()} km</div>
|
|
116
|
-
</div>
|
|
117
|
-
<span className="text-[8px] px-1.5 py-0.5 rounded-full font-bold shrink-0" style={{ color: sc.color, background: sc.bg }}>
|
|
118
|
-
{sc.label}
|
|
119
|
-
</span>
|
|
120
|
-
</div>
|
|
121
|
-
{/* Temp mini */}
|
|
122
|
-
<div className="mt-1.5 flex items-center gap-1">
|
|
123
|
-
<Thermometer size={8} className="text-slate-600" />
|
|
124
|
-
<div className="flex-1 h-1 bg-slate-800 rounded-full overflow-hidden">
|
|
125
|
-
<div className={`h-full rounded-full transition-all ${liveTemp[i] < 100 ? 'bg-blue-500' : 'bg-red-500'}`} style={{ width: `${Math.min(liveTemp[i], 120) / 1.2}%` }} />
|
|
126
|
-
</div>
|
|
127
|
-
<span className="text-[8px] text-slate-500 font-mono w-6 text-right">{liveTemp[i]}°</span>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
);
|
|
131
|
-
})}
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
{/* Vehicle Detail */}
|
|
135
|
-
<div className="flex-1 flex flex-col overflow-y-auto p-3 gap-2.5">
|
|
136
|
-
{/* Vehicle Header */}
|
|
137
|
-
<div className="flex items-center justify-between">
|
|
138
|
-
<div>
|
|
139
|
-
<div className="text-sm font-bold">{vehicle.model} {vehicle.year}</div>
|
|
140
|
-
<div className="text-[10px] text-slate-500">{vehicle.id} · {vehicle.owner} · {vehicle.km.toLocaleString()} km</div>
|
|
141
|
-
</div>
|
|
142
|
-
<span className="text-[10px] px-2 py-1 rounded-full font-bold flex items-center gap-1" style={{ color: cfg.color, background: cfg.bg }}>
|
|
143
|
-
<cfg.icon size={10} /> {cfg.label}
|
|
144
|
-
</span>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
{/* Vitals Grid */}
|
|
148
|
-
<div className="grid grid-cols-2 gap-1.5">
|
|
149
|
-
<VitalCard icon={Battery} label="Batería" value={`${vehicle.battery}%`} pct={vehicle.battery} good={vehicle.battery > 70} />
|
|
150
|
-
<VitalCard icon={Thermometer} label="Motor Temp" value={`${liveTemp[vehicleIdx]}°C`} pct={liveTemp[vehicleIdx] / 1.2} good={liveTemp[vehicleIdx] < 100} />
|
|
151
|
-
<VitalCard icon={Gauge} label="Aceite" value={vehicle.oil < 0 ? 'N/A (EV)' : `${vehicle.oil}%`} pct={vehicle.oil < 0 ? 100 : vehicle.oil} good={vehicle.oil < 0 || vehicle.oil > 50} />
|
|
152
|
-
<VitalCard icon={Activity} label="Motor" value={vehicle.engine} pct={vehicle.engine === 'OK' || vehicle.engine === 'EV' ? 100 : vehicle.engine === 'CHECK' ? 50 : 15} good={vehicle.engine === 'OK' || vehicle.engine === 'EV'} />
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
{/* Tire Pressure */}
|
|
156
|
-
<div className="bg-slate-900 border border-slate-800 rounded-lg p-2">
|
|
157
|
-
<div className="text-[9px] text-slate-500 font-bold uppercase mb-1.5">Presión Llantas (PSI)</div>
|
|
158
|
-
<div className="flex justify-around text-center">
|
|
159
|
-
{['FI', 'FD', 'TI', 'TD'].map((label, i) => (
|
|
160
|
-
<div key={label}>
|
|
161
|
-
<div className={`text-sm font-bold ${vehicle.tires[i] < 28 ? 'text-red-400' : 'text-green-400'}`}>{vehicle.tires[i]}</div>
|
|
162
|
-
<div className="text-[8px] text-slate-500">{label}</div>
|
|
163
|
-
</div>
|
|
164
|
-
))}
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
|
-
{/* Next Service */}
|
|
169
|
-
<div className="flex items-center justify-between bg-slate-900 border border-slate-800 rounded-lg p-2">
|
|
170
|
-
<div className="flex items-center gap-1.5 text-[10px] text-slate-400">
|
|
171
|
-
<Wrench size={10} /> Próximo Servicio
|
|
172
|
-
</div>
|
|
173
|
-
<span className={`text-xs font-bold ${vehicle.nextService === 'URGENTE' ? 'text-red-400' : 'text-blue-400'}`}>
|
|
174
|
-
{vehicle.nextService}
|
|
175
|
-
</span>
|
|
176
|
-
</div>
|
|
177
|
-
|
|
178
|
-
{/* DTC Codes */}
|
|
179
|
-
{vehicle.dtcCodes.length > 0 && (
|
|
180
|
-
<div className="bg-red-500/5 border border-red-500/20 rounded-lg p-2">
|
|
181
|
-
<div className="text-[9px] text-red-400 font-bold uppercase mb-1 flex items-center gap-1"><AlertTriangle size={10} /> Códigos DTC</div>
|
|
182
|
-
<div className="flex gap-1">
|
|
183
|
-
{vehicle.dtcCodes.map(code => (
|
|
184
|
-
<span key={code} className="bg-red-500/20 text-red-300 text-[10px] px-2 py-0.5 rounded font-mono">{code}</span>
|
|
185
|
-
))}
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
)}
|
|
189
|
-
|
|
190
|
-
{/* AI Diagnostic */}
|
|
191
|
-
<button
|
|
192
|
-
onClick={runDiagnostic}
|
|
193
|
-
disabled={diagnosing}
|
|
194
|
-
className="w-full flex items-center justify-center gap-2 bg-violet-600 hover:bg-violet-500 disabled:opacity-50 text-white text-xs font-bold py-2 rounded-lg transition-all"
|
|
195
|
-
>
|
|
196
|
-
<Brain size={14} className={diagnosing ? 'animate-spin' : ''} />
|
|
197
|
-
{diagnosing ? 'Analizando telemetría...' : '🧠 Diagnóstico Predictivo IA'}
|
|
198
|
-
</button>
|
|
199
|
-
{aiInsight && (
|
|
200
|
-
<div className="bg-violet-500/10 border border-violet-500/20 rounded-lg p-2.5 text-[11px] text-violet-200 leading-relaxed">
|
|
201
|
-
<div className="flex items-center gap-1 text-[9px] text-violet-400 font-bold mb-1"><Brain size={10} /> Predicción IA</div>
|
|
202
|
-
{aiInsight}
|
|
203
|
-
</div>
|
|
204
|
-
)}
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
</BaseNode>
|
|
209
|
-
);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
/* ─── Sub-components ───────────────────────────────────────── */
|
|
213
|
-
const VitalCard = ({ icon: Icon, label, value, pct, good }: any) => (
|
|
214
|
-
<div className="bg-slate-900 border border-slate-800 rounded-lg p-2">
|
|
215
|
-
<div className="flex items-center gap-1 text-[9px] text-slate-500 mb-1"><Icon size={10} /> {label}</div>
|
|
216
|
-
<div className={`text-base font-bold ${good ? 'text-green-400' : 'text-red-400'}`}>{value}</div>
|
|
217
|
-
<div className="w-full bg-slate-800 rounded-full h-1 mt-1">
|
|
218
|
-
<div className={`h-full rounded-full transition-all ${good ? 'bg-green-500' : 'bg-red-500'}`} style={{ width: `${Math.min(pct, 100)}%` }} />
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
);
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { BaseNode } from '@decido/macia-core';
|
|
3
|
-
import {
|
|
4
|
-
DollarSign, Calculator, TrendingUp, CreditCard, Car,
|
|
5
|
-
CheckCircle2, ArrowRight, Percent, Calendar, Shield,
|
|
6
|
-
Users, BarChart3, Wallet, FileText, Brain, Zap
|
|
7
|
-
} from 'lucide-react';
|
|
8
|
-
|
|
9
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
10
|
-
KIA FINANCE NODE — Financial Services · Grecco Motors
|
|
11
|
-
Cotizador + Pre-aprobación IA + Insurance + Portafolio analytics
|
|
12
|
-
═══════════════════════════════════════════════════════════════ */
|
|
13
|
-
|
|
14
|
-
const VEHICLES_CATALOG = [
|
|
15
|
-
{ model: 'Picanto', price: 58990000, image: '🚗', insurance: 2400000 },
|
|
16
|
-
{ model: 'K3 Cross', price: 82990000, image: '🚙', insurance: 3100000 },
|
|
17
|
-
{ model: 'Stonic', price: 95990000, image: '🚙', insurance: 3500000 },
|
|
18
|
-
{ model: 'Seltos', price: 109990000, image: '🏎️', insurance: 4200000 },
|
|
19
|
-
{ model: 'Sportage', price: 139990000, image: '🏎️', insurance: 5300000 },
|
|
20
|
-
{ model: 'EV6', price: 249990000, image: '⚡', insurance: 8100000 },
|
|
21
|
-
{ model: 'EV9', price: 349990000, image: '⚡', insurance: 11200000 },
|
|
22
|
-
{ model: 'Sorento', price: 189990000, image: '🛻', insurance: 6800000 },
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
const PLANS = [
|
|
26
|
-
{ id: 'leasing', label: 'Leasing', months: 60, rate: 1.18, downPct: 20, icon: '📋' },
|
|
27
|
-
{ id: 'credito', label: 'Crédito', months: 72, rate: 1.45, downPct: 30, icon: '💳' },
|
|
28
|
-
{ id: 'renting', label: 'Renting', months: 36, rate: 0, downPct: 0, icon: '🔄' },
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const BANKS = [
|
|
32
|
-
{ name: 'Bancolombia', rate: 1.18, logo: '🏦' },
|
|
33
|
-
{ name: 'Davivienda', rate: 1.25, logo: '🏛️' },
|
|
34
|
-
{ name: 'BBVA', rate: 1.32, logo: '🏦' },
|
|
35
|
-
{ name: 'Finandina', rate: 1.45, logo: '🏛️' },
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
export const KiaFinanceNode = (props: any) => {
|
|
39
|
-
const [selectedVehicle, setSelectedVehicle] = useState(4); // Sportage
|
|
40
|
-
const [selectedPlan, setSelectedPlan] = useState('leasing');
|
|
41
|
-
const [downPayment, setDownPayment] = useState(30);
|
|
42
|
-
const [months, setMonths] = useState(48);
|
|
43
|
-
const [showResult, setShowResult] = useState(false);
|
|
44
|
-
const [approved, setApproved] = useState(false);
|
|
45
|
-
const [analyzing, setAnalyzing] = useState(false);
|
|
46
|
-
const [includeInsurance, setIncludeInsurance] = useState(true);
|
|
47
|
-
const [approvalDetails, setApprovalDetails] = useState<any>(null);
|
|
48
|
-
|
|
49
|
-
const vehicle = VEHICLES_CATALOG[selectedVehicle];
|
|
50
|
-
const plan = PLANS.find(p => p.id === selectedPlan)!;
|
|
51
|
-
|
|
52
|
-
const downAmount = vehicle.price * (downPayment / 100);
|
|
53
|
-
const financed = vehicle.price - downAmount;
|
|
54
|
-
const monthlyRate = plan.rate / 100;
|
|
55
|
-
const monthly = plan.id === 'renting'
|
|
56
|
-
? Math.round(vehicle.price * 0.022)
|
|
57
|
-
: Math.round((financed * monthlyRate) / (1 - Math.pow(1 + monthlyRate, -months)));
|
|
58
|
-
const monthlyInsurance = includeInsurance ? Math.round(vehicle.insurance / 12) : 0;
|
|
59
|
-
const totalMonthly = monthly + monthlyInsurance;
|
|
60
|
-
|
|
61
|
-
const formatCOP = (n: number) => `$${n.toLocaleString('es-CO')}`;
|
|
62
|
-
|
|
63
|
-
const runApproval = () => {
|
|
64
|
-
setAnalyzing(true);
|
|
65
|
-
setApproved(false);
|
|
66
|
-
setShowResult(false);
|
|
67
|
-
setTimeout(() => {
|
|
68
|
-
const score = 720 + Math.floor(Math.random() * 120);
|
|
69
|
-
const bestBank = BANKS[Math.floor(Math.random() * BANKS.length)];
|
|
70
|
-
setApprovalDetails({ score, bank: bestBank, cupo: Math.round(vehicle.price * (0.7 + Math.random() * 0.15)) });
|
|
71
|
-
setApproved(true);
|
|
72
|
-
setShowResult(true);
|
|
73
|
-
setAnalyzing(false);
|
|
74
|
-
}, 2200);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<BaseNode {...props} title="Kia Financial Services" width={500} height={660}>
|
|
79
|
-
<div className="flex flex-col h-full bg-slate-950 text-white overflow-hidden">
|
|
80
|
-
|
|
81
|
-
{/* Header */}
|
|
82
|
-
<div className="flex items-center gap-3 p-3 bg-slate-900 border-b border-slate-800">
|
|
83
|
-
<div className="w-9 h-9 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
|
|
84
|
-
<span className="text-red-500 font-bold text-[7px] tracking-widest">KIA</span>
|
|
85
|
-
</div>
|
|
86
|
-
<div className="flex-1">
|
|
87
|
-
<div className="text-xs font-bold tracking-wide">FINANCIAL SERVICES</div>
|
|
88
|
-
<div className="text-[10px] text-slate-400">Grecco Motors · Cotizador + Pre-aprobación IA</div>
|
|
89
|
-
</div>
|
|
90
|
-
<div className="flex gap-2">
|
|
91
|
-
<div className="bg-green-500/10 px-2 py-1 rounded text-center border border-green-500/20">
|
|
92
|
-
<div className="text-[10px] font-bold text-green-400">87%</div>
|
|
93
|
-
<div className="text-[7px] text-slate-500">Aprobación</div>
|
|
94
|
-
</div>
|
|
95
|
-
<div className="bg-blue-500/10 px-2 py-1 rounded text-center border border-blue-500/20">
|
|
96
|
-
<div className="text-[10px] font-bold text-blue-400">$71.2M</div>
|
|
97
|
-
<div className="text-[7px] text-slate-500">Ticket Prom</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div className="flex-1 overflow-y-auto p-3 space-y-2.5">
|
|
103
|
-
|
|
104
|
-
{/* Vehicle Selector */}
|
|
105
|
-
<div>
|
|
106
|
-
<div className="text-[9px] text-slate-500 font-bold uppercase mb-1.5 flex items-center gap-1"><Car size={10} /> Tu Kia</div>
|
|
107
|
-
<div className="grid grid-cols-4 gap-1">
|
|
108
|
-
{VEHICLES_CATALOG.map((v, i) => (
|
|
109
|
-
<button key={v.model} onClick={() => setSelectedVehicle(i)}
|
|
110
|
-
className={`p-1.5 rounded-lg border text-center transition-all ${selectedVehicle === i
|
|
111
|
-
? 'bg-red-500/10 border-red-500/40 shadow-[0_0_10px_rgba(239,68,68,0.1)]'
|
|
112
|
-
: 'bg-slate-900 border-slate-800 hover:border-slate-700'}`}>
|
|
113
|
-
<div className="text-sm">{v.image}</div>
|
|
114
|
-
<div className="text-[9px] font-semibold">{v.model}</div>
|
|
115
|
-
<div className="text-[8px] text-slate-500">{formatCOP(v.price)}</div>
|
|
116
|
-
</button>
|
|
117
|
-
))}
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
{/* Plan Selector */}
|
|
122
|
-
<div>
|
|
123
|
-
<div className="text-[9px] text-slate-500 font-bold uppercase mb-1.5 flex items-center gap-1"><CreditCard size={10} /> Tipo de Plan</div>
|
|
124
|
-
<div className="flex gap-1.5">
|
|
125
|
-
{PLANS.map(p => (
|
|
126
|
-
<button key={p.id} onClick={() => setSelectedPlan(p.id)}
|
|
127
|
-
className={`flex-1 py-2 rounded-lg text-xs font-semibold border transition-all ${selectedPlan === p.id
|
|
128
|
-
? 'bg-white text-black border-white' : 'bg-slate-900 text-slate-300 border-slate-700 hover:border-slate-600'}`}>
|
|
129
|
-
{p.icon} {p.label}
|
|
130
|
-
</button>
|
|
131
|
-
))}
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
|
|
135
|
-
{/* Sliders */}
|
|
136
|
-
{plan.id !== 'renting' && (
|
|
137
|
-
<>
|
|
138
|
-
<div>
|
|
139
|
-
<div className="flex justify-between text-[10px] mb-1">
|
|
140
|
-
<span className="text-slate-400 flex items-center gap-1"><Percent size={10} /> Cuota Inicial</span>
|
|
141
|
-
<span className="font-bold text-white">{downPayment}% ({formatCOP(downAmount)})</span>
|
|
142
|
-
</div>
|
|
143
|
-
<input type="range" min={10} max={70} value={downPayment}
|
|
144
|
-
onChange={e => setDownPayment(Number(e.target.value))}
|
|
145
|
-
className="w-full h-1 bg-slate-700 rounded-full appearance-none cursor-pointer accent-red-500" />
|
|
146
|
-
</div>
|
|
147
|
-
<div>
|
|
148
|
-
<div className="flex justify-between text-[10px] mb-1">
|
|
149
|
-
<span className="text-slate-400 flex items-center gap-1"><Calendar size={10} /> Plazo</span>
|
|
150
|
-
<span className="font-bold text-white">{months} meses</span>
|
|
151
|
-
</div>
|
|
152
|
-
<input type="range" min={12} max={84} step={12} value={months}
|
|
153
|
-
onChange={e => setMonths(Number(e.target.value))}
|
|
154
|
-
className="w-full h-1 bg-slate-700 rounded-full appearance-none cursor-pointer accent-red-500" />
|
|
155
|
-
</div>
|
|
156
|
-
</>
|
|
157
|
-
)}
|
|
158
|
-
|
|
159
|
-
{/* Insurance Toggle */}
|
|
160
|
-
<div className="flex items-center justify-between bg-slate-900 border border-slate-800 rounded-lg p-2">
|
|
161
|
-
<div className="flex items-center gap-2 text-[10px]">
|
|
162
|
-
<Shield size={12} className="text-blue-400" />
|
|
163
|
-
<span>Seguro Todo-Riesgo</span>
|
|
164
|
-
<span className="text-slate-500">{formatCOP(vehicle.insurance)}/año</span>
|
|
165
|
-
</div>
|
|
166
|
-
<button onClick={() => setIncludeInsurance(!includeInsurance)}
|
|
167
|
-
className={`w-8 h-4 rounded-full transition-all ${includeInsurance ? 'bg-green-500' : 'bg-slate-700'}`}>
|
|
168
|
-
<div className={`w-3.5 h-3.5 rounded-full bg-white transition-all ${includeInsurance ? 'ml-4' : 'ml-0.5'}`} />
|
|
169
|
-
</button>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
{/* Result Preview */}
|
|
173
|
-
<div className="bg-slate-900 border border-slate-800 rounded-xl p-3">
|
|
174
|
-
<div className="text-[9px] text-slate-500 uppercase font-bold mb-1">Cuota Mensual Estimada</div>
|
|
175
|
-
<div className="text-2xl font-bold text-white">
|
|
176
|
-
{formatCOP(totalMonthly)}<span className="text-sm text-slate-500 font-normal">/mes</span>
|
|
177
|
-
</div>
|
|
178
|
-
<div className="flex gap-3 mt-1.5 text-[10px] text-slate-400">
|
|
179
|
-
{plan.id !== 'renting' && <span>Financiado: {formatCOP(financed)}</span>}
|
|
180
|
-
{plan.id !== 'renting' && <span>Tasa: {plan.rate}% NMV</span>}
|
|
181
|
-
{includeInsurance && <span className="text-blue-400">+Seguro: {formatCOP(monthlyInsurance)}/mes</span>}
|
|
182
|
-
</div>
|
|
183
|
-
{plan.id === 'renting' && (
|
|
184
|
-
<div className="text-[10px] text-slate-400 mt-1 flex items-center gap-1">
|
|
185
|
-
<Shield size={10} /> Incluye seguro, mantenimiento, impuestos y asistencia
|
|
186
|
-
</div>
|
|
187
|
-
)}
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
{/* AI Pre-Approval */}
|
|
191
|
-
<button onClick={runApproval} disabled={analyzing}
|
|
192
|
-
className="w-full bg-red-600 hover:bg-red-500 disabled:opacity-50 text-white text-xs font-bold py-2.5 rounded-lg flex items-center justify-center gap-2 transition-all">
|
|
193
|
-
<Brain size={14} className={analyzing ? 'animate-spin' : ''} />
|
|
194
|
-
{analyzing ? 'Evaluando perfil crediticio...' : '🧠 Pre-aprobación IA'}
|
|
195
|
-
</button>
|
|
196
|
-
|
|
197
|
-
{showResult && approvalDetails && (
|
|
198
|
-
<div className="bg-green-500/10 border border-green-500/30 rounded-xl p-3">
|
|
199
|
-
<div className="flex items-center gap-2 mb-2">
|
|
200
|
-
<CheckCircle2 className="text-green-400" size={16} />
|
|
201
|
-
<span className="text-sm font-bold text-green-400">¡Pre-aprobado!</span>
|
|
202
|
-
</div>
|
|
203
|
-
<div className="grid grid-cols-3 gap-2 mb-2">
|
|
204
|
-
<div className="bg-slate-900/50 rounded-lg p-1.5 text-center">
|
|
205
|
-
<div className="text-xs font-bold text-green-400">{approvalDetails.score}</div>
|
|
206
|
-
<div className="text-[8px] text-slate-500">Score</div>
|
|
207
|
-
</div>
|
|
208
|
-
<div className="bg-slate-900/50 rounded-lg p-1.5 text-center">
|
|
209
|
-
<div className="text-[10px] font-bold text-blue-400">{approvalDetails.bank.name}</div>
|
|
210
|
-
<div className="text-[8px] text-slate-500">Mejor Tasa</div>
|
|
211
|
-
</div>
|
|
212
|
-
<div className="bg-slate-900/50 rounded-lg p-1.5 text-center">
|
|
213
|
-
<div className="text-[10px] font-bold text-white">{formatCOP(approvalDetails.cupo)}</div>
|
|
214
|
-
<div className="text-[8px] text-slate-500">Cupo</div>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
<div className="text-[10px] text-slate-300 leading-relaxed">
|
|
218
|
-
Asesor financiero notificado. Documentación requerida: cédula, extractos 3 meses, certificado laboral.
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
)}
|
|
222
|
-
</div>
|
|
223
|
-
</div>
|
|
224
|
-
</BaseNode>
|
|
225
|
-
);
|
|
226
|
-
};
|