PageSourceSearch

https://winsap.com.py/static/js/6346.d4dceff9.chunk.js

js winsap.com.py collected 2026-10-02 02:05:56 UTC 9,593 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkwhatsflow_enterprise=self.webpackChunkwhatsflow_enterprise||[]).push([[6346],{93965:(e,t,o)=>{o.d(t,{TransferNotificationListener:()=>s});var r=o(65043),a=o(27310),n=o(17870),i=o(97499);const s=()=>{const{user:e}=(0,a.A)(),t=(0,n.Y)(),o=null!==e&&void 0!==e&&e.id?"string"===typeof e.id?parseInt(e.id):e.id:void 0;return(0,i.D)(t,o),(0,r.useEffect)(()=>{e&&console.log("\ud83c\udfa7 [LISTENER] Iniciado para usuario: ".concat(e.name," (ID: ").concat(e.id,")"))},[e]),null}},97499:(e,t,o)=>{o.d(t,{D:()=>i});var r=o(65043),a=o(23768),n=o(70579);const i=(e,t)=>{const o=(0,r.useRef)(0),i=()=>sessionStorage.getItem("token")||localStorage.getItem("token")||localStorage.getItem("agent_token_backup")||"",s=(0,r.useCallback)(()=>{const e=Date.now();if(!(e-o.current<2e3)){o.current=e;try{const e=new Audio("/notification.mp3");e.volume=.6,e.play().catch(()=>{try{const e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),o=e.createGain();t.connect(o),o.connect(e.destination),t.frequency.value=800,o.gain.value=.15,t.start(),o.gain.exponentialRampToValueAtTime(.001,e.currentTime+.3),t.stop(e.currentTime+.3)}catch(e){}})}catch(t){}}},[]),c=(0,r.useCallback)(e=>{if("Notification"in window&&"granted"===Notification.permission){const t=new Notification("\ud83d\udd14 Nuevo Chat Asignado",{body:"Se te ha asignado el chat con: ".concat(e.chatName),icon:"/logo192.png",tag:e.chatJid,requireInteraction:!0,badge:"/logo192.png",silent:!0});t.onclick=()=>{window.focus(),t.close()},console.log("\ud83d\udd14 Notificaci\xf3n del navegador mostrada")}else"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission().then(t=>{"granted"===t&&c(e)})},[]),d=(0,r.useCallback)(e=>{a.oR.custom(t=>{var o,r;return(0,n.jsx)("div",{style:{maxWidth:"420px",width:"100%",background:"linear-gradient(135deg, #1e293b 0%, #0f172a 100%)",boxShadow:"0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.3)",borderRadius:"16px",pointerEvents:"auto",display:"flex",border:"1px solid rgba(99, 102, 241, 0.3)",overflow:"hidden",animation:t.visible?"slideIn 0.3s ease-out":"slideOut 0.2s ease-in",backdropFilter:"blur(10px)"},children:(0,n.jsxs)("div",{style:{flex:"1",width:0,padding:"1.25rem"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start"},children:[e.avatar?(0,n.jsx)("img",{src:e.avatar,alt:e.chatName,style:{flexShrink:0,width:"52px",height:"52px",borderRadius:"50%",objectFit:"cover",border:"3px solid #6366f1",boxShadow:"0 8px 16px rgba(99, 102, 241, 0.4)"}}):(0,n.jsx)("div",{style:{flexShrink:0,width:"52px",height:"52px",borderRadius:"50%",background:"linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 8px 16px rgba(99, 102, 241, 0.4)",color:"#fff",fontSize:"1.2rem",fontWeight:700},children:(null===(o=e.chatName)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.toUpperCase())||"?"}),(0,n.jsxs)("div",{style:{marginLeft:"1rem",flex:1},children:[(0,n.jsx)("p",{style:{fontSize:"0.95rem",fontWeight:"bold",color:"#f1f5f9",margin:0,letterSpacing:"0.02em"},children:"Nuevo Chat Asignado"}),(0,n.jsxs)("p",{style:{marginTop:"0.5rem",fontSize:"0.875rem",color:"#cbd5e1",margin:"0.5rem 0 0 0",lineHeight:"1.5"},children:["Chat con: ",(0,n.jsx)("strong",{style:{color:"#e0e7ff",fontWeight:600},children:e.chatName})]}),e.phoneNumber&&e.phoneNumber!==e.chatName&&(0,n.jsxs)("p",{style:{marginTop:"0.25rem",fontSize:"0.75rem",color:"#94a3b8",margin:"0.25rem 0 0 0"},children:["\ud83d\udcf1 ",e.phoneNumber]}),e.note&&(0,n.jsxs)("p",{style:{marginTop:"0.75rem",fontSize:"0.875rem",color:"#a5b4fc",backgroundColor:"rgba(99, 102, 241, 0.15)",padding:"0.625rem",borderRadius:"8px",border:"1px solid rgba(99, 102, 241, 0.3)",margin:"0.75rem 0 0 0",backdropFilter:"blur(4px)"},children:["\ud83d\udcdd ",e.note]}),(0,n.jsx)("p",{style:{marginTop:"0.5rem",fontSize:"0.75rem",color:"#94a3b8",margin:"0.5rem 0 0 0"},children:"\ud83d\udd04 Transferido por Admin"})]})]}),(0,n.jsxs)("div",{style:{display:"flex",gap:"0.75rem",marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[(0,n.jsx)("button",{onClick:async()=>{a.oR.dismiss(t.id);try{const t=window.location.origin;await fetch("".concat(t,"/api/agent/transfer/accept"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i())},body:JSON.stringify({chatJid:e.chatJid,sessionId:e.sessionId})}),window.dispatchEvent(new CustomEvent("reload-assigned-chats",{detail:{chatJid:e.chatJid,navigateToChat:!0}}))}catch(o){a.oR.error("Error al aceptar")}},style:{flex:1,border:"none",borderRadius:"10px",padding:"0.875rem 1.25rem",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.875rem",fontWeight:"600",color:"#ffffff",background:"linear-gradient(135deg, #10b981 0%, #059669 100%)",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(16, 185, 129, 0.3)"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 8px 20px rgba(16, 185, 129, 0.4)"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 12px rgba(16, 185, 129, 0.3)"},children:"\u2713 Aceptar"}),(0,n.jsx)("button",{onClick:async()=>{a.oR.dismiss(t.id);try{const t=window.location.origin;await fetch("".concat(t,"/api/agent/transfer/reject"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i())},body:JSON.stringify({chatJid:e.chatJid,sessionId:e.sessionId})}),a.oR.error("\u274c Transferencia rechazada")}catch(o){a.oR.error("Error al rechazar")}},style:{flex:1,border:"none",borderRadius:"10px",padding:"0.875rem 1.25rem",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.875rem",fontWeight:"600",color:"#ffffff",background:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.3)"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 8px 20px rgba(239, 68, 68, 0.4)"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.3)"},children:"\u2715 Rechazar"})]})]})})},{duration:3e4,position:"top-right"}),console.log("\ud83d\udce9 Toast moderno mostrado en la app")},[]);(0,r.useEffect)(()=>
1{if(!e||!t)return void console.log("[NOTIFICATION] \u23f8\ufe0f Socket o userId no disponible");const o="agent-".concat(t,"-new-chat"),r="agent-".concat(t,"-transfer-request"),l="transfer-request-update",f=e=>{console.log("\ud83c\udf89 [NOTIFICATION] Chat transferido recibido:",e),!1!==e.playSound&&s(),!1!==e.showNotification&&c(e),d(e),window.dispatchEvent(new CustomEvent("reload-assigned-chats",{detail:{chatJid:e.chatJid}}))},p=e=>{console.log("\ud83d\udce8 [NOTIFICATION] Solicitud de transferencia recibida:",e),s(),a.oR.custom(t=>(0,n.jsxs)("div",{className:"".concat(t.visible?"animate-enter":"animate-leave"," max-w-md w-full bg-white shadow-xl rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5 overflow-hidden"),children:[(0,n.jsx)("div",{className:"flex-1 w-0 p-4",children:(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:(0,n.jsx)("span",{style:{fontSize:"32px"},children:"\ud83e\udd14"})}),(0,n.jsxs)("div",{className:"ml-3 flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-bold text-gray-900",children:"Solicitud de Transferencia"}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-gray-700",children:[(0,n.jsx)("strong",{children:e.fromUserName})," quiere transferirte un chat."]}),e.reason&&(0,n.jsxs)("p",{className:"mt-2 text-sm text-gray-500 bg-gray-50 px-2 py-1 rounded",children:['"',e.reason,'"']})]})]})}),(0,n.jsxs)("div",{className:"flex border-l border-gray-200 flex-col",children:[(0,n.jsx)("button",{onClick:async()=>{a.oR.dismiss(t.id);try{const t=window.location.origin;await fetch("".concat(t,"/api/transfer-requests/").concat(e.id,"/respond"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i())},body:JSON.stringify({accept:!0})})}catch(o){a.oR.error("Error al aceptar")}},className:"w-full border-b border-gray-200 p-3 flex items-center justify-center text-sm font-medium text-green-600 hover:bg-green-50 focus:outline-none",children:"Aceptar"}),(0,n.jsx)("button",{onClick:async()=>{a.oR.dismiss(t.id);try{const t=window.location.origin;await fetch("".concat(t,"/api/transfer-requests/").concat(e.id,"/respond"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i())},body:JSON.stringify({accept:!1})}),a.oR.error("Transferencia rechazada")}catch(o){a.oR.error("Error al rechazar")}},className:"w-full p-3 flex items-center justify-center text-sm font-medium text-red-600 hover:bg-red-50 focus:outline-none",children:"Rechazar"})]})]}),{duration:3e4,position:"top-right"})},g=e=>{console.log("\ud83d\udce2 [NOTIFICATION] Actualizaci\xf3n de transferencia:",e),"accepted"===e.status||"rejected"===e.status&&a.oR.error("\u274c ".concat(e.by," rechaz\xf3 la transferencia de ").concat(e.chatJid))};return e.on(o,f),e.on(r,p),e.on(l,g),()=>{e.off(o,f),e.off(r,p),e.off(l,g)}},[e,t,s,c,d]),(0,r.useEffect)(()=>{"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission().then(e=>{console.log("\ud83d\udd14 Permiso de notificaciones: ".concat(e))})},[])}}}]);
2//# sourceMappingURL=6346.d4dceff9.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.