minerva-plexus-csd 1.1.37 → 1.1.38
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.
|
@@ -2378,17 +2378,18 @@ const m1 = {
|
|
|
2378
2378
|
if (!e)
|
|
2379
2379
|
throw new Error("useApiConfig must be used within an ApiConfigProvider");
|
|
2380
2380
|
return e;
|
|
2381
|
-
}, sy = (e) =>
|
|
2382
|
-
|
|
2383
|
-
e
|
|
2384
|
-
"→",
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2381
|
+
}, sy = (e) => {
|
|
2382
|
+
if (!e) return "";
|
|
2383
|
+
const t = new Date(e);
|
|
2384
|
+
console.log("RAW timestamp:", e, "→", t);
|
|
2385
|
+
const n = t.toLocaleTimeString("es-ES", {
|
|
2386
|
+
hour: "2-digit",
|
|
2387
|
+
minute: "2-digit",
|
|
2388
|
+
timeZone: "Europe/Madrid",
|
|
2389
|
+
hourCycle: "h23"
|
|
2390
|
+
});
|
|
2391
|
+
return console.log("Formatted time:", n), n;
|
|
2392
|
+
}, A1 = D.div`
|
|
2392
2393
|
display: flex;
|
|
2393
2394
|
flex-direction: column;
|
|
2394
2395
|
align-items: flex-end; /* Alinea todo a la derecha */
|
|
@@ -807,7 +807,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
807
807
|
margin-bottom: 4px;
|
|
808
808
|
`,p1=L.div`
|
|
809
809
|
font-size: 13px;
|
|
810
|
-
`,Xc=()=>{const{t:e}=at.useTranslation("minerva"),{addMessage:t,fetchMessages:n,stopStreamingResponse:r,isBotStreaming:a,currentBotMessageId:i,messages:o,goTicket:s}=Cr(),{selectedConversation:l,addConversation:u,selectConversation:c,service:d,serviceTicketing:f,serviceTicketingNoUSer:p}=Kt(),[b,S]=I.useState(""),[A,T]=I.useState(!1),[E,m]=I.useState(!1),[x,v]=I.useState(null),h=M=>{v(M),M.success||setTimeout(()=>v(null),5e3)},k=async()=>{if(!b.trim())return;let M=l==null?void 0:l.id;if(S(""),T(!0),!M){const N=e("text.new_conversation");try{M=(await u(N,d)).id,c(M,d)}catch(P){console.error("Error creating new conversation:",P),T(!1);return}}if(M)try{await t(M,b,d),T(!1)}catch(N){console.error("Error sending message:",N),T(!1)}else console.error("No conversation selected or user ID is not available"),T(!1)},D=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),k())},R=async()=>{if(!(!(l!=null&&l.id)||E)){m(!0);try{await r(l.id)||console.warn("No se pudo detener el streaming correctamente")}catch(M){console.error("Error al detener el streaming:",M)}finally{m(!1)}}};return g.jsxs(jv,{children:[!s||a?g.jsx(l1,{text:b,setText:S,isBotStreaming:a,isSending:A,isStoppingStream:E,handleSendMessage:k,handleStopStreaming:R,handleInput:()=>{},handleKeyPress:D}):g.jsx(Zc,{selectedConversationId:l==null?void 0:l.id,serviceTicketingNoUSer:p??!1,onTicketResult:h}),x&&g.jsx(u1,{children:g.jsxs(c1,{success:x.success,children:[g.jsx(d1,{children:x.success?e("ticket.successTitle"):e("ticket.error")}),g.jsx(p1,{children:x.message}),x.success?g.jsx("button",{style:{marginTop:"12px",alignSelf:"flex-end",padding:"6px 12px",backgroundColor:"#2e7d32",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"13px"},onClick:()=>window.location.reload(),children:e("ticket.aceptar")}):null]})})]})},Jc=I.createContext(void 0),f1=({children:e,initialConfig:t})=>{const[n]=I.useState({...Ve(),...t});return g.jsx(Jc.Provider,{value:n,children:e})},g1=()=>{const e=I.useContext(Jc);if(!e)throw new Error("useApiConfig must be used within an ApiConfigProvider");return e},Qc=e=>e
|
|
810
|
+
`,Xc=()=>{const{t:e}=at.useTranslation("minerva"),{addMessage:t,fetchMessages:n,stopStreamingResponse:r,isBotStreaming:a,currentBotMessageId:i,messages:o,goTicket:s}=Cr(),{selectedConversation:l,addConversation:u,selectConversation:c,service:d,serviceTicketing:f,serviceTicketingNoUSer:p}=Kt(),[b,S]=I.useState(""),[A,T]=I.useState(!1),[E,m]=I.useState(!1),[x,v]=I.useState(null),h=M=>{v(M),M.success||setTimeout(()=>v(null),5e3)},k=async()=>{if(!b.trim())return;let M=l==null?void 0:l.id;if(S(""),T(!0),!M){const N=e("text.new_conversation");try{M=(await u(N,d)).id,c(M,d)}catch(P){console.error("Error creating new conversation:",P),T(!1);return}}if(M)try{await t(M,b,d),T(!1)}catch(N){console.error("Error sending message:",N),T(!1)}else console.error("No conversation selected or user ID is not available"),T(!1)},D=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),k())},R=async()=>{if(!(!(l!=null&&l.id)||E)){m(!0);try{await r(l.id)||console.warn("No se pudo detener el streaming correctamente")}catch(M){console.error("Error al detener el streaming:",M)}finally{m(!1)}}};return g.jsxs(jv,{children:[!s||a?g.jsx(l1,{text:b,setText:S,isBotStreaming:a,isSending:A,isStoppingStream:E,handleSendMessage:k,handleStopStreaming:R,handleInput:()=>{},handleKeyPress:D}):g.jsx(Zc,{selectedConversationId:l==null?void 0:l.id,serviceTicketingNoUSer:p??!1,onTicketResult:h}),x&&g.jsx(u1,{children:g.jsxs(c1,{success:x.success,children:[g.jsx(d1,{children:x.success?e("ticket.successTitle"):e("ticket.error")}),g.jsx(p1,{children:x.message}),x.success?g.jsx("button",{style:{marginTop:"12px",alignSelf:"flex-end",padding:"6px 12px",backgroundColor:"#2e7d32",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"13px"},onClick:()=>window.location.reload(),children:e("ticket.aceptar")}):null]})})]})},Jc=I.createContext(void 0),f1=({children:e,initialConfig:t})=>{const[n]=I.useState({...Ve(),...t});return g.jsx(Jc.Provider,{value:n,children:e})},g1=()=>{const e=I.useContext(Jc);if(!e)throw new Error("useApiConfig must be used within an ApiConfigProvider");return e},Qc=e=>{if(!e)return"";const t=new Date(e);console.log("RAW timestamp:",e,"→",t);const n=t.toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit",timeZone:"Europe/Madrid",hourCycle:"h23"});return console.log("Formatted time:",n),n},m1=L.div`
|
|
811
811
|
display: flex;
|
|
812
812
|
flex-direction: column;
|
|
813
813
|
align-items: flex-end; /* Alinea todo a la derecha */
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "minerva-plexus-csd",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "A reusable chat logic library for React applications",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.38",
|
|
6
6
|
"main": "dist/minerva-plexus-csd.umd.js",
|
|
7
7
|
"module": "dist/minerva-plexus-csd.es.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|