@botuyo/chat-widget-standalone 1.1.8 → 1.1.10
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/dist/{AudioPlayer-BxTDuzwm.js → AudioPlayer-t2SM3zem.js} +2 -2
- package/dist/{AudioPlayer-BxTDuzwm.js.map → AudioPlayer-t2SM3zem.js.map} +1 -1
- package/dist/{Gallery-BBui2euL.js → Gallery-DKOEt0A3.js} +2 -2
- package/dist/{Gallery-BBui2euL.js.map → Gallery-DKOEt0A3.js.map} +1 -1
- package/dist/botuyo-chat.es.js +1 -1
- package/dist/botuyo-chat.umd.js +1 -1
- package/dist/botuyo-chat.umd.js.map +1 -1
- package/dist/src/chat-widget/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/{standalone-BLhtkN9D.js → standalone-CxjK2h-4.js} +4 -4
- package/dist/{standalone-BLhtkN9D.js.map → standalone-CxjK2h-4.js.map} +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,UAAU,mBAAmB;IAC3B,6BAA6B;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,qDAAqD;IACrD,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAC7C,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,UAAU,mBAAmB;IAC3B,6BAA6B;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,qDAAqD;IACrD,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAC7C,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,mBAAmB,oDA6FtF"}
|
|
@@ -15,7 +15,7 @@ return y("div",{className:Et("flex items-center w-fit transition-all duration-50
|
|
|
15
15
|
/* @__PURE__ */b(W,{size:10}),
|
|
16
16
|
/* @__PURE__ */y("span",{children:[e.length," fuente",e.length>1?"s":""]}),
|
|
17
17
|
/* @__PURE__ */b("span",{className:"transition-transform duration-200",style:{transform:t?"rotate(180deg)":"rotate(0)"},children:"▾"})]}),t&&/* @__PURE__ */b("div",{className:"flex flex-wrap gap-1 mt-1 animate-in fade-in slide-in-from-top-1 duration-200",children:e.map((e,t)=>/* @__PURE__ */y("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded-md",style:{backgroundColor:"hsl(var(--muted) / 0.4)",color:"hsl(var(--muted-foreground))"},children:[
|
|
18
|
-
/* @__PURE__ */b(W,{size:9}),e]},`${e}-${t}`))})]}):null}),Ul=p(()=>import("./AudioPlayer-
|
|
18
|
+
/* @__PURE__ */b(W,{size:9}),e]},`${e}-${t}`))})]}):null}),Ul=p(()=>import("./AudioPlayer-t2SM3zem.js").then(e=>({default:e.AudioPlayer}))),Vl=p(()=>import("./Gallery-DKOEt0A3.js").then(e=>({default:e.Gallery}))),ql=d(function({message:e,primaryColor:t,botAvatar:n,botName:r="BotUyo",avatars:i,isFirst:a=!0,isLast:s=!0,index:l=0}){const{t:c}=D("extracted"),d="user"===e.sender,p="system"===e.type||"system"===e.sender,f=!d&&!p,m=Ot({primaryColor:t}),g=function(){const e=o(Tt);return e.enabled&&"none"!==e.messageEntry?{slide:"animate-message-slide",fade:"animate-message-fade",scale:"animate-message-scale",spring:"animate-message-spring"}[e.messageEntry]||"animate-message-spring":""}(),w=u(()=>{if(d)return null;if("text"===e.type){const t=e;if(t.emotion&&i?.[t.emotion])return i[t.emotion]}return n},[e,i,n,d]),x=({href:e,children:t})=>{if(!e)return null;const n=String(t).toLowerCase(),r=n.includes("reservar")||n.includes("ver")||n.includes("pagar"),o=e.includes("maps.google")||e.includes("goo.gl")||e.includes("google.com/maps");let i=!1;try{i=new URL(e,window.location.origin).hostname===window.location.hostname}catch{}const a=i?t=>{t.preventDefault(),window.location.href=e}:void 0,s=i?void 0:"_blank",l=i?void 0:"noopener noreferrer";return o?/* @__PURE__ */b("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"block my-2 no-underline group",children:/* @__PURE__ */y("span",{className:"flex items-center gap-3 p-3 border rounded-xl shadow-sm group-hover:border-primary/30 transition-all",style:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"},children:[
|
|
19
19
|
/* @__PURE__ */b("span",{className:"flex-shrink-0 p-2 rounded-full",style:{backgroundColor:`${m}1a`,color:m},children:/* @__PURE__ */b(G,{size:16,strokeWidth:2.5})}),
|
|
20
20
|
/* @__PURE__ */b("span",{className:"flex flex-col min-w-0 flex-1 text-[11px] font-bold text-foreground leading-tight uppercase tracking-tight",children:c("ver_ubicacion")}),
|
|
21
21
|
/* @__PURE__ */b(q,{size:12,className:"text-muted-foreground/40 group-hover:text-primary"})]})}):r?/* @__PURE__ */y("a",{href:e,target:s,rel:l,onClick:a,className:"inline-flex items-center justify-center gap-2 px-4 py-2.5 mt-2 mx-1 text-[11px] font-black w-[calc(100%-0.5rem)] sm:w-auto rounded-xl shadow-md uppercase tracking-widest transition-transform active:scale-95 text-white",style:{backgroundColor:m},children:[t," ",
|
|
@@ -117,14 +117,14 @@ return y("span",{style:{fontSize:"10px",padding:"2px 8px",borderRadius:"12px",ba
|
|
|
117
117
|
/* @__PURE__ */b("button",{onClick:()=>I(e=>!e),style:{width:"52px",height:"52px",borderRadius:"50%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",backgroundColor:A?`${n}20`:"rgba(255,255,255,0.08)",color:A?n:"rgba(255,255,255,0.5)",border:"1px solid "+(A?`${n}30`:"rgba(255,255,255,0.08)")},"aria-label":"Escribir texto",children:/* @__PURE__ */b(J,{style:{width:"20px",height:"20px"}})})]}),A&&/* @__PURE__ */y("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 20px 20px"},children:[
|
|
118
118
|
/* @__PURE__ */b("input",{type:"text",value:T,onChange:e=>M(e.target.value),onKeyDown:e=>"Enter"===e.key&&be(),placeholder:"Escribí email, teléfono, etc.",autoFocus:!0,style:{flex:1,padding:"10px 14px",borderRadius:"12px",border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",color:"white",fontSize:"13px",outline:"none",backdropFilter:"blur(8px)"}}),
|
|
119
119
|
/* @__PURE__ */b("button",{onClick:be,disabled:!T.trim(),style:{width:"40px",height:"40px",borderRadius:"50%",border:"none",cursor:T.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:T.trim()?n:"rgba(255,255,255,0.06)",color:T.trim()?"white":"rgba(255,255,255,0.2)",transition:"all 0.2s"},"aria-label":"Enviar texto",children:/* @__PURE__ */b(re,{style:{width:"16px",height:"16px"}})})]}),
|
|
120
|
-
/* @__PURE__ */b("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(0.95); }\n }\n "})]})}function _c({isOpen:e,isConnected:t,isTyping:n,messages:r,botName:o="BotUyo",logoUrl:l,welcomeMessage:c,inputPlaceholder:u,mediaConfig:d,onClose:p,onSendMessage:h,bubbleStyles:m,avatars:g,onSendAttachment:w,onSendLocation:x,getSocket:k,onAddVoiceMessage:_,avatar3dUrl:S,theme:C,suggestedQuestions:E}){const[z,N]=i(!1),[O,A]=i(!1),[I,T]=i(!1),{t:M}=D(),P=nc(),L=Ot({cssVariables:C?.cssVariables}),j=function({isOpen:e,height:t,bottom:n}){const r=nc(),[o,l]=i({}),c=s(()=>{if(r){const e=()=>{window.visualViewport?l({height:`${window.visualViewport.height}px`,transform:`translateY(${window.visualViewport.offsetTop}px)`}):l({height:"100dvh",transform:"none"})};return e(),window.visualViewport?.addEventListener("resize",e),window.visualViewport?.addEventListener("scroll",e),()=>{window.visualViewport?.removeEventListener("resize",e),window.visualViewport?.removeEventListener("scroll",e)}}{const e=parseFloat(n||rc)||24,r=window.innerHeight-64-e;if(t){const e=parseFloat(t)||700,o=Math.min(e,r);l({height:`${o}px`,maxHeight:`${r}px`,bottom:n||rc})}else{const e=Math.min(700,Math.max(500,r));l({height:`${e}px`,maxHeight:`${r}px`,bottom:n||rc})}}},[r,t,n]);return a(()=>{if(!e)return;const t=c();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),t&&t()}},[e,c]),o}({isOpen:e,height:C?.cssVariables?.windowHeight,bottom:C?.cssVariables?.windowBottom}),F=function({enabled:e,returnFocusRef:t,onEscape:n}){const r=f(null),o=f(null),i=f(n);i.current=n;const l=s(e=>{const t=r.current;if(t)if("Escape"!==e.key){if("Tab"===e.key){const n=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===n.length)return;const r=n[0],o=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),o.focus()):e.shiftKey||document.activeElement!==o||(e.preventDefault(),r.focus())}}else i.current?.()},[]);return a(()=>{if(!e)return;o.current=document.activeElement;const n=t?.current,i=r.current;if(!i)return;const a=setTimeout(()=>{const e=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e.length>0?e[0].focus():i.focus()},100);return document.addEventListener("keydown",l),()=>{clearTimeout(a),document.removeEventListener("keydown",l);const e=n||o.current;e&&"function"==typeof e.focus&&e.focus()}},[e,t,l]),r}({enabled:e,onEscape:p});if(a(()=>{if(e)return P&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}},[e,P]),!e)return null;const R="bottom-left"===C?.position;/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */b("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(0.95); }\n }\n "})]})}function _c({isOpen:e,isConnected:t,isTyping:n,messages:r,botName:o="BotUyo",logoUrl:l,welcomeMessage:c,inputPlaceholder:u,mediaConfig:d,onClose:p,onSendMessage:h,bubbleStyles:m,avatars:g,onSendAttachment:w,onSendLocation:x,getSocket:k,onAddVoiceMessage:_,avatar3dUrl:S,theme:C,suggestedQuestions:E}){const[z,N]=i(!1),[O,A]=i(!1),[I,T]=i(!1),{t:M}=D(),P=nc(),L=Ot({cssVariables:C?.cssVariables}),j=function({isOpen:e,height:t,bottom:n}){const r=nc(),[o,l]=i({}),c=s(()=>{if(r){const e=()=>{window.visualViewport?l({height:`${window.visualViewport.height}px`,transform:`translateY(${window.visualViewport.offsetTop}px)`}):l({height:"100dvh",transform:"none"})};return e(),window.visualViewport?.addEventListener("resize",e),window.visualViewport?.addEventListener("scroll",e),()=>{window.visualViewport?.removeEventListener("resize",e),window.visualViewport?.removeEventListener("scroll",e)}}{const e=parseFloat(n||rc)||24,r=window.innerHeight-64-e;if(t){const e=parseFloat(t)||700,o=Math.min(e,r);l({height:`${o}px`,maxHeight:`${r}px`,bottom:n||rc})}else{const e=Math.min(700,Math.max(500,r));l({height:`${e}px`,maxHeight:`${r}px`,bottom:n||rc})}}},[r,t,n]);return a(()=>{if(!e)return;const t=c();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),t&&t()}},[e,c]),o}({isOpen:e,height:C?.cssVariables?.windowHeight,bottom:C?.cssVariables?.windowBottom}),F=function({enabled:e,returnFocusRef:t,onEscape:n}){const r=f(null),o=f(null),i=f(n);i.current=n;const l=s(e=>{const t=r.current;if(t)if("Escape"!==e.key){if("Tab"===e.key){const n=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===n.length)return;const r=n[0],o=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),o.focus()):e.shiftKey||document.activeElement!==o||(e.preventDefault(),r.focus())}}else i.current?.()},[]);return a(()=>{if(!e)return;o.current=document.activeElement;const n=t?.current,i=r.current;if(!i)return;const a=setTimeout(()=>{const e=i.querySelector('textarea, input[type="text"]');if(e)e.focus();else{const e=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e.length>0?e[0].focus():i.focus()}},100);return document.addEventListener("keydown",l),()=>{clearTimeout(a),document.removeEventListener("keydown",l);const e=n||o.current;e&&"function"==typeof e.focus&&e.focus()}},[e,t,l]),r}({enabled:e,onEscape:p});if(a(()=>{if(e)return P&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}},[e,P]),!e)return null;const R="bottom-left"===C?.position;/* @__PURE__ */
|
|
121
121
|
return y(v,{children:[
|
|
122
122
|
/* @__PURE__ */b("div",{id:"chat-dialog-description",className:"sr-only",children:M("accessibility.dialogDescription",{botName:o??"BotUyo"})}),
|
|
123
123
|
/* @__PURE__ */y("div",{ref:F,role:"dialog","aria-modal":"true","aria-labelledby":"chat-window-title","aria-describedby":"chat-dialog-description",tabIndex:-1,className:Et("flex flex-col overflow-hidden transition-all duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]","text-foreground z-[9999]",!P&&["fixed",R?"left-6":"right-6","border","animate-in fade-in zoom-in-95","slide-in-from-bottom-10"],P&&["fixed inset-0 w-full"]),style:{...j,...P?{}:{width:"350px",minWidth:"350px",maxWidth:"350px",borderRadius:"32px",boxShadow:"0 25px 65px -5px rgba(0, 0, 0, 0.15), 0 8px 20px -8px rgba(0, 0, 0, 0.1)"},backgroundColor:"hsl(var(--background))",borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},children:[
|
|
124
124
|
/* @__PURE__ */b("header",{className:"relative shrink-0 border-b z-20",style:{padding:"var(--spacing-5)",backgroundColor:"hsl(var(--background) / 0.9)",borderColor:"hsl(var(--border))",backdropFilter:"blur(24px)"},children:/* @__PURE__ */y("div",{className:"flex items-center justify-between",children:[
|
|
125
125
|
/* @__PURE__ */y("div",{className:"flex items-center gap-3",children:[
|
|
126
126
|
/* @__PURE__ */y("div",{className:"relative",children:[
|
|
127
|
-
/* @__PURE__ */b("div",{className:"h-10 w-10 rounded-
|
|
127
|
+
/* @__PURE__ */b("div",{className:"h-10 w-10 rounded-full overflow-hidden bg-primary/10 border-2 border-background shadow-soft-sm",children:z?/* @__PURE__ */b("div",{className:"h-full w-full flex items-center justify-center bg-muted text-muted-foreground",children:/* @__PURE__ */b("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */b("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}):/* @__PURE__ */b("img",{src:l||$t,alt:o,className:"h-full w-full object-cover",onError:()=>N(!0)})}),
|
|
128
128
|
/* @__PURE__ */b("div",{className:Et("absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full border-2 border-background",t?"bg-emerald-500":"bg-amber-500 animate-pulse")})]}),
|
|
129
129
|
/* @__PURE__ */y("div",{className:"flex flex-col",children:[
|
|
130
130
|
/* @__PURE__ */y("div",{className:"flex items-center gap-1",children:[
|
|
@@ -180,4 +180,4 @@ return b("div",{style:{width:"100%",height:"100%",position:"relative",overflow:"
|
|
|
180
180
|
/* @__PURE__ */b("directionalLight",{position:[-1,1,-1],intensity:.3,color:"#b4c6e7"}),
|
|
181
181
|
/* @__PURE__ */b("pointLight",{position:[0,.5,-.5],intensity:.5,distance:3}),
|
|
182
182
|
/* @__PURE__ */b(sb,{url:e,autoRotate:o,hasCustomCamera:!(!n||!r)})]})})}):null}const ub="https://api.botuyo.com";class db extends m{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("[BotUyoChat] Widget error:",e,t)}render(){return this.state.hasError?null:this.props.children}}const pb={"--background":"240 10% 3.9%","--foreground":"0 0% 98%","--card":"240 10% 3.9%","--card-foreground":"0 0% 98%","--primary":"160 84% 39%","--primary-foreground":"0 0% 100%","--muted":"240 3.7% 15.9%","--muted-foreground":"240 5% 64.9%","--border":"240 3.7% 15.9%"},hb=p(()=>Promise.resolve().then(()=>ib).then(e=>({default:e.ChatWidgetWithProviders})));class fb{root=null;container=null;shadowRoot=null;mountPoint=null;darkModeObserver=null;darkModeMediaQuery=null;config=null;init(e){return this.config={...e,apiBaseUrl:e.apiBaseUrl||ub},this.render(),this.setupDarkModeDetection(),this}render(){if(!this.config)return void console.error("[BotUyoChat] No configuration provided");if(!this.container){this.container=document.createElement("div"),this.container.id="botuyo-chat-widget-root",document.body.appendChild(this.container),this.shadowRoot=this.container.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=L.replace(/:root/g,":host"),this.shadowRoot.appendChild(e),this.mountPoint=document.createElement("div"),this.mountPoint.id="botuyo-chat-widget-root",this.shadowRoot.appendChild(this.mountPoint)}if(this.config.theme?.cssVariables&&this.mountPoint){const e=this.config.theme.cssVariables;[["--background",e.background],["--foreground",e.foreground],["--card",e.card],["--card-foreground",e.cardForeground],["--primary",e.primary],["--primary-foreground",e.primaryForeground],["--muted",e.muted],["--muted-foreground",e.mutedForeground],["--border",e.border],["--destructive",e.destructive],["--radius",e.radius],["--window-border-radius",e.windowBorderRadius],["--launcher-border-radius",e.launcherBorderRadius],["--window-height",e.windowHeight],["--window-bottom",e.windowBottom],["--spacing-1",e.spacing1],["--spacing-2",e.spacing2],["--spacing-3",e.spacing3],["--spacing-4",e.spacing4],["--spacing-5",e.spacing5],["--spacing-6",e.spacing6],["--spacing-7",e.spacing7],["--spacing-8",e.spacing8]].forEach(([e,t])=>{void 0!==t&&this.mountPoint.style.setProperty(e,t)})}this.mountPoint&&!this.config.theme?.cssVariables&&(!function(){const e=document.documentElement.getAttribute("data-theme");return"dark"===e||"light"!==e&&window.matchMedia("(prefers-color-scheme: dark)").matches}()?Object.keys(pb).forEach(e=>{this.mountPoint.style.removeProperty(e)}):Object.entries(pb).forEach(([e,t])=>{this.mountPoint.style.setProperty(e,t)})),!this.root&&this.mountPoint&&(this.root=e(this.mountPoint));const t={apiKey:this.config.apiKey,apiBaseUrl:this.config.apiBaseUrl||ub,agentId:this.config.agentId,theme:{botName:"Asistente Virtual",position:"bottom-right",welcomeMessage:"¡Hola! 👋 ¿En qué puedo ayudarte?",inputPlaceholder:"Escribe tu mensaje...",cssVariables:{primary:"160 84% 39%",windowBorderRadius:"24px",launcherBorderRadius:"50%"},...this.config.theme},userContext:this.config.userContext,pageContext:this.config.pageContext,includeSEOMetadata:this.config.includeSEOMetadata??!1,mediaConfig:this.config.mediaConfig,onNavigate:this.config.onNavigate,onLogin:this.config.onLogin,onEvent:this.config.onEvent,onStateChange:this.config.onStateChange},r=n.createElement(h,{fallback:n.createElement("div",{style:{position:"fixed",bottom:"24px",right:"24px",width:"60px",height:"60px",borderRadius:"50%",backgroundColor:"#10b981",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",cursor:"wait"}},n.createElement("div",{style:{width:"24px",height:"24px",border:"3px solid rgba(255, 255, 255, 0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"spin 1s linear infinite"}}))},n.createElement(hb,t));this.root.render(n.createElement(db,null,n.createElement(M,{defaultLocale:this.config.theme?.defaultLocale,children:r}))),console.log("[BotUyoChat] Widget initialized",t)}update(e){this.config?(this.config={...this.config,...e,theme:{...this.config.theme,...e.theme}},this.render()):console.error("[BotUyoChat] Widget not initialized")}destroy(){this.darkModeObserver&&(this.darkModeObserver.disconnect(),this.darkModeObserver=null),this.darkModeMediaQuery&&(this.darkModeMediaQuery.removeEventListener("change",this.handleDarkModeChange),this.darkModeMediaQuery=null),this.root&&(this.root.unmount(),this.root=null),this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null,this.shadowRoot=null,this.mountPoint=null),this.config=null,console.log("[BotUyoChat] Widget destroyed")}setupDarkModeDetection(){this.config?.theme?.cssVariables||(this.handleDarkModeChange=()=>this.render(),this.darkModeObserver=new MutationObserver(this.handleDarkModeChange),this.darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),this.darkModeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.darkModeMediaQuery.addEventListener("change",this.handleDarkModeChange))}handleDarkModeChange=()=>{};open(){window.dispatchEvent(new CustomEvent("botuyo-chat:open"))}close(){window.dispatchEvent(new CustomEvent("botuyo-chat:close"))}sendMessage(e){window.dispatchEvent(new CustomEvent("botuyo-chat:send-message",{detail:{message:e}}))}getState(){return null}}const mb=new fb;window.BotUyoChat=mb;export{cb as A,fb as B,ob as C,K as L,ab as P,se as X,Et as a,Yg as b,$ as c,rb as d,M as e,Qg as f,Ot as g,P as h,mb as i,D as u};
|
|
183
|
-
//# sourceMappingURL=standalone-
|
|
183
|
+
//# sourceMappingURL=standalone-CxjK2h-4.js.map
|