@decido/discovery-studio 0.1.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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +278 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +213 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React9, { memo, useState, useEffect, useRef, useCallback } from 'react';
|
|
2
2
|
import { io } from 'socket.io-client';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { kernel } from '@decido/kernel-bridge';
|
|
@@ -123,10 +123,7 @@ var SideExplorer = ({ selectedContact, onSelectContact }) => {
|
|
|
123
123
|
),
|
|
124
124
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
125
125
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
"+",
|
|
128
|
-
conv.phone
|
|
129
|
-
] }),
|
|
126
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold truncate", style: { color: "var(--text-primary)" }, children: conv.profile_name || "+" + conv.phone }),
|
|
130
127
|
/* @__PURE__ */ jsx("span", { className: "text-[9px] shrink-0 ml-1", style: { color: "var(--text-secondary)" }, children: conv.last_activity.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
131
128
|
] }),
|
|
132
129
|
/* @__PURE__ */ jsx("p", { className: "text-[10px] truncate mt-0.5", style: { color: "var(--text-secondary)" }, children: conv.last_message || "Media" })
|
|
@@ -183,9 +180,9 @@ var CONTACT_DETAILS = {
|
|
|
183
180
|
tags: ["VIP", "Frecuente", "Muebler\xEDa"],
|
|
184
181
|
timeline: [
|
|
185
182
|
{ time: "2m", event: "Pregunt\xF3 por estado de pedido", icon: "fas fa-comment" },
|
|
186
|
-
{ time: "1d", event: "Pedido PED-1847 en
|
|
187
|
-
{ time: "3d", event: "
|
|
188
|
-
{ time: "1w", event: "
|
|
183
|
+
{ time: "1d", event: "Pedido PED-1847 en PRODUCTION", icon: "fas fa-industry" },
|
|
184
|
+
{ time: "3d", event: "Transici\xF3n a IN_CUTTING (Control)", icon: "fas fa-check-circle" },
|
|
185
|
+
{ time: "1w", event: "Tracking Link Generado", icon: "fas fa-link" }
|
|
189
186
|
]
|
|
190
187
|
},
|
|
191
188
|
c2: {
|
|
@@ -200,7 +197,7 @@ var CONTACT_DETAILS = {
|
|
|
200
197
|
tags: ["Empresa", "Nuevo"],
|
|
201
198
|
timeline: [
|
|
202
199
|
{ time: "15m", event: "Solicit\xF3 cotizaci\xF3n de mesa", icon: "fas fa-comment" },
|
|
203
|
-
{ time: "2d", event: "
|
|
200
|
+
{ time: "2d", event: "RuleEngine Trigger: NEW Order", icon: "fas fa-bolt" }
|
|
204
201
|
]
|
|
205
202
|
}
|
|
206
203
|
};
|
|
@@ -318,7 +315,46 @@ var AgentPanel = () => {
|
|
|
318
315
|
setIsTyping(false);
|
|
319
316
|
}
|
|
320
317
|
});
|
|
321
|
-
|
|
318
|
+
let es = null;
|
|
319
|
+
try {
|
|
320
|
+
es = new EventSource("http://localhost:3001/api/events");
|
|
321
|
+
es.addEventListener("whatsapp:message_received", (e) => {
|
|
322
|
+
try {
|
|
323
|
+
const data = JSON.parse(e.data);
|
|
324
|
+
setMessages((prev) => [...prev, {
|
|
325
|
+
id: Date.now().toString(),
|
|
326
|
+
text: `\u{1F4F1} [WA] ${data.profileName || data.from}: ${data.text || "Archivo Adjunto"}`,
|
|
327
|
+
type: "user"
|
|
328
|
+
}]);
|
|
329
|
+
setIsTyping(true);
|
|
330
|
+
setTimeout(() => {
|
|
331
|
+
setMessages((p) => [...p, { id: Date.now().toString(), text: "Regla disparada: Mensaje recibido. Evaluando intenci\xF3n...", type: "system" }]);
|
|
332
|
+
setIsTyping(false);
|
|
333
|
+
}, 1e3);
|
|
334
|
+
} catch (e2) {
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
es.addEventListener("whatsapp:status_update", (e) => {
|
|
338
|
+
try {
|
|
339
|
+
const data = JSON.parse(e.data);
|
|
340
|
+
setMessages((prev) => [...prev, {
|
|
341
|
+
id: Date.now().toString(),
|
|
342
|
+
text: `\u2714\uFE0F [Estado WA] ${data.status} a ${data.recipient_id}`,
|
|
343
|
+
type: "system"
|
|
344
|
+
}]);
|
|
345
|
+
} catch (e2) {
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
es.onerror = () => {
|
|
349
|
+
es?.close();
|
|
350
|
+
};
|
|
351
|
+
} catch (e) {
|
|
352
|
+
console.log("SSE Error, falling back to local kernel");
|
|
353
|
+
}
|
|
354
|
+
return () => {
|
|
355
|
+
unsubscribe();
|
|
356
|
+
if (es) es.close();
|
|
357
|
+
};
|
|
322
358
|
}, []);
|
|
323
359
|
const handleSend = async () => {
|
|
324
360
|
if (!input.trim()) return;
|
|
@@ -719,6 +755,56 @@ var BotActionNode = memo(({ id, data, selected }) => {
|
|
|
719
755
|
);
|
|
720
756
|
});
|
|
721
757
|
BotActionNode.displayName = "BotActionNode";
|
|
758
|
+
var TrackingPreview = ({ token = "demo-token-123", onClose }) => {
|
|
759
|
+
const trackingUrl = `http://localhost:3001/track/${token}`;
|
|
760
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
761
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-[400px] bg-[#0E1525] rounded-[24px] overflow-hidden border border-white/10 shadow-2xl flex flex-col h-[700px] max-h-[90vh] relative animate-in zoom-in-95", children: [
|
|
762
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute top-4 right-4 z-10 flex gap-2", children: [
|
|
763
|
+
/* @__PURE__ */ jsx(
|
|
764
|
+
"button",
|
|
765
|
+
{
|
|
766
|
+
onClick: () => window.open(trackingUrl, "_blank"),
|
|
767
|
+
className: "w-8 h-8 rounded-full bg-white/10 backdrop-blur-md flex items-center justify-center text-white/70 hover:text-white hover:bg-white/20 transition-colors",
|
|
768
|
+
title: "Abrir en nueva pesta\xF1a",
|
|
769
|
+
children: /* @__PURE__ */ jsx("i", { className: "fas fa-external-link-alt text-xs" })
|
|
770
|
+
}
|
|
771
|
+
),
|
|
772
|
+
/* @__PURE__ */ jsx(
|
|
773
|
+
"button",
|
|
774
|
+
{
|
|
775
|
+
onClick: onClose,
|
|
776
|
+
className: "w-8 h-8 rounded-full bg-white/10 backdrop-blur-md flex items-center justify-center text-white/70 hover:text-white hover:bg-white/20 transition-colors",
|
|
777
|
+
title: "Cerrar vista previa",
|
|
778
|
+
children: /* @__PURE__ */ jsx("i", { className: "fas fa-times text-xs" })
|
|
779
|
+
}
|
|
780
|
+
)
|
|
781
|
+
] }),
|
|
782
|
+
/* @__PURE__ */ jsx("div", { className: "h-7 w-full bg-black flex justify-center items-start shrink-0", children: /* @__PURE__ */ jsx("div", { className: "w-[120px] h-5 bg-black rounded-b-xl" }) }),
|
|
783
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-2 bg-black/50 border-b border-white/5 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "bg-white/5 rounded-lg px-3 py-1 flex items-center gap-2 text-[10px] text-white/40 w-fit", children: [
|
|
784
|
+
/* @__PURE__ */ jsx("i", { className: "fas fa-lock text-[8px]" }),
|
|
785
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
786
|
+
"decido.com/track/",
|
|
787
|
+
token
|
|
788
|
+
] })
|
|
789
|
+
] }) }),
|
|
790
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 relative bg-black", children: [
|
|
791
|
+
isLoading && /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-[#0E1525] text-white/50", children: [
|
|
792
|
+
/* @__PURE__ */ jsx("i", { className: "fas fa-circle-notch fa-spin text-2xl text-emerald-500 mb-3" }),
|
|
793
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Cargando vista m\xF3vil..." })
|
|
794
|
+
] }),
|
|
795
|
+
/* @__PURE__ */ jsx(
|
|
796
|
+
"iframe",
|
|
797
|
+
{
|
|
798
|
+
src: trackingUrl,
|
|
799
|
+
className: `w-full h-full border-none transition-opacity duration-300 ${isLoading ? "opacity-0" : "opacity-100"}`,
|
|
800
|
+
onLoad: () => setIsLoading(false),
|
|
801
|
+
title: "Tracking Portal Preview"
|
|
802
|
+
}
|
|
803
|
+
)
|
|
804
|
+
] }),
|
|
805
|
+
/* @__PURE__ */ jsx("div", { className: "h-6 w-full bg-black flex justify-center items-center shrink-0", children: /* @__PURE__ */ jsx("div", { className: "w-[120px] h-1 bg-white/20 rounded-full" }) })
|
|
806
|
+
] }) });
|
|
807
|
+
};
|
|
722
808
|
var nodeTypes = {
|
|
723
809
|
messageNode: MessageNode,
|
|
724
810
|
botAction: BotActionNode
|
|
@@ -736,14 +822,14 @@ var initialNodes = [
|
|
|
736
822
|
id: "ai-intent",
|
|
737
823
|
type: "botAction",
|
|
738
824
|
position: { x: 400, y: 280 },
|
|
739
|
-
data: { label: "
|
|
825
|
+
data: { label: "Reconocimiento Intenci\xF3n IA", actionType: "analyze", description: 'Detectar Intenci\xF3n: "Estado de Pedido"' }
|
|
740
826
|
},
|
|
741
827
|
// Database Check
|
|
742
828
|
{
|
|
743
829
|
id: "db-check",
|
|
744
830
|
type: "botAction",
|
|
745
831
|
position: { x: 750, y: 150 },
|
|
746
|
-
data: { label: "
|
|
832
|
+
data: { label: "Acci\xF3n Ejecutada", actionType: "decision", description: "Action: GENERATE_TRACKING_LINK" }
|
|
747
833
|
},
|
|
748
834
|
{
|
|
749
835
|
id: "escalate-human",
|
|
@@ -756,13 +842,13 @@ var initialNodes = [
|
|
|
756
842
|
id: "reply-status",
|
|
757
843
|
type: "messageNode",
|
|
758
844
|
position: { x: 1050, y: 150 },
|
|
759
|
-
data: { label: "
|
|
845
|
+
data: { label: "Regla: SEND_WA_TEMPLATE", type: "outgoing", text: "Template: pedido_produccion\nPar\xE1metros: [legacyId, trackUrl]", time: "10:06 AM" }
|
|
760
846
|
},
|
|
761
847
|
{
|
|
762
848
|
id: "assign-agent",
|
|
763
849
|
type: "messageNode",
|
|
764
850
|
position: { x: 1050, y: 400 },
|
|
765
|
-
data: { label: "Soporte Asignado", type: "system", text: "Asignando Chat #3421
|
|
851
|
+
data: { label: "Soporte Asignado", type: "system", text: "Asignando Chat #3421 (Humano en la ruta)" }
|
|
766
852
|
}
|
|
767
853
|
];
|
|
768
854
|
var initialEdges = [
|
|
@@ -776,6 +862,7 @@ var initialEdges = [
|
|
|
776
862
|
var FlowCanvasTab = () => {
|
|
777
863
|
const [nodes, setNodes] = useState(initialNodes);
|
|
778
864
|
const [edges, setEdges] = useState(initialEdges);
|
|
865
|
+
const [previewOpen, setPreviewOpen] = useState(false);
|
|
779
866
|
const onNodesChange = useCallback((changes) => {
|
|
780
867
|
}, []);
|
|
781
868
|
const onEdgesChange = useCallback((changes) => {
|
|
@@ -783,6 +870,11 @@ var FlowCanvasTab = () => {
|
|
|
783
870
|
const onConnect = useCallback((params) => {
|
|
784
871
|
setEdges((eds) => [...eds, { ...params, id: `e-${Date.now()}`, animated: true }]);
|
|
785
872
|
}, [setEdges]);
|
|
873
|
+
const onNodeClick = useCallback((event, node) => {
|
|
874
|
+
if (node.data?.description?.includes("GENERATE_TRACKING_LINK") || node.data?.text?.includes("trackUrl")) {
|
|
875
|
+
setPreviewOpen(true);
|
|
876
|
+
}
|
|
877
|
+
}, []);
|
|
786
878
|
return /* @__PURE__ */ jsxs("div", { className: "flex-1 min-h-0 flex flex-col overflow-hidden", children: [
|
|
787
879
|
/* @__PURE__ */ jsxs(
|
|
788
880
|
"div",
|
|
@@ -834,9 +926,11 @@ var FlowCanvasTab = () => {
|
|
|
834
926
|
onNodesChange,
|
|
835
927
|
onEdgesChange,
|
|
836
928
|
onConnect,
|
|
929
|
+
onNodeClick,
|
|
837
930
|
nodeTypes
|
|
838
931
|
}
|
|
839
|
-
) })
|
|
932
|
+
) }),
|
|
933
|
+
previewOpen && /* @__PURE__ */ jsx(TrackingPreview, { onClose: () => setPreviewOpen(false) })
|
|
840
934
|
] });
|
|
841
935
|
};
|
|
842
936
|
var HOURLY_DATA = [
|
|
@@ -993,7 +1087,7 @@ var AnalyticsTab = () => {
|
|
|
993
1087
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-1", style: { gridTemplateColumns: "auto repeat(24, 1fr)" }, children: [
|
|
994
1088
|
/* @__PURE__ */ jsx("div", {}),
|
|
995
1089
|
Array.from({ length: 24 }, (_, i) => /* @__PURE__ */ jsx("div", { className: "text-[7px] text-center font-bold", style: { color: "var(--text-secondary)" }, children: i }, i)),
|
|
996
|
-
["Lun", "Mar", "Mi\xE9", "Jue", "Vie", "S\xE1b", "Dom"].map((day, di) => /* @__PURE__ */ jsxs(
|
|
1090
|
+
["Lun", "Mar", "Mi\xE9", "Jue", "Vie", "S\xE1b", "Dom"].map((day, di) => /* @__PURE__ */ jsxs(React9.Fragment, { children: [
|
|
997
1091
|
/* @__PURE__ */ jsx("div", { className: "text-[9px] font-bold pr-2 flex items-center", style: { color: "var(--text-secondary)" }, children: day }),
|
|
998
1092
|
Array.from({ length: 24 }, (_, hi) => {
|
|
999
1093
|
const intensity = Math.random();
|
|
@@ -1031,7 +1125,7 @@ var ApiTesterTab = () => {
|
|
|
1031
1125
|
const [templateVariables, setTemplateVariables] = useState([]);
|
|
1032
1126
|
const [templates, setTemplates] = useState([]);
|
|
1033
1127
|
const [fetchingTemplates, setFetchingTemplates] = useState(false);
|
|
1034
|
-
|
|
1128
|
+
React9.useEffect(() => {
|
|
1035
1129
|
const saved = localStorage.getItem("wa_api_tester_phones");
|
|
1036
1130
|
if (saved) {
|
|
1037
1131
|
try {
|
|
@@ -1041,7 +1135,7 @@ var ApiTesterTab = () => {
|
|
|
1041
1135
|
}
|
|
1042
1136
|
fetchTemplates();
|
|
1043
1137
|
}, []);
|
|
1044
|
-
|
|
1138
|
+
React9.useEffect(() => {
|
|
1045
1139
|
const selected = templates.find((t) => t.name === templateName && t.language === templateLanguage);
|
|
1046
1140
|
if (selected) {
|
|
1047
1141
|
const bodyComponent = selected.components?.find((c) => c.type === "BODY" || c.type === "body");
|
|
@@ -1687,6 +1781,103 @@ var TemplateManagerTab = () => {
|
|
|
1687
1781
|
] })
|
|
1688
1782
|
] }) });
|
|
1689
1783
|
};
|
|
1784
|
+
var SUGGESTIONS = [
|
|
1785
|
+
{ icon: "fas fa-comment-dots", color: "text-indigo-400", bg: "bg-indigo-500/10", text: "Saluda al cliente cuando se cree un pedido" },
|
|
1786
|
+
{ icon: "fas fa-camera", color: "text-amber-400", bg: "bg-amber-500/10", text: "Detecta pagos en fotos de comprobante" },
|
|
1787
|
+
{ icon: "fas fa-industry", color: "text-emerald-400", bg: "bg-emerald-500/10", text: "Avisa por WhatsApp al pasar a Producci\xF3n" },
|
|
1788
|
+
{ icon: "fas fa-truck", color: "text-cyan-400", bg: "bg-cyan-500/10", text: "Pedido listo: avisa si >$1M" }
|
|
1789
|
+
];
|
|
1790
|
+
var RulesArchitectTab = () => {
|
|
1791
|
+
const [prompt, setPrompt] = useState("");
|
|
1792
|
+
const [loading, setLoading] = useState(false);
|
|
1793
|
+
const [result, setResult] = useState(null);
|
|
1794
|
+
const [error, setError] = useState(null);
|
|
1795
|
+
const generateRule = async (textToUse) => {
|
|
1796
|
+
const text = textToUse || prompt;
|
|
1797
|
+
if (!text.trim()) return;
|
|
1798
|
+
setLoading(true);
|
|
1799
|
+
setError(null);
|
|
1800
|
+
setResult(null);
|
|
1801
|
+
try {
|
|
1802
|
+
const res = await fetch("http://localhost:3001/api/whatsapp/rules/generate", {
|
|
1803
|
+
method: "POST",
|
|
1804
|
+
headers: {
|
|
1805
|
+
"Content-Type": "application/json",
|
|
1806
|
+
// Note: Mocking tenant matching local dev
|
|
1807
|
+
"x-tenant-id": "dev-tenant"
|
|
1808
|
+
},
|
|
1809
|
+
body: JSON.stringify({ prompt: text })
|
|
1810
|
+
});
|
|
1811
|
+
if (!res.ok) throw new Error("Error al generar regla IA");
|
|
1812
|
+
const data = await res.json();
|
|
1813
|
+
setResult(JSON.stringify(data.rule || data, null, 2));
|
|
1814
|
+
} catch (err) {
|
|
1815
|
+
setError(err.message || "Error de conexi\xF3n con el AI Service");
|
|
1816
|
+
} finally {
|
|
1817
|
+
setLoading(false);
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
return /* @__PURE__ */ jsx("div", { className: "flex-1 h-full flex flex-col items-center justify-center p-8 bg-black/20 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-3xl", children: [
|
|
1821
|
+
/* @__PURE__ */ jsxs("div", { className: "text-center mb-10 text-white", children: [
|
|
1822
|
+
/* @__PURE__ */ jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-indigo-500/20 text-indigo-400 mb-6 border border-indigo-500/30 shadow-[0_0_30px_rgba(99,102,241,0.2)]", children: /* @__PURE__ */ jsx("i", { className: "fas fa-wand-magic-sparkles text-2xl" }) }),
|
|
1823
|
+
/* @__PURE__ */ jsx("h2", { className: "text-3xl font-black tracking-tight mb-3", children: "Workflow Architect" }),
|
|
1824
|
+
/* @__PURE__ */ jsx("p", { className: "text-zinc-400 max-w-lg mx-auto leading-relaxed", children: "Escribe una instrucci\xF3n en lenguaje natural y Sentinal AI generar\xE1 la regla JSON requerida para la automatizaci\xF3n de WhatsApp." })
|
|
1825
|
+
] }),
|
|
1826
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3 mb-8", children: SUGGESTIONS.map((s, i) => /* @__PURE__ */ jsxs(
|
|
1827
|
+
"button",
|
|
1828
|
+
{
|
|
1829
|
+
onClick: () => {
|
|
1830
|
+
setPrompt(s.text);
|
|
1831
|
+
generateRule(s.text);
|
|
1832
|
+
},
|
|
1833
|
+
className: `flex items-center gap-3 p-4 text-left rounded-xl transition-all border border-white/5 bg-zinc-900/50 hover:bg-zinc-800/80 hover:border-white/10 group`,
|
|
1834
|
+
children: [
|
|
1835
|
+
/* @__PURE__ */ jsx("div", { className: `w-8 h-8 shrink-0 flex items-center justify-center rounded-lg ${s.bg} ${s.color}`, children: /* @__PURE__ */ jsx("i", { className: s.icon }) }),
|
|
1836
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-zinc-300 group-hover:text-white leading-tight", children: s.text })
|
|
1837
|
+
]
|
|
1838
|
+
},
|
|
1839
|
+
i
|
|
1840
|
+
)) }),
|
|
1841
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
1842
|
+
/* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
1843
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none", children: /* @__PURE__ */ jsx("i", { className: "fas fa-terminal text-zinc-500" }) }),
|
|
1844
|
+
/* @__PURE__ */ jsx(
|
|
1845
|
+
"input",
|
|
1846
|
+
{
|
|
1847
|
+
type: "text",
|
|
1848
|
+
value: prompt,
|
|
1849
|
+
onChange: (e) => setPrompt(e.target.value),
|
|
1850
|
+
onKeyDown: (e) => e.key === "Enter" && generateRule(),
|
|
1851
|
+
placeholder: "Ej: Cuando un pedido pase de Producci\xF3n a Dispatch, env\xEDa una plantilla...",
|
|
1852
|
+
className: "block w-full pl-11 pr-32 py-4 bg-zinc-950/80 border-2 border-zinc-800 rounded-xl text-sm outline-none text-zinc-200 placeholder-zinc-600 focus:border-indigo-500/50 focus:bg-zinc-950 transition-all shadow-inner"
|
|
1853
|
+
}
|
|
1854
|
+
),
|
|
1855
|
+
/* @__PURE__ */ jsx(
|
|
1856
|
+
"button",
|
|
1857
|
+
{
|
|
1858
|
+
onClick: () => generateRule(),
|
|
1859
|
+
disabled: loading || !prompt.trim(),
|
|
1860
|
+
className: "absolute right-2 top-2 bottom-2 px-6 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white font-bold rounded-lg text-sm transition-all shadow-lg active:scale-95 flex items-center gap-2",
|
|
1861
|
+
children: loading ? /* @__PURE__ */ jsx("i", { className: "fas fa-circle-notch fa-spin" }) : "Generar"
|
|
1862
|
+
}
|
|
1863
|
+
)
|
|
1864
|
+
] }),
|
|
1865
|
+
error && /* @__PURE__ */ jsxs("div", { className: "p-4 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-400 text-sm flex items-start gap-3 animate-in fade-in slide-in-from-top-2", children: [
|
|
1866
|
+
/* @__PURE__ */ jsx("i", { className: "fas fa-exclamation-circle mt-0.5" }),
|
|
1867
|
+
/* @__PURE__ */ jsx("div", { children: error })
|
|
1868
|
+
] }),
|
|
1869
|
+
result && /* @__PURE__ */ jsxs("div", { className: "rounded-xl overflow-hidden border border-zinc-800 bg-[#0d1117] relative animate-in zoom-in-95 fade-in duration-300 shadow-2xl", children: [
|
|
1870
|
+
/* @__PURE__ */ jsxs("div", { className: "px-4 py-2 border-b border-zinc-800 bg-[#161b22] flex items-center gap-2", children: [
|
|
1871
|
+
/* @__PURE__ */ jsx("i", { className: "fab fa-js text-yellow-400/80 text-xs" }),
|
|
1872
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-zinc-400", children: "generated_rule.json" }),
|
|
1873
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
1874
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase font-bold text-emerald-400 bg-emerald-500/10 px-2 py-0.5 rounded", children: "V\xE1lido" })
|
|
1875
|
+
] }),
|
|
1876
|
+
/* @__PURE__ */ jsx("pre", { className: "p-5 text-xs font-mono leading-relaxed text-[#c9d1d9] overflow-x-auto whitespace-pre-wrap max-h-[300px] overflow-y-auto custom-scrollbar", children: result })
|
|
1877
|
+
] })
|
|
1878
|
+
] })
|
|
1879
|
+
] }) });
|
|
1880
|
+
};
|
|
1690
1881
|
var useStatusMetrics = () => {
|
|
1691
1882
|
const [metrics, setMetrics] = useState({
|
|
1692
1883
|
activeChats: 12,
|
|
@@ -1708,7 +1899,7 @@ var useStatusMetrics = () => {
|
|
|
1708
1899
|
}, []);
|
|
1709
1900
|
return metrics;
|
|
1710
1901
|
};
|
|
1711
|
-
var StatusBarMetrics =
|
|
1902
|
+
var StatusBarMetrics = React9.memo(() => {
|
|
1712
1903
|
const metrics = useStatusMetrics();
|
|
1713
1904
|
return /* @__PURE__ */ jsxs(
|
|
1714
1905
|
"div",
|
|
@@ -1756,6 +1947,7 @@ var StatusBarMetrics = React8.memo(() => {
|
|
|
1756
1947
|
var TABS = [
|
|
1757
1948
|
{ id: "chat", label: "Live Chat", icon: "fas fa-comments" },
|
|
1758
1949
|
{ id: "flow", label: "Flow Canvas", icon: "fas fa-project-diagram" },
|
|
1950
|
+
{ id: "architect", label: "Workflow Architect", icon: "fas fa-wand-magic-sparkles" },
|
|
1759
1951
|
{ id: "analytics", label: "Analytics", icon: "fas fa-chart-bar" },
|
|
1760
1952
|
{ id: "api_tester", label: "API Tester", icon: "fas fa-vial" },
|
|
1761
1953
|
{ id: "templates", label: "Templates", icon: "fas fa-layer-group" }
|
|
@@ -1789,6 +1981,7 @@ var DiscoveryStudio = ({ gatewayStatus = "connected", activeProvider = "Meta Clo
|
|
|
1789
1981
|
const commands = [
|
|
1790
1982
|
{ id: "chat", label: "Abrir Chat en Vivo", icon: "fas fa-comments", action: () => setActiveTab("chat") },
|
|
1791
1983
|
{ id: "flow", label: "Abrir Flow Canvas", icon: "fas fa-project-diagram", action: () => setActiveTab("flow") },
|
|
1984
|
+
{ id: "architect", label: "Abrir Workflow Architect (IA)", icon: "fas fa-wand-magic-sparkles", action: () => setActiveTab("architect") },
|
|
1792
1985
|
{ id: "analytics", label: "Abrir Analytics", icon: "fas fa-chart-bar", action: () => setActiveTab("analytics") },
|
|
1793
1986
|
{ id: "explorer", label: explorerOpen ? "Cerrar Explorer" : "Abrir Explorer", icon: "fas fa-folder-tree", action: () => setExplorerOpen((p) => !p) },
|
|
1794
1987
|
{ id: "inspector", label: inspectorOpen ? "Cerrar Inspector" : "Abrir Inspector", icon: "fas fa-info-circle", action: () => setInspectorOpen((p) => !p) },
|
|
@@ -1946,6 +2139,7 @@ var DiscoveryStudio = ({ gatewayStatus = "connected", activeProvider = "Meta Clo
|
|
|
1946
2139
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 flex flex-col overflow-hidden", children: [
|
|
1947
2140
|
activeTab === "chat" && /* @__PURE__ */ jsx(ChatTab, { selectedContact }),
|
|
1948
2141
|
activeTab === "flow" && /* @__PURE__ */ jsx(FlowCanvasTab, {}),
|
|
2142
|
+
activeTab === "architect" && /* @__PURE__ */ jsx(RulesArchitectTab, {}),
|
|
1949
2143
|
activeTab === "analytics" && /* @__PURE__ */ jsx(AnalyticsTab, {}),
|
|
1950
2144
|
activeTab === "api_tester" && /* @__PURE__ */ jsx(ApiTesterTab, {}),
|
|
1951
2145
|
activeTab === "templates" && /* @__PURE__ */ jsx(TemplateManagerTab, {})
|