@botuyo/chat-widget-standalone 1.1.8 → 1.1.9
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-BQhIBcDV.js} +2 -2
- package/dist/{AudioPlayer-BxTDuzwm.js.map → AudioPlayer-BQhIBcDV.js.map} +1 -1
- package/dist/{Gallery-BBui2euL.js → Gallery-BXiG2CPp.js} +2 -2
- package/dist/{Gallery-BBui2euL.js.map → Gallery-BXiG2CPp.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/{standalone-BLhtkN9D.js → standalone-BhDtqR8h.js} +3 -3
- package/dist/{standalone-BLhtkN9D.js.map → standalone-BhDtqR8h.js.map} +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -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-BQhIBcDV.js").then(e=>({default:e.AudioPlayer}))),Vl=p(()=>import("./Gallery-BXiG2CPp.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," ",
|
|
@@ -124,7 +124,7 @@ return y(v,{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-BhDtqR8h.js.map
|