@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,250 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { BaseNode } from '@decido/macia-core';
3
- import {
4
- GraduationCap, Trophy, Star, CheckCircle2, XCircle, Users,
5
- Flame, Award, ArrowRight, RotateCcw, BookOpen, Target,
6
- TrendingUp, Zap, Medal, Clock
7
- } from 'lucide-react';
8
-
9
- /* ═══════════════════════════════════════════════════════════════
10
- KIA ACADEMY NODE — Sales Academy · Grecco Motors
11
- Capacitación gamificada con quizzes, certificaciones, leaderboard
12
- ═══════════════════════════════════════════════════════════════ */
13
-
14
- const LEADERBOARD = [
15
- { name: 'Johan S. Blanco', role: 'Asesor Premium', xp: 6820, streak: 22, avatar: '👨‍💼', cert: 'EV Specialist', convRate: '66.8%' },
16
- { name: 'Camila Torres', role: 'Asesora Senior', xp: 5450, streak: 15, avatar: '👩‍💼', cert: 'ADAS Expert', convRate: '58.2%' },
17
- { name: 'Alejandra Ríos', role: 'Asesora Comercial', xp: 4200, streak: 8, avatar: '👩‍🦰', cert: 'Finance Pro', convRate: '52.1%' },
18
- { name: 'Miguel Sánchez', role: 'Asesor Junior', xp: 3100, streak: 5, avatar: '👨‍🦱', cert: null, convRate: '41.3%' },
19
- { name: 'Pedro Gómez', role: 'Asesor Trainee', xp: 1780, streak: 3, avatar: '🧑', cert: null, convRate: '28.7%' },
20
- ];
21
-
22
- const QUIZ_QUESTIONS = [
23
- { q: '¿Cuál es la autonomía real del Kia EV6 GT con batería de 77.4 kWh?', options: ['320 km', '424 km', '510 km', '385 km'], correct: 1, fact: 'El EV6 GT ofrece hasta 424 km en ciclo WLTP combinado. Carga 10-80% en 18 min.' },
24
- { q: '¿Qué tecnología de carga rápida usa la plataforma E-GMP?', options: ['CCS Combo 800V', 'CHAdeMO', 'Tesla Supercharger', 'Type 1'], correct: 0, fact: 'CCS Combo con arquitectura 800V permite carga ultra-rápida hasta 350kW.' },
25
- { q: '¿Cuántos airbags tiene el Sportage 2024 full?', options: ['4', '6', '7', '8'], correct: 2, fact: '7 airbags: frontales, laterales, cortina y rodilla conductor. NCAP 5 estrellas.' },
26
- { q: '¿Qué significa el score "S" en Partner Program?', options: ['Standard', 'Superior', 'Supreme', 'Satisfactorio'], correct: 2, fact: '"S" = Supreme. Máximo nivel del Partner Program de KIA Corporation.' },
27
- { q: '¿Cuál es el market share actual de Grecco Motors?', options: ['8.7%', '11.2%', '13.3%', '15.1%'], correct: 2, fact: '13.3% — #1 en la región. 2.1pp por encima del segundo competidor.' },
28
- ];
29
-
30
- const CERTIFICATIONS = [
31
- { name: 'EV Specialist', icon: '⚡', status: 'completed', progress: 100, xpReward: 500 },
32
- { name: 'ADAS Expert', icon: '🛡️', status: 'completed', progress: 100, xpReward: 400 },
33
- { name: 'Finance Pro', icon: '💰', status: 'in-progress', progress: 72, xpReward: 450 },
34
- { name: 'Posventa Master', icon: '🔧', status: 'locked', progress: 0, xpReward: 350 },
35
- { name: 'Digital Sales', icon: '📱', status: 'locked', progress: 0, xpReward: 600 },
36
- ];
37
-
38
- const MODULES = [
39
- { name: 'Portafolio EV', progress: 100, icon: '⚡', lessons: 12 },
40
- { name: 'Técnicas de Cierre Grecco', progress: 85, icon: '🎯', lessons: 8 },
41
- { name: 'Financiación & Seguros', progress: 72, icon: '💰', lessons: 10 },
42
- { name: 'ADAS & Seguridad', progress: 100, icon: '🛡️', lessons: 6 },
43
- { name: 'Posventa Predictiva', progress: 35, icon: '🔧', lessons: 9 },
44
- { name: 'Digital Sales & CRM', progress: 15, icon: '📱', lessons: 7 },
45
- ];
46
-
47
- export const KiaAcademyNode = (props: any) => {
48
- const [view, setView] = useState<'dashboard' | 'quiz' | 'certs'>('dashboard');
49
- const [currentQ, setCurrentQ] = useState(0);
50
- const [score, setScore] = useState(0);
51
- const [answered, setAnswered] = useState<number | null>(null);
52
- const [quizDone, setQuizDone] = useState(false);
53
- const [tick, setTick] = useState(0);
54
-
55
- useEffect(() => {
56
- const iv = setInterval(() => setTick(t => t + 1), 8000);
57
- return () => clearInterval(iv);
58
- }, []);
59
-
60
- const question = QUIZ_QUESTIONS[currentQ];
61
- const totalProgress = Math.round(MODULES.reduce((s, m) => s + m.progress, 0) / MODULES.length);
62
-
63
- const handleAnswer = (idx: number) => {
64
- if (answered !== null) return;
65
- setAnswered(idx);
66
- if (idx === question.correct) setScore(s => s + 100);
67
- setTimeout(() => {
68
- if (currentQ < QUIZ_QUESTIONS.length - 1) {
69
- setCurrentQ(c => c + 1);
70
- setAnswered(null);
71
- } else {
72
- setQuizDone(true);
73
- }
74
- }, 1500);
75
- };
76
-
77
- const resetQuiz = () => { setCurrentQ(0); setScore(0); setAnswered(null); setQuizDone(false); };
78
-
79
- return (
80
- <BaseNode {...props} title="Kia Sales Academy" width={460} height={640}>
81
- <div className="flex flex-col h-full bg-slate-950 text-white overflow-hidden">
82
-
83
- {/* Header */}
84
- <div className="flex items-center gap-3 p-3 bg-slate-900 border-b border-slate-800">
85
- <div className="w-9 h-9 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
86
- <span className="text-red-500 font-bold text-[7px] tracking-widest">KIA</span>
87
- </div>
88
- <div className="flex-1">
89
- <div className="text-xs font-bold tracking-wide">SALES ACADEMY</div>
90
- <div className="text-[10px] text-slate-400">Grecco Motors · Capacitación Gamificada</div>
91
- </div>
92
- <div className="flex gap-1">
93
- {(['dashboard', 'quiz', 'certs'] as const).map(v => (
94
- <button key={v} onClick={() => { setView(v); if (v === 'quiz') resetQuiz(); }}
95
- className={`px-2 py-1 text-[9px] rounded font-semibold transition-colors ${view === v ? 'bg-white text-black' : 'bg-slate-700 text-slate-300'}`}>
96
- {v === 'dashboard' ? '📊' : v === 'quiz' ? '🧠' : '🏅'} {v.charAt(0).toUpperCase() + v.slice(1)}
97
- </button>
98
- ))}
99
- </div>
100
- </div>
101
-
102
- {view === 'dashboard' && (
103
- <div className="flex-1 overflow-y-auto p-3 space-y-3">
104
-
105
- {/* Progress Ring + Stats */}
106
- <div className="flex items-center gap-4 bg-slate-900 rounded-xl p-3 border border-slate-800">
107
- <div className="relative w-16 h-16 shrink-0">
108
- <svg className="w-16 h-16 -rotate-90" viewBox="0 0 36 36">
109
- <path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="#1e293b" strokeWidth="3" />
110
- <path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="#ef4444" strokeWidth="3" strokeDasharray={`${totalProgress}, 100`} strokeLinecap="round" />
111
- </svg>
112
- <div className="absolute inset-0 flex items-center justify-center text-sm font-bold">{totalProgress}%</div>
113
- </div>
114
- <div className="flex-1">
115
- <div className="text-sm font-bold">Progreso General</div>
116
- <div className="text-[10px] text-slate-400">{MODULES.filter(m => m.progress === 100).length} de {MODULES.length} módulos completados</div>
117
- <div className="flex items-center gap-3 mt-1">
118
- <span className="flex items-center gap-1 text-[10px] text-orange-400"><Flame size={10} /> Racha: 8 días</span>
119
- <span className="flex items-center gap-1 text-[10px] text-yellow-400"><Star size={10} /> 4,200 XP</span>
120
- </div>
121
- </div>
122
- </div>
123
-
124
- {/* Modules */}
125
- <div>
126
- <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><BookOpen size={10} /> Módulos ({MODULES.length})</div>
127
- <div className="space-y-1">
128
- {MODULES.map(m => (
129
- <div key={m.name} className="flex items-center gap-2 bg-slate-900 rounded-lg p-2 border border-slate-800">
130
- <span className="text-sm">{m.icon}</span>
131
- <div className="flex-1 min-w-0">
132
- <div className="text-[10px] font-semibold">{m.name}</div>
133
- <div className="w-full bg-slate-800 rounded-full h-1 mt-0.5">
134
- <div className={`h-full rounded-full transition-all ${m.progress === 100 ? 'bg-green-500' : 'bg-red-500'}`} style={{ width: `${m.progress}%` }} />
135
- </div>
136
- </div>
137
- <div className="text-right shrink-0">
138
- <span className="text-[10px] text-slate-400 font-mono">{m.progress}%</span>
139
- <div className="text-[8px] text-slate-600">{m.lessons} lecciones</div>
140
- </div>
141
- </div>
142
- ))}
143
- </div>
144
- </div>
145
-
146
- {/* Leaderboard */}
147
- <div>
148
- <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><Trophy size={10} /> Top Asesores Grecco</div>
149
- <div className="space-y-1">
150
- {LEADERBOARD.map((u, i) => (
151
- <div key={u.name} className={`flex items-center gap-2 p-2 rounded-lg border ${i === 0 ? 'bg-yellow-500/5 border-yellow-500/20' : 'bg-slate-900 border-slate-800'}`}>
152
- <span className={`text-[10px] font-bold w-4 ${i === 0 ? 'text-yellow-400' : i === 1 ? 'text-slate-300' : i === 2 ? 'text-orange-400' : 'text-slate-500'}`}>{i + 1}</span>
153
- <span className="text-sm">{u.avatar}</span>
154
- <div className="flex-1 min-w-0">
155
- <div className="text-[10px] font-semibold flex items-center gap-1">
156
- {u.name}
157
- {u.cert && <span className="text-[7px] bg-green-500/20 text-green-400 px-1 rounded">{u.cert}</span>}
158
- </div>
159
- <div className="text-[9px] text-slate-500">{u.role} · Conv: {u.convRate}</div>
160
- </div>
161
- <div className="text-right shrink-0">
162
- <div className="text-[10px] font-bold text-yellow-400 flex items-center gap-0.5"><Star size={8} /> {u.xp.toLocaleString()}</div>
163
- <div className="text-[8px] text-slate-500 flex items-center gap-0.5"><Flame size={7} /> {u.streak}d</div>
164
- </div>
165
- </div>
166
- ))}
167
- </div>
168
- </div>
169
- </div>
170
- )}
171
-
172
- {view === 'certs' && (
173
- <div className="flex-1 overflow-y-auto p-3 space-y-2">
174
- <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><Medal size={10} /> Certificaciones KIA</div>
175
- {CERTIFICATIONS.map(c => (
176
- <div key={c.name} className={`bg-slate-900 rounded-lg p-3 border ${c.status === 'completed' ? 'border-green-500/30' : c.status === 'in-progress' ? 'border-yellow-500/30' : 'border-slate-800 opacity-60'}`}>
177
- <div className="flex items-center gap-2">
178
- <span className="text-xl">{c.icon}</span>
179
- <div className="flex-1">
180
- <div className="text-xs font-bold flex items-center gap-1.5">
181
- {c.name}
182
- {c.status === 'completed' && <CheckCircle2 size={12} className="text-green-400" />}
183
- </div>
184
- <div className="text-[9px] text-slate-500">Recompensa: {c.xpReward} XP</div>
185
- {c.status !== 'locked' && (
186
- <div className="w-full bg-slate-800 rounded-full h-1.5 mt-1.5">
187
- <div className={`h-full rounded-full ${c.status === 'completed' ? 'bg-green-500' : 'bg-yellow-500'}`} style={{ width: `${c.progress}%` }} />
188
- </div>
189
- )}
190
- </div>
191
- <span className={`text-[9px] font-bold px-2 py-0.5 rounded ${c.status === 'completed' ? 'bg-green-500/10 text-green-400' : c.status === 'in-progress' ? 'bg-yellow-500/10 text-yellow-400' : 'bg-slate-800 text-slate-500'}`}>
192
- {c.status === 'completed' ? '✅ Obtenida' : c.status === 'in-progress' ? `${c.progress}%` : '🔒 Bloqueada'}
193
- </span>
194
- </div>
195
- </div>
196
- ))}
197
- </div>
198
- )}
199
-
200
- {view === 'quiz' && !quizDone && (
201
- <div className="flex-1 flex flex-col p-4">
202
- <div className="flex items-center justify-between mb-2">
203
- <div className="text-[10px] text-slate-400">Pregunta {currentQ + 1}/{QUIZ_QUESTIONS.length}</div>
204
- <div className="text-[10px] text-yellow-400 font-bold flex items-center gap-1"><Star size={10} /> {score} XP</div>
205
- </div>
206
- <div className="w-full bg-slate-800 rounded-full h-1 mb-4">
207
- <div className="h-full bg-red-500 rounded-full transition-all" style={{ width: `${((currentQ + 1) / QUIZ_QUESTIONS.length) * 100}%` }} />
208
- </div>
209
- <div className="text-sm font-semibold mb-4 leading-relaxed">{question.q}</div>
210
- <div className="space-y-2 flex-1">
211
- {question.options.map((opt, i) => {
212
- let bg = 'bg-slate-900 border-slate-700 hover:border-slate-600';
213
- if (answered !== null) {
214
- if (i === question.correct) bg = 'bg-green-500/10 border-green-500/40';
215
- else if (i === answered) bg = 'bg-red-500/10 border-red-500/40';
216
- }
217
- return (
218
- <button key={i} onClick={() => handleAnswer(i)}
219
- className={`w-full text-left p-3 rounded-lg border text-xs transition-all flex items-center gap-2 ${bg}`}>
220
- <span className="w-5 h-5 rounded-full bg-slate-800 flex items-center justify-center text-[10px] font-bold text-slate-400">{String.fromCharCode(65 + i)}</span>
221
- {opt}
222
- {answered !== null && i === question.correct && <CheckCircle2 size={14} className="ml-auto text-green-400" />}
223
- {answered !== null && i === answered && i !== question.correct && <XCircle size={14} className="ml-auto text-red-400" />}
224
- </button>
225
- );
226
- })}
227
- </div>
228
- {answered !== null && (
229
- <div className="mt-3 bg-blue-500/10 border border-blue-500/20 rounded-lg p-2 text-[10px] text-blue-200">💡 {question.fact}</div>
230
- )}
231
- </div>
232
- )}
233
-
234
- {view === 'quiz' && quizDone && (
235
- <div className="flex-1 flex flex-col items-center justify-center p-6 text-center">
236
- <Award className="text-yellow-400 mb-4" size={48} />
237
- <h3 className="text-xl font-bold mb-1">¡Quiz Completado!</h3>
238
- <div className="text-slate-400 mb-4">Puntaje: <strong className="text-yellow-400">{score} XP</strong> de {QUIZ_QUESTIONS.length * 100}</div>
239
- <div className={`text-sm font-semibold mb-6 ${score >= 400 ? 'text-green-400' : score >= 200 ? 'text-yellow-400' : 'text-red-400'}`}>
240
- {score >= 400 ? '🏆 ¡Excelente! Nivel Expert.' : score >= 200 ? '📚 Buen intento. ¡Sigue practicando!' : '🔄 Necesitas repasar los módulos.'}
241
- </div>
242
- <button onClick={resetQuiz} className="flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-500 rounded-lg text-xs font-bold transition-all">
243
- <RotateCcw size={14} /> Intentar de Nuevo
244
- </button>
245
- </div>
246
- )}
247
- </div>
248
- </BaseNode>
249
- );
250
- };
@@ -1,207 +0,0 @@
1
- import React, { useState, useEffect, useRef, useCallback } from 'react';
2
- import { BaseNode } from '@decido/macia-core';
3
- import {
4
- Send, User, Bot, MoreVertical, Phone, Video,
5
- CheckCheck, Sparkles, ThumbsUp, AlertCircle, Zap
6
- } from 'lucide-react';
7
-
8
- /* ═══════════════════════════════════════════════════════════════
9
- KIA BOT NODE — Agente IA WhatsApp con Lead Qualification
10
- Simula conversación inteligente + scoring automático
11
- ═══════════════════════════════════════════════════════════════ */
12
-
13
- type LeadScore = { score: number; label: string; color: string };
14
-
15
- /** Simulated AI response engine */
16
- const getAIResponse = (input: string, context: string[]): { text: string; qualifier?: LeadScore } => {
17
- const lower = input.toLowerCase();
18
-
19
- if (lower.includes('precio') || lower.includes('costo') || lower.includes('cuánto') || lower.includes('cuanto')) {
20
- return {
21
- text: '💰 El precio de lanzamiento desde $78.990.000. Tenemos planes de financiación hasta 72 meses con tasa desde 0.99%. ¿Te gustaría agendar un Test Drive?',
22
- qualifier: { score: 85, label: 'Alta Intención', color: '#22c55e' }
23
- };
24
- }
25
- if (lower.includes('agendar') || lower.includes('cita') || lower.includes('visitar') || lower.includes('test drive')) {
26
- return {
27
- text: '🚗 ¡Perfecto! He notificado al equipo comercial. Johan Blanco, nuestro mejor asesor, te contactará en menos de 5 min. ¿Prefieres en la mañana o en la tarde?',
28
- qualifier: { score: 95, label: 'Lead Caliente 🔥', color: '#ef4444' }
29
- };
30
- }
31
- if (lower.includes('sedan') || lower.includes('cross') || lower.includes('sportage') || lower.includes('seltos') || lower.includes('ev')) {
32
- return {
33
- text: '✨ Excelente gusto. Ese modelo tiene motor turbo, ADAS nivel 2, y pantalla de 12.3". Viene con 7 años de garantía. ¿Deseas comparar con otro modelo?',
34
- qualifier: { score: 72, label: 'Interés Técnico', color: '#3b82f6' }
35
- };
36
- }
37
- if (lower.includes('financ') || lower.includes('crédito') || lower.includes('credito') || lower.includes('cuotas')) {
38
- return {
39
- text: '🏦 Tenemos alianza con 5 bancos. Pre-aprobación IA en 30 segundos. Solo necesito tu cédula y comprobante de ingresos. ¿Te interesa?',
40
- qualifier: { score: 80, label: 'Intención Financiera', color: '#f59e0b' }
41
- };
42
- }
43
- if (lower.includes('hola') || lower.includes('buenas') || lower.includes('hi')) {
44
- return { text: '¡Hola! 👋 Soy Kia AI, tu asistente virtual 24/7. ¿En qué puedo ayudarte? Puedo informarte sobre modelos, precios, financiación o agendar una cita.' };
45
- }
46
- if (lower.includes('gracias') || lower.includes('ok') || lower.includes('listo')) {
47
- return { text: '✅ ¡Con gusto! Si necesitas algo más, estoy disponible 24/7. Tu referencia de conversación es KIA-' + Math.floor(Math.random() * 10000) + '. ¡Que tengas un excelente día!' };
48
- }
49
-
50
- // Default
51
- if (context.length > 4) {
52
- return {
53
- text: '📋 He analizado tu perfil y creo que el modelo ideal para ti es el Seltos. ¿Te gustaría conocerlo en persona? Puedo agendar una cita ahora mismo.',
54
- qualifier: { score: 60, label: 'Nutrición', color: '#a855f7' }
55
- };
56
- }
57
- return { text: 'Entiendo. ¿Te interesa conocer nuestros modelos, ver opciones de financiación, o agendar una visita al showroom?' };
58
- };
59
-
60
- export const KiaBotNode = (props: any) => {
61
- const [messages, setMessages] = useState([
62
- { id: 1, text: 'Hola, estoy interesado en el nuevo Kia EV6.', sender: 'user', time: '10:30 AM' },
63
- { id: 2, text: '¡Hola! 👋 Bienvenido a Kia Grecco Motors. Soy tu asistente IA. El EV6 es nuestro vehículo eléctrico premium. ¿Te interesa la versión GT o Standard?', sender: 'bot', time: '10:30 AM' },
64
- ]);
65
- const [input, setInput] = useState('');
66
- const [isTyping, setIsTyping] = useState(false);
67
- const [leadScore, setLeadScore] = useState<LeadScore | null>(null);
68
- const [qualifiedLeads, setQualifiedLeads] = useState(23);
69
- const messagesEndRef = useRef<HTMLDivElement>(null);
70
-
71
- const scrollToBottom = useCallback(() => {
72
- messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
73
- }, []);
74
-
75
- useEffect(scrollToBottom, [messages, scrollToBottom]);
76
-
77
- const handleSend = useCallback(() => {
78
- if (!input.trim()) return;
79
-
80
- const time = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
81
- const newMsg = { id: Date.now(), text: input, sender: 'user', time };
82
- setMessages(prev => [...prev, newMsg]);
83
- const currentInput = input;
84
- setInput('');
85
- setIsTyping(true);
86
-
87
- // Simulate AI processing with realistic delay
88
- const delay = 1200 + Math.random() * 1500;
89
- setTimeout(() => {
90
- const context = messages.map(m => m.text);
91
- const { text, qualifier } = getAIResponse(currentInput, context);
92
-
93
- setMessages(prev => [...prev, {
94
- id: Date.now() + 1, text, sender: 'bot',
95
- time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
96
- }]);
97
- setIsTyping(false);
98
-
99
- if (qualifier) {
100
- setLeadScore(qualifier);
101
- if (qualifier.score >= 80) setQualifiedLeads(q => q + 1);
102
- }
103
- }, delay);
104
- }, [input, messages]);
105
-
106
- return (
107
- <BaseNode {...props} title="Kia AI Concierge" width={400} height={640}>
108
- <div className="flex flex-col h-full bg-[#0b141a] overflow-hidden">
109
-
110
- {/* WhatsApp Header */}
111
- <div className="bg-[#202c33] p-3 flex items-center gap-3 text-white shadow-md z-10">
112
- <div className="w-10 h-10 rounded-full bg-white flex items-center justify-center overflow-hidden border border-white/20">
113
- <span className="text-[#008069] font-bold text-[8px] tracking-widest">KIA</span>
114
- </div>
115
- <div className="flex-1">
116
- <h3 className="font-semibold text-sm">Kia AI · Grecco Motors</h3>
117
- <div className="flex items-center gap-2">
118
- <span className="text-[10px] text-green-400">● En línea 24/7</span>
119
- <span className="text-[10px] text-slate-400">|</span>
120
- <span className="text-[10px] text-slate-400 flex items-center gap-1">
121
- <Sparkles size={8} /> IA Activa
122
- </span>
123
- </div>
124
- </div>
125
- <div className="flex gap-3 text-white/60">
126
- <Video size={18} />
127
- <Phone size={18} />
128
- <MoreVertical size={18} />
129
- </div>
130
- </div>
131
-
132
- {/* Lead Score Banner */}
133
- {leadScore && (
134
- <div
135
- className="px-3 py-1.5 flex items-center justify-between text-xs transition-all duration-500"
136
- style={{ background: `${leadScore.color}22`, borderBottom: `1px solid ${leadScore.color}44` }}
137
- >
138
- <div className="flex items-center gap-2">
139
- <Zap size={12} style={{ color: leadScore.color }} />
140
- <span style={{ color: leadScore.color }} className="font-bold">{leadScore.label}</span>
141
- </div>
142
- <div className="flex items-center gap-2">
143
- <div className="h-1.5 w-20 bg-slate-800 rounded-full overflow-hidden">
144
- <div className="h-full rounded-full transition-all duration-700" style={{ width: `${leadScore.score}%`, background: leadScore.color }} />
145
- </div>
146
- <span className="font-mono text-[10px]" style={{ color: leadScore.color }}>{leadScore.score}</span>
147
- </div>
148
- </div>
149
- )}
150
-
151
- {/* Chat Area */}
152
- <div className="flex-1 overflow-y-auto p-3 space-y-2">
153
- {messages.map((msg) => (
154
- <div key={msg.id} className={`flex ${msg.sender === 'user' ? 'justify-end' : 'justify-start'}`}>
155
- <div className={`max-w-[80%] rounded-lg px-3 py-1.5 shadow-sm text-sm relative ${msg.sender === 'user'
156
- ? 'bg-[#005c4b] text-white rounded-tr-none'
157
- : 'bg-[#202c33] text-white rounded-tl-none'
158
- }`}>
159
- <p className="leading-relaxed">{msg.text}</p>
160
- <span className="text-[10px] text-gray-400 flex items-center justify-end gap-1 mt-0.5">
161
- {msg.time}
162
- {msg.sender === 'user' && <CheckCheck size={12} className="text-blue-400" />}
163
- {msg.sender === 'bot' && <Sparkles size={8} className="text-purple-400" />}
164
- </span>
165
- </div>
166
- </div>
167
- ))}
168
- {isTyping && (
169
- <div className="flex justify-start">
170
- <div className="bg-[#202c33] rounded-lg px-4 py-2 shadow-sm rounded-tl-none">
171
- <span className="flex gap-1">
172
- <span className="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '0ms' }} />
173
- <span className="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '150ms' }} />
174
- <span className="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '300ms' }} />
175
- </span>
176
- </div>
177
- </div>
178
- )}
179
- <div ref={messagesEndRef} />
180
- </div>
181
-
182
- {/* Stats Footer */}
183
- <div className="bg-[#202c33] px-3 py-1 flex items-center justify-between text-[10px] text-slate-500 border-t border-slate-800">
184
- <span>Hoy: <span className="text-green-400 font-bold">{qualifiedLeads}</span> leads calificados</span>
185
- <span>Tasa Respuesta: <span className="text-blue-400 font-bold">98.2%</span></span>
186
- </div>
187
-
188
- {/* Input Area */}
189
- <div className="bg-[#202c33] p-2 flex items-center gap-2">
190
- <input
191
- className="flex-1 bg-[#2a3942] rounded-lg px-4 py-2 text-sm focus:outline-none text-white placeholder-slate-500"
192
- placeholder="Escribe un mensaje..."
193
- value={input}
194
- onChange={(e) => setInput(e.target.value)}
195
- onKeyDown={(e) => e.key === 'Enter' && handleSend()}
196
- />
197
- <button
198
- onClick={handleSend}
199
- className="p-2 bg-[#008069] rounded-full text-white hover:bg-[#006d59] transition-colors"
200
- >
201
- <Send size={18} />
202
- </button>
203
- </div>
204
- </div>
205
- </BaseNode>
206
- );
207
- };