@marketrix.ai/widget 3.8.140 → 3.8.141

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/widget.mjs CHANGED
@@ -38,7 +38,7 @@ return f("video",{...t,ref:n,className:Ec(e)})}),Td="8px 8px 0 0",Ad="#111827",$
38
38
  return g(Dl,{style:{marginTop:"10px"},role:"article","aria-roledescription":"message","aria-label":o?"You said…":"Agent says…",animate:n?"fadeIn":void 0,children:[/* @__PURE__ */g(Ml,{align:"start",gap:"sm",width:"full",children:[
39
39
  /* @__PURE__ */f(Ml,{shrink:!1,style:{width:"20px",height:"20px",marginTop:"6px"},children:!o&&/* @__PURE__ */f(Uc,{src:"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20361%20360'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20136)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20display:%20none;%20fill:%20none;%20stroke:%20%23cdc9c2;%20stroke-width:%201.3px;%20}%20.st1%20{%20fill:%20%23fff;%20}%20.st2,%20.st3%20{%20fill:%20%237cffa6;%20}%20.st3%20{%20stroke:%20%237cffa6;%20stroke-width:%20.38px;%20}%20.st4%20{%20fill:%20%23101828;%20}%20%3c/style%3e%3c/defs%3e%3crect%20class='st4'%20x='.5'%20width='360'%20height='360'/%3e%3cpath%20class='st2'%20d='M83.37,209.58c15.35,0,27.8-12.45,27.8-27.8s-12.44-27.79-27.8-27.79-27.8,12.44-27.8,27.79,12.44,27.8,27.8,27.8Z'/%3e%3cpath%20class='st1'%20d='M85.86,68.28l152.45,223.44h67.29l-70.62-113.77,68.13-109.67h-67.29l-41.12,65.31-41.54-65.31h-67.29Z'/%3e%3cpath%20class='st3'%20d='M176.61,249.83l-35.08-51-57.82,92.71h66.85l26.05-41.7Z'/%3e%3crect%20class='st0'%20x='1.25'%20y='.65'%20width='358.7'%20height='358.7'%20rx='43.35'%20ry='43.35'/%3e%3c/svg%3e",alt:"Marketrix AI",size:20,fit:"cover",rounded:"theme",style:{border:"none",outline:"none",display:"block",backgroundColor:"transparent"}})}),
40
40
  /* @__PURE__ */g(Dl,{grow:!0,position:"relative",rounded:"theme",elevation:"card",style:{padding:e.videoStream?"0":"8px 10px",border:"1px solid transparent",backgroundColor:o?"var(--primary)":void 0,color:o?"var(--primary-foreground)":"var(--foreground)"},children:[e.videoStream&&/* @__PURE__ */f(Md,{stream:e.videoStream}),!e.videoStream&&/* @__PURE__ */f(Ed,{message:e,isLastMessage:n}),e.isScreenAccessRequest&&!e.screenShareStatus&&/* @__PURE__ */g(Ml,{align:"center",gap:"sm",style:{marginTop:"6px"},children:[/* @__PURE__ */f($l,{type:"button",variant:"primary",size:"sm",shape:"pill",onClick:()=>r?.(),children:"Yes"}),/* @__PURE__ */f($l,{type:"button",variant:"secondary",size:"sm",shape:"pill",onClick:()=>i?.(),children:"No"})]}),e.isScreenAccessRequest&&e.screenShareStatus&&/* @__PURE__ */f(Ul,{as:"div",variant:"faint",size:"xs",italic:!0,style:{marginTop:"2px"},children:"allowed"===e.screenShareStatus?"Sure":"Check HTML Instead"}),!o&&e.simulationStatus&&/* @__PURE__ */f(Ml,{position:"absolute",align:"center",justify:"center",style:{bottom:"4px",right:"4px"},children:/* @__PURE__ */f(Id,{status:e.simulationStatus})})]}),
41
- /* @__PURE__ */f(Ml,{shrink:!1,style:{width:"20px"}})]}),!e.isPlaceholder&&/* @__PURE__ */f(Ul,{as:"div",variant:"faint",size:"xxs",align:"right",style:{marginTop:"2px",marginRight:"26px"},children:S(e.timestamp)})]},`message-${e.id}-${t}`)},Od={boxShadow:Ic.button,backgroundColor:"var(--card)",border:"1px solid var(--border)",pointerEvents:"auto"},Pd=({messages:e,messagesEndRef:t,config:n,onScreenAccessAllow:r,onScreenAccessDeny:i,onClearChat:o})=>{const{config:a,state:c,isPreviewMode:l}=os({config:n}),[h,m]=p(!1),[w,b]=p(!1),y=u(null),v=d(()=>({id:"welcome",content:a.widget_body??"How can I help you today?",sender:"agent",timestamp:/* @__PURE__ */new Date,isPlaceholder:!1}),[a.widget_body]),x=d(()=>[v,...e],[v,e]),_=()=>{if(y.current){const{scrollTop:e,scrollHeight:t,clientHeight:n}=y.current;m(e>200),b(!(Math.abs(t-e-n)<50)&&t>n)}};return s(()=>{window.requestAnimationFrame(()=>{t.current&&(!l&&t.current.scrollIntoView({behavior:"auto"}),!l&&_())})},[e.length,l]),/* @__PURE__ */g(Hc,{position:"relative",height:"full",children:[
41
+ /* @__PURE__ */f(Ml,{shrink:!1,style:{width:"20px"}})]}),!e.isPlaceholder&&/* @__PURE__ */f(Ul,{as:"div",variant:"faint",size:"xxs",align:"right",style:{marginTop:"2px",marginRight:"26px"},children:S(e.timestamp)})]},`message-${e.id}-${t}`)},Od={boxShadow:Ic.button,backgroundColor:"var(--card)",border:"1px solid var(--border)",pointerEvents:"auto"},Pd=({messages:e,messagesEndRef:t,config:n,onScreenAccessAllow:r,onScreenAccessDeny:i,onClearChat:o})=>{const{config:a,state:c,isPreviewMode:l}=os({config:n}),[h,m]=p(!1),[w,b]=p(!1),y=u(null),v=d(()=>({id:"welcome",content:a.widget_body??"How can I help you today?",sender:"agent",timestamp:/* @__PURE__ */new Date,isPlaceholder:!1}),[a.widget_body]),x=d(()=>[v,...e],[v,e]),_=()=>{if(y.current){const{scrollTop:e,scrollHeight:t,clientHeight:n}=y.current;m(e>200),b(!(Math.abs(t-e-n)<50)&&t>n)}};return s(()=>{window.requestAnimationFrame(()=>{t.current&&(!l&&t.current.scrollIntoView({behavior:"auto"}),!l&&_())})},[e.length,l]),s(()=>{const e=y.current;e&&!l&&e.scrollHeight-e.scrollTop-e.clientHeight<120&&window.requestAnimationFrame(()=>t.current?.scrollIntoView({behavior:"auto"}))},[e[e.length-1]?.content?.length??0,l,t]),/* @__PURE__ */g(Hc,{position:"relative",height:"full",children:[
42
42
  /* @__PURE__ */g(Hc,{ref:y,onScroll:_,role:"log","aria-relevant":"additions",height:"full",overflowY:"auto",paddingX:"lg",paddingY:"sm",style:{backgroundColor:a.widget_background_color.includes("gradient")?"transparent":a.widget_background_color,backgroundImage:a.widget_background_color.includes("gradient")?a.widget_background_color:`linear-gradient(135deg, ${a.widget_background_color} 0%, ${a.widget_background_color} 100%)`,scrollbarColor:`${k(a.widget_border_color,.3)} ${k(a.widget_border_color,.1)}`,scrollbarWidth:"thin"},children:[0===e.length&&c.isLoading&&/* @__PURE__ */f(_d,{variant:"loading",message:"Connecting…"}),x.map((e,t)=>/* @__PURE__ */f(Nd,{message:e,index:t,isLastMessage:t===x.length-1,onScreenAccessAllow:r,onScreenAccessDeny:i},`message-${e.id}-${t}`)),e.length>0&&o&&/* @__PURE__ */f(Ml,{justify:"center",style:{marginTop:"12px",marginBottom:"4px"},children:/* @__PURE__ */f($l,{type:"button",variant:"bare",onClick:()=>{const e=o();e instanceof Promise&&e.catch(e=>{})},children:/* @__PURE__ */f(Ul,{size:"xs",variant:"muted",style:{cursor:"pointer"},children:"Clear conversation"})})}),
43
43
  /* @__PURE__ */f(Hc,{ref:t},"scroll-anchor")]},"message-list-container"),h&&/* @__PURE__ */f(Ml,{position:"absolute",justify:"center",style:{top:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(jl,{variant:"secondary",size:"sm",label:"Scroll to top",onClick:()=>{y.current?.scrollTo({top:0,behavior:"smooth"})},style:Od,children:/* @__PURE__ */f(Ol,{name:"arrowUp",size:10,style:{color:a.widget_accent_color}})})}),w&&/* @__PURE__ */f(Ml,{position:"absolute",justify:"center",style:{bottom:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(jl,{variant:"secondary",size:"sm",label:"Scroll to bottom",onClick:()=>{t.current&&!l&&t.current.scrollIntoView({behavior:"smooth"})},style:Od,children:/* @__PURE__ */f(Ol,{name:"arrowDown",size:10,style:{color:a.widget_accent_color}})})})]})},Rd=class extends t.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){}render(){return this.state.hasError?/* @__PURE__ */f(Ul,{as:"div",size:"xs",align:"center",style:{padding:"16px",color:"var(--muted-foreground)"},children:"Something went wrong displaying messages. Please refresh."}):this.props.children}},Ld={show:"mousePointerClick",tell:"chatBubble",do:"ticktick"},jd=["tell","show","do"];var Dd=({config:e,messages:t,currentMode:n,isSimulationRunning:r=!1,onSendMessage:i,onSetMode:o,onAddMessage:a,onUpdateMessage:s,onRemoveMessage:c,onStopTask:l,onClearChat:d,onScreenSharingChange:h,onStartScreenShareRef:m,onStopScreenShareRef:w,messageInputRef:b})=>{const[y,v]=p(""),x=u(null),[k,_]=p(null),{isScreenSharing:S,showScreenAccessDialog:E,handleScreenAccessDialogAllow:I,handleScreenAccessDialogDeny:C,handleScreenAccessAllow:T,handleScreenAccessDeny:A,requestScreenAccess:$}=ad({onScreenSharingChange:h,onStartScreenShareRef:m,onStopScreenShareRef:w,onAddMessage:a,onUpdateMessage:s,onRemoveMessage:c,onSendMessage:i,pendingMessage:k,setPendingMessage:_}),M=e;/* @__PURE__ */
44
44
  return g(Dl,{height:"full",id:"view-chat",role:"tabpanel","aria-labelledby":"tab-chat",children:[E&&/* @__PURE__ */f(vd,{open:E,onClose:C,title:"Can I take a look at your screen?",description:"By allowing screen access, Marketrix can understand your current context to guide you better and complete tasks on your behalf.",onConfirm:I,confirmLabel:"Yes",cancelLabel:"No"}),