@botuyo/chat-widget-standalone 1.1.0 → 1.1.1
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-D-EUaXWO.js → AudioPlayer-CPdmwHHj.js} +2 -2
- package/dist/{AudioPlayer-D-EUaXWO.js.map → AudioPlayer-CPdmwHHj.js.map} +1 -1
- package/dist/{Gallery-B45QYW6w.js → Gallery-D2T7Hp2k.js} +2 -2
- package/dist/{Gallery-B45QYW6w.js.map → Gallery-D2T7Hp2k.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/components/Avatar3DPreview.d.ts.map +1 -1
- package/dist/{standalone-D8TfEUEs.js → standalone-Dp2gmLy6.js} +3 -3
- package/dist/{standalone-D8TfEUEs.js.map → standalone-Dp2gmLy6.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":"Avatar3DPreview.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/components/Avatar3DPreview.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,UAAU,oBAAoB;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;
|
|
1
|
+
{"version":3,"file":"Avatar3DPreview.d.ts","sourceRoot":"","sources":["../../../../src/chat-widget/components/Avatar3DPreview.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,UAAU,oBAAoB;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAiMD,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,SAAc,EACd,cAAc,EACd,cAAc,EACd,UAAiB,GAClB,EAAE,oBAAoB,kDA6BtB"}
|
|
@@ -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-CPdmwHHj.js").then(e=>({default:e.AudioPlayer}))),Vl=p(()=>import("./Gallery-D2T7Hp2k.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(Y,{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," ",
|
|
@@ -173,11 +173,11 @@ return y(Yg.Provider,{value:g,children:[e,
|
|
|
173
173
|
/* @__PURE__ */b("div",{className:Et("transition-all duration-400 ease-[cubic-bezier(0.34,1.56,0.64,1)]",_?"bottom-left"===c?.position?"origin-bottom-left":"origin-bottom-right":"origin-bottom",A.isOpen?"opacity-100 scale-100 h-full w-full translate-y-0 pointer-events-auto":"opacity-0 scale-[0.85] pointer-events-none translate-y-8 h-0 w-0"),style:{pointerEvents:A.isOpen?"auto":"none"},onMouseDown:q,onTouchStart:q,children:/* @__PURE__ */b(Sc,{children:/* @__PURE__ */b(_c,{isOpen:A.isOpen,isConnected:P,isTyping:A.isTyping,messages:A.messages,onClose:V,onSendMessage:D,onSendAttachment:j,onSendLocation:F,botName:z.botName,logoUrl:z.logoUrl,welcomeMessage:z.welcomeMessage,inputPlaceholder:c?.inputPlaceholder||C?.inputPlaceholder,position:c?.position,bubbleStyles:N,avatars:c?.avatars||C?.avatars||C?.avatarAnimations||{},mediaConfig:U,theme:z,avatar3dUrl:c?.avatar3dUrl,getSocket:R,onAddVoiceMessage:B,suggestedQuestions:C?.suggestedQuestions})})}),!x&&/* @__PURE__ */b("div",{className:Et(A.isOpen?"hidden":"block",!_&&"mt-4"),style:{pointerEvents:"auto"},onMouseDown:q,onTouchStart:q,children:/* @__PURE__ */b(Vt,{isOpen:A.isOpen,onClick:L,unreadCount:T,position:c?.position||"bottom-right",primaryColor:Ot(z),logoUrl:z.logoUrl,starterPrompt:c?.starterPrompt||C?.starterPrompt,avatars:c?.avatars||C?.avatars||C?.avatarAnimations||{},emotion:M,styles:N,promptPersistence:c?.promptPersistence,avatarScale:c?.avatarScale??C?.avatarScale,showPromptAvatar:c?.showPromptAvatar??C?.showPromptAvatar})})]}):null}function rb(e){/* @__PURE__ */
|
|
174
174
|
return b(Pt,{animations:e.theme?.animations,effects:e.theme?.effects,children:/* @__PURE__ */b(nb,{...e})})}function ob(e){/* @__PURE__ */
|
|
175
175
|
return b(M,{defaultLocale:e.theme?.defaultLocale,children:/* @__PURE__ */b(tb,{children:/* @__PURE__ */b(rb,{...e})})})}const ib=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,ChatWidget:ob,ChatWidgetInner:nb,ChatWidgetWithProviders:rb},Symbol.toStringTag,{value:"Module"}));function ab({apiKey:e,apiBaseUrl:t="https://api.botuyo.com",sessionKey:n,locale:r="es",onReady:o}){const i=u(()=>({apiKey:e,apiBaseUrl:t,initialOpen:!0,hideLauncher:!0,theme:{position:"bottom-right",defaultLocale:r,cssVariables:{windowBorderRadius:"0px",windowHeight:"100%",windowBottom:"0px"}},onEvent:e=>{"connected"===e&&o&&o()}}),[e,t,r,o]);/* @__PURE__ */
|
|
176
|
-
return b("div",{style:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},children:/* @__PURE__ */b(M,{defaultLocale:r,children:/* @__PURE__ */b(rb,{...i})})},n)}function sb({url:e,autoRotate:t,hasCustomCamera:n}){const r=f(null),o=f(null),i=f(null),s=f(0),l=f(0),c=f(0),{scene:u,camera:d}=_();return a(()=>{const
|
|
176
|
+
return b("div",{style:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},children:/* @__PURE__ */b(M,{defaultLocale:r,children:/* @__PURE__ */b(rb,{...i})})},n)}function sb({url:e,autoRotate:t,hasCustomCamera:n}){const r=f(null),o=f(null),i=f(null),s=f(0),l=f(0),c=f(0),{scene:u,camera:d}=_();return a(()=>{const t=new z;return t.register(e=>new C(e)),t.load(e,e=>{const t=e.userData?.vrm;if(t){r.current=t,t.scene.rotation.y=0;const e=(new E.Box3).setFromObject(t.scene).getSize(new E.Vector3);if(c.current=0,l.current=0,u.add(t.scene),!n){const t=.75*e.y,n=d.fov*(Math.PI/180),r=.55*e.y*.5/Math.tan(n/2)*1.3;d.position.set(0,t,r),d.lookAt(0,t,0)}t.lookAt&&(t.lookAt.target=d)}else{const t=e.scene;t.updateMatrixWorld(!0);const r=(new E.Box3).setFromObject(t),a=r.getCenter(new E.Vector3),s=r.getSize(new E.Vector3),p=new E.Group;if(t.position.sub(a),p.add(t),o.current=p,c.current=0,l.current=0,u.add(p),!n){const e=d.fov*(Math.PI/180),t=.3*s.y,n=.5*s.y/Math.tan(e/2)*1.2;d.position.set(0,t,n),d.lookAt(0,t,0)}if(e.animations.length>0){const n=new E.AnimationMixer(t);i.current=n,e.animations.forEach(e=>{n.clipAction(e).play()})}}},void 0,e=>{console.error("[Avatar3DPreview] Failed to load model:",e)}),()=>{r.current&&(u.remove(r.current.scene),r.current=null),o.current&&(u.remove(o.current),o.current=null),i.current&&(i.current.stopAllAction(),i.current=null)}},[e,u,d,t]),S((e,n)=>{const a=Math.min(n,.1);s.current+=1.2*a;const u=t?.5*a:0;if(o.current){i.current&&i.current.update(a);const e=o.current,n=.003*Math.sin(s.current);e.position.y=c.current+n,t&&(l.current-=u);const r=.02*Math.sin(.3*s.current);return void(e.rotation.y=l.current+r)}const d=r.current;if(d){const e=.003*Math.sin(s.current);if(d.scene.position.y=c.current+e,t&&(l.current-=u,d.scene.rotation.y=l.current),d.humanoid){const e=d.humanoid.getNormalizedBoneNode("spine");if(e){const t=.008*Math.sin(.4*s.current),n=.005*Math.cos(.25*s.current);e.rotation.z=E.MathUtils.lerp(e.rotation.z,t,2*a),e.rotation.x=E.MathUtils.lerp(e.rotation.x,n,2*a)}}d.update(a)}}),null}function lb({position:e,target:t}){const{camera:n}=_();return a(()=>{e&&t&&(n.position.set(...e),n.lookAt(...t))},[n,e,t]),null}function cb({url:e,className:t="",cameraPosition:n,targetPosition:r,autoRotate:o=!0}){return e?/* @__PURE__ */b("div",{className:`relative w-full h-full ${t}`,children:/* @__PURE__ */b(h,{fallback:/* @__PURE__ */b("div",{className:"w-full h-full flex items-center justify-center text-gray-400 text-xs",children:"Loading 3D Model..."}),children:/* @__PURE__ */y(k,{style:{width:"100%",height:"100%",background:"transparent"},gl:{alpha:!0,antialias:!0,preserveDrawingBuffer:!1},camera:{fov:30,near:.01,far:10},dpr:[1,2],children:[
|
|
177
177
|
/* @__PURE__ */b(lb,{position:n,target:r}),
|
|
178
178
|
/* @__PURE__ */b("ambientLight",{intensity:.6}),
|
|
179
179
|
/* @__PURE__ */b("directionalLight",{position:[1,2,3],intensity:.8,color:"#ffffff"}),
|
|
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,Gg 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-Dp2gmLy6.js.map
|