@marketrix.ai/widget 3.2.178 → 3.2.179

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/MessageList.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAmBhE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,WAAW,GAAI,6FAOzB,gBAAgB,4CAgKlB,CAAC"}
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/MessageList.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkBhE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;C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E,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,iEAAiE;IACjE,qBAAqB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACpE,oBAAoB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACnE,6DAA6D;IAC7D,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CAC/D;AAwBD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgL5C,CAAC"}
package/dist/widget.mjs CHANGED
@@ -15,9 +15,9 @@ return f(ku,{className:"fixed",style:{zIndex:b,maxWidth:"420px",opacity:l?0:1,tr
15
15
  return g(ku,{ref:_,className:`${O} ${C?"":z} ${S?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:p,pointerEvents:e?"none":"auto",...R,...C},children:[/* @__PURE__ */g(ku,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${e?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[w&&/* @__PURE__ */f(ku,{className:v,"aria-hidden":!0}),b&&!S&&/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},className:"absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-white/25 bg-gray-900 px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-lg opacity-0 transition-opacity duration-150 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto "+(h.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop running task",children:"Stop"}),
16
16
  /* @__PURE__ */f(lp,{type:"button",variant:"bare",onClick:()=>{Date.now()<M.current||i()},onDragStart:e=>e.preventDefault(),onPointerDown:I,onPointerMove:E,onPointerUp:A,onPointerCancel:T,className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:S?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":e?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */f(cp,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */g(ku,{className:"\n relative w-12 h-12 overflow-hidden transition-[transform,opacity,background-color] duration-[167ms] ease-[cubic-bezier(0.33,0,0,1)]\n hover:scale-110 hover:duration-[250ms] active:scale-[0.85] active:duration-[134ms] active:ease-[cubic-bezier(0.45,0,0.2,1)]\n animate-launcher-entrance\n ",style:{borderRadius:l,backgroundColor:e?a:s,boxShadow:Ep},children:[w&&/* @__PURE__ */f("svg",{className:x,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */f("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:k+1,ry:k+1})}),
17
17
  /* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:e?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":e,children:/* @__PURE__ */f(Cu,{src:_u,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:l,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
18
- /* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(up,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(ku,{className:`absolute bottom-16 ${h.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:c,color:d},children:[/* @__PURE__ */f(vp,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(ku,{"aria-hidden":!0,className:`absolute top-full ${h.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},Pp="3.2.178";function Lp(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function Dp(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function $p(e,t,n){return Math.min(Math.max(e,t),n)}function jp(e,t,n,r,i){const o={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:r-t,dy:i-n,cursor:o[e]};case"bottom-left":return{dx:t-r,dy:i-n,cursor:o[e]};case"top-right":return{dx:r-t,dy:n-i,cursor:o[e]};case"top-left":return{dx:t-r,dy:n-i,cursor:o[e]}}}var Fp={live:"inline-flex items-center gap-1",status:"inline-flex items-center text-[9px] font-medium px-1.5 py-0.5 rounded"},Up=i(function({variant:e,className:t,style:n,children:r,...i},o){/* @__PURE__ */
18
+ /* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(up,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(ku,{className:`absolute bottom-16 ${h.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:c,color:d},children:[/* @__PURE__ */f(vp,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(ku,{"aria-hidden":!0,className:`absolute top-full ${h.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},Pp="3.2.179";function Lp(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function Dp(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function $p(e,t,n){return Math.min(Math.max(e,t),n)}function jp(e,t,n,r,i){const o={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:r-t,dy:i-n,cursor:o[e]};case"bottom-left":return{dx:t-r,dy:i-n,cursor:o[e]};case"top-right":return{dx:r-t,dy:n-i,cursor:o[e]};case"top-left":return{dx:t-r,dy:n-i,cursor:o[e]}}}var Fp={live:"inline-flex items-center gap-1",status:"inline-flex items-center text-[9px] font-medium px-1.5 py-0.5 rounded"},Up=i(function({variant:e,className:t,style:n,children:r,...i},o){/* @__PURE__ */
19
19
  return g("span",{...i,ref:o,className:yu(Fp[e],t),"data-variant":e,style:n,children:["live"===e&&/* @__PURE__ */g("span",{className:"relative flex h-1.5 w-1.5",children:[/* @__PURE__ */f("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),/* @__PURE__ */f("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),r]})}),Bp=i(function({className:e,style:t,children:n,...r},i){/* @__PURE__ */
20
- return f("div",{...r,ref:i,className:yu(e),style:{padding:"10px 16px",borderRadius:"var(--radius-xl, 12px)",border:"1px solid transparent",backgroundColor:"var(--card)",boxShadow:Sp,...t},children:n})});var Wp=n(null);function Gp(e){const t=s(Wp);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function Hp({children:e,onOpenChange:t,open:n}){const{isOpen:r,setIsOpen:i}=function({defaultOpen:e=!1,onOpenChange:t,open:n}){const[r,i]=p(e),s=void 0!==n;return{isOpen:s?n:r,setIsOpen:o(e=>{s||i(e),t?.(e)},[s,t])}}({onOpenChange:t,open:n}),s=l(),a=l(),c=l(),u=d(()=>({contentId:s,descriptionId:c,open:r,setOpen:i,titleId:a}),[s,c,r,i,a]);/* @__PURE__ */
20
+ return f("div",{...r,ref:i,className:yu(e),style:{padding:"6px 10px",borderRadius:"var(--radius-xl, 12px)",border:"1px solid transparent",backgroundColor:"#ffffff",boxShadow:Sp,...t},children:n})});var Wp=n(null);function Gp(e){const t=s(Wp);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function Hp({children:e,onOpenChange:t,open:n}){const{isOpen:r,setIsOpen:i}=function({defaultOpen:e=!1,onOpenChange:t,open:n}){const[r,i]=p(e),s=void 0!==n;return{isOpen:s?n:r,setIsOpen:o(e=>{s||i(e),t?.(e)},[s,t])}}({onOpenChange:t,open:n}),s=l(),a=l(),c=l(),u=d(()=>({contentId:s,descriptionId:c,open:r,setOpen:i,titleId:a}),[s,c,r,i,a]);/* @__PURE__ */
21
21
  return f(Wp.Provider,{value:u,children:e})}function Zp({children:e,className:t,onKeyDown:n,...r}){const i=Gp("DialogContent");return a(()=>{if(!i.open)return;const e=e=>{"Escape"===e.key&&i.setOpen(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i]),i.open?/* @__PURE__ */f("div",{...r,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"aria-modal":"true",className:yu("fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[calc(var(--layer-dialog)+1)] flex flex-col w-full max-w-[500px] max-h-[85vh] overflow-auto bg-card rounded-lg shadow-xl p-6 animate-dialog-content-in",t),"data-state":"open",id:i.contentId,onKeyDown:e=>{n?.(e),e.defaultPrevented||"Escape"!==e.key||i.setOpen(!1)},role:"dialog",tabIndex:-1,children:e}):null}function Vp({className:e,...t}){const n=Gp("DialogTitle");/* @__PURE__ */
22
22
  return f("h2",{...t,className:yu("text-lg font-semibold text-card-foreground mb-2",e),id:n.titleId})}function qp({className:e,...t}){const n=Gp("DialogDescription");/* @__PURE__ */
23
23
  return f("p",{...t,className:yu("text-sm text-muted-foreground mb-4",e),id:n.descriptionId})}function Jp({children:e,className:t,onClick:n,...r}){const i=Gp("DialogClose");/* @__PURE__ */
@@ -41,12 +41,12 @@ return g(cp,{align:"center",gap:"sm",paddingY:"xs",children:[/* @__PURE__ */f(eh
41
41
  return g(fp,{style:{marginTop:"10px"},role:"article","aria-roledescription":"message","aria-label":o?"You said…":"Agent says…",animate:n?"fadeIn":void 0,children:[/* @__PURE__ */g(cp,{align:"start",gap:"sm",width:"full",children:[
42
42
  /* @__PURE__ */f(cp,{shrink:!1,style:{width:"20px",height:"20px",marginTop:"6px"},children:!o&&/* @__PURE__ */f(Cu,{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,style:{border:"none",outline:"none",display:"block",objectFit:"cover",backgroundColor:"transparent",borderRadius:"calc(var(--radius) * 0.6)"}})}),
43
43
  /* @__PURE__ */g(fp,{grow:!0,position:"relative",style:{padding:e.videoStream?"0":"8px 10px",borderRadius:"var(--radius)",boxShadow:Sp,border:"1px solid transparent",backgroundColor:o?"var(--primary)":void 0,color:o?"var(--primary-foreground)":"var(--foreground)"},children:[e.videoStream&&/* @__PURE__ */f(vh,{stream:e.videoStream}),!e.videoStream&&/* @__PURE__ */f(fh,{message:e,isLastMessage:n}),e.isScreenAccessRequest&&!e.screenShareStatus&&/* @__PURE__ */g(cp,{align:"center",gap:"sm",style:{marginTop:"6px"},children:[/* @__PURE__ */f(lp,{type:"button",variant:"primary",size:"sm",className:"rounded-full",onClick:()=>r?.(),children:"Yes"}),/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",className:"rounded-full",onClick:()=>i?.(),children:"No"})]}),e.isScreenAccessRequest&&e.screenShareStatus&&/* @__PURE__ */f(vp,{as:"div",variant:"faint",size:"xs",style:{marginTop:"2px",fontStyle:"italic"},children:"allowed"===e.screenShareStatus?"Sure":"Check HTML Instead"}),!o&&e.taskStatus&&/* @__PURE__ */f(cp,{position:"absolute",align:"center",justify:"center",style:{bottom:"4px",right:"4px"},children:/* @__PURE__ */f(gh,{status:e.taskStatus})})]}),
44
- /* @__PURE__ */f(cp,{shrink:!1,style:{width:"20px"}})]}),!e.isPlaceholder&&/* @__PURE__ */f(vp,{as:"div",variant:"faint",style:{marginTop:"2px",textAlign:"right",marginRight:"26px",fontSize:"10px"},children:S(e.timestamp)})]},`message-${e.id}-${t}`)},kh={padding:"6px",borderRadius:"9999px",boxShadow:Ap,backgroundColor:"var(--card)",border:"1px solid var(--border)",pointerEvents:"auto"},_h=({messages:e,messagesEndRef:t,config:n,onScreenAccessAllow:r,onScreenAccessDeny:i,onClearChat:o})=>{const{config:s,state:l,isPreviewMode:c}=Qc({config:n}),[h,m]=p(!1),[y,w]=p(!1),b=u(null),v=d(()=>({id:"welcome",content:s.widget_body??"How can I help you today?",sender:"agent",timestamp:/* @__PURE__ */new Date,isPlaceholder:!1}),[s.widget_body]),x=d(()=>[v,...e],[v,e]),_=()=>{if(b.current){const{scrollTop:e,scrollHeight:t,clientHeight:n}=b.current;m(e>200),w(!(Math.abs(t-e-n)<50)&&t>n)}};return a(()=>{window.requestAnimationFrame(()=>{t.current&&(!c&&t.current.scrollIntoView({behavior:"auto"}),!c&&_())})},[e.length,c]),/* @__PURE__ */g(ku,{position:"relative",height:"full",children:[
44
+ /* @__PURE__ */f(cp,{shrink:!1,style:{width:"20px"}})]}),!e.isPlaceholder&&/* @__PURE__ */f(vp,{as:"div",variant:"faint",style:{marginTop:"2px",textAlign:"right",marginRight:"26px",fontSize:"10px"},children:S(e.timestamp)})]},`message-${e.id}-${t}`)},kh={boxShadow:Ap,backgroundColor:"var(--card)",border:"1px solid var(--border)",pointerEvents:"auto"},_h=({messages:e,messagesEndRef:t,config:n,onScreenAccessAllow:r,onScreenAccessDeny:i,onClearChat:o})=>{const{config:s,state:l,isPreviewMode:c}=Qc({config:n}),[h,m]=p(!1),[y,w]=p(!1),b=u(null),v=d(()=>({id:"welcome",content:s.widget_body??"How can I help you today?",sender:"agent",timestamp:/* @__PURE__ */new Date,isPlaceholder:!1}),[s.widget_body]),x=d(()=>[v,...e],[v,e]),_=()=>{if(b.current){const{scrollTop:e,scrollHeight:t,clientHeight:n}=b.current;m(e>200),w(!(Math.abs(t-e-n)<50)&&t>n)}};return a(()=>{window.requestAnimationFrame(()=>{t.current&&(!c&&t.current.scrollIntoView({behavior:"auto"}),!c&&_())})},[e.length,c]),/* @__PURE__ */g(ku,{position:"relative",height:"full",children:[
45
45
  /* @__PURE__ */g(ku,{ref:b,onScroll:_,role:"log","aria-relevant":"additions",height:"full",overflowY:"auto",paddingX:"lg",paddingY:"sm",style:{backgroundColor:s.widget_background_color.includes("gradient")?"transparent":s.widget_background_color,backgroundImage:s.widget_background_color.includes("gradient")?s.widget_background_color:`linear-gradient(135deg, ${s.widget_background_color} 0%, ${s.widget_background_color} 100%)`,scrollbarColor:`${k(s.widget_border_color,.3)} ${k(s.widget_border_color,.1)}`,scrollbarWidth:"thin"},children:[0===e.length&&l.isLoading&&/* @__PURE__ */f(ph,{variant:"loading",message:"Connecting…"}),x.map((e,t)=>/* @__PURE__ */f(xh,{message:e,index:t,isLastMessage:t===x.length-1,onScreenAccessAllow:r,onScreenAccessDeny:i},`message-${e.id}-${t}`)),e.length>0&&o&&/* @__PURE__ */f(cp,{justify:"center",style:{marginTop:"12px",marginBottom:"4px"},children:/* @__PURE__ */f(lp,{type:"button",variant:"bare",onClick:()=>{const e=o();e instanceof Promise&&e.catch(e=>{})},children:/* @__PURE__ */f(vp,{size:"xs",variant:"muted",style:{cursor:"pointer"},children:"Clear conversation"})})}),
46
- /* @__PURE__ */f(ku,{ref:t},"scroll-anchor")]},"message-list-container"),h&&/* @__PURE__ */f(cp,{position:"absolute",justify:"center",style:{top:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",onClick:()=>{b.current?.scrollTo({top:0,behavior:"smooth"})},style:kh,title:"Scroll to top","aria-label":"Scroll to top",children:/* @__PURE__ */f(up,{name:"arrowUp",size:10,style:{color:s.widget_accent_color}})})}),y&&/* @__PURE__ */f(cp,{position:"absolute",justify:"center",style:{bottom:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",onClick:()=>{t.current&&!c&&t.current.scrollIntoView({behavior:"smooth"})},style:kh,title:"Scroll to bottom","aria-label":"Scroll to bottom",children:/* @__PURE__ */f(up,{name:"arrowDown",size:10,style:{color:s.widget_accent_color}})})})]})},Sh=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(vp,{as:"div",size:"xs",align:"center",style:{padding:"16px",color:"var(--muted-foreground)"},children:"Something went wrong displaying messages. Please refresh."}):this.props.children}},Ch={show:"mousePointerClick",tell:"chatBubble",do:"ticktick"},Ih=["tell","show","do"];var Eh=({config:e,messages:t,currentMode:n,isTaskRunning:r=!1,taskProgress:i=[],onSendMessage:o,onSetMode:s,onAddMessage:a,onUpdateMessage:l,onRemoveMessage:c,onStopTask:d,onClearChat:h,onScreenSharingChange:m,onStartScreenShareRef:y,onStopScreenShareRef:w,messageInputRef:b})=>{const[v,x]=p(""),_=u(null),[S,I]=p(null),{isScreenSharing:E,showScreenAccessDialog:A,handleScreenAccessDialogAllow:T,handleScreenAccessDialogDeny:M,handleScreenAccessAllow:z,handleScreenAccessDeny:O,requestScreenAccess:R}=ch({onScreenSharingChange:m,onStartScreenShareRef:y,onStopScreenShareRef:w,onAddMessage:a,onUpdateMessage:l,onRemoveMessage:c,onSendMessage:o,pendingMessage:S,setPendingMessage:I}),N=e;/* @__PURE__ */
46
+ /* @__PURE__ */f(ku,{ref:t},"scroll-anchor")]},"message-list-container"),h&&/* @__PURE__ */f(cp,{position:"absolute",justify:"center",style:{top:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(mp,{variant:"secondary",size:"sm",label:"Scroll to top",onClick:()=>{b.current?.scrollTo({top:0,behavior:"smooth"})},style:kh,children:/* @__PURE__ */f(up,{name:"arrowUp",size:10,style:{color:s.widget_accent_color}})})}),y&&/* @__PURE__ */f(cp,{position:"absolute",justify:"center",style:{bottom:"8px",left:0,right:0,zIndex:10,pointerEvents:"none"},children:/* @__PURE__ */f(mp,{variant:"secondary",size:"sm",label:"Scroll to bottom",onClick:()=>{t.current&&!c&&t.current.scrollIntoView({behavior:"smooth"})},style:kh,children:/* @__PURE__ */f(up,{name:"arrowDown",size:10,style:{color:s.widget_accent_color}})})})]})},Sh=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(vp,{as:"div",size:"xs",align:"center",style:{padding:"16px",color:"var(--muted-foreground)"},children:"Something went wrong displaying messages. Please refresh."}):this.props.children}},Ch={show:"mousePointerClick",tell:"chatBubble",do:"ticktick"},Ih=["tell","show","do"];var Eh=({config:e,messages:t,currentMode:n,isTaskRunning:r=!1,taskProgress:i=[],onSendMessage:o,onSetMode:s,onAddMessage:a,onUpdateMessage:l,onRemoveMessage:c,onStopTask:d,onClearChat:h,onScreenSharingChange:m,onStartScreenShareRef:y,onStopScreenShareRef:w,messageInputRef:b})=>{const[v,x]=p(""),_=u(null),[S,I]=p(null),{isScreenSharing:E,showScreenAccessDialog:A,handleScreenAccessDialogAllow:T,handleScreenAccessDialogDeny:M,handleScreenAccessAllow:z,handleScreenAccessDeny:O,requestScreenAccess:R}=ch({onScreenSharingChange:m,onStartScreenShareRef:y,onStopScreenShareRef:w,onAddMessage:a,onUpdateMessage:l,onRemoveMessage:c,onSendMessage:o,pendingMessage:S,setPendingMessage:I}),N=e;/* @__PURE__ */
47
47
  return g(fp,{height:"full",id:"view-chat",role:"tabpanel","aria-labelledby":"tab-chat",children:[A&&/* @__PURE__ */f(sh,{variant:"confirm",open:A,onClose:M,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:T,confirmLabel:"Yes",cancelLabel:"No"}),
48
48
  /* @__PURE__ */f(ku,{grow:!0,overflow:"hidden",paddingY:"xs",style:{display:"flex",flexDirection:"column",minHeight:0},children:/* @__PURE__ */f(Sh,{children:/* @__PURE__ */f(_h,{messages:t,messagesEndRef:_,config:e,onScreenAccessAllow:z,onScreenAccessDeny:O,onClearChat:h})})}),
49
- /* @__PURE__ */g(ku,{shrink:!1,rounded:"theme",margin:"md",style:{marginTop:"auto",backgroundColor:"var(--card)"},children:[r&&i.length>0&&/* @__PURE__ */g(ku,{rounded:!0,overflowY:"auto",style:{margin:"0 8px 8px",padding:"8px",maxHeight:"128px",backgroundColor:k(e.widget_background_color??"#fff",.8),borderColor:e.widget_border_color,borderWidth:"1px",borderStyle:"solid"},children:[/* @__PURE__ */g(vp,{as:"div",weight:"semibold",style:{marginBottom:"4px",color:e.widget_text_color},children:["Task Progress (",i.length," steps)"]}),/* @__PURE__ */f(fp,{gap:"xs",children:i.map((t,n)=>/* @__PURE__ */g(cp,{align:"start",gap:"sm",style:{fontSize:"12px",opacity:.8,color:e.widget_text_color},children:[
49
+ /* @__PURE__ */g(Bp,{style:{margin:"0 12px 12px 12px",marginTop:"auto"},children:[r&&i.length>0&&/* @__PURE__ */g(ku,{rounded:!0,overflowY:"auto",style:{margin:"0 8px 8px",padding:"8px",maxHeight:"128px",backgroundColor:k(e.widget_background_color??"#fff",.8),borderColor:e.widget_border_color,borderWidth:"1px",borderStyle:"solid"},children:[/* @__PURE__ */g(vp,{as:"div",weight:"semibold",style:{marginBottom:"4px",color:e.widget_text_color},children:["Task Progress (",i.length," steps)"]}),/* @__PURE__ */f(fp,{gap:"xs",children:i.map((t,n)=>/* @__PURE__ */g(cp,{align:"start",gap:"sm",style:{fontSize:"12px",opacity:.8,color:e.widget_text_color},children:[
50
50
  /* @__PURE__ */g(vp,{as:"span",weight:"medium",children:["Step ",t.step,":"]})," ",t.tool_name,t.tool_params&&Object.keys(t.tool_params).length>0&&/* @__PURE__ */g(vp,{as:"span",style:{opacity:.7,marginLeft:"4px"},children:["(",Object.keys(t.tool_params).join(", "),")"]})]},n))})]}),/* @__PURE__ */f(ku,{paddingY:"sm",paddingX:"md",style:{backgroundColor:"transparent"},children:/* @__PURE__ */f(uh,{ref:b,value:v,onChange:x,onSubmit:()=>{const r=t.some(e=>e.isPlaceholder);if(v.trim()&&!r){const t=v.trim();x(""),a(Tc(t,n)),!1===e.use_screenshare||"show"!==n&&"do"!==n||E?o(t,n,void 0,void 0,!0):(I({content:t,mode:n,alreadyAdded:!0}),R(n))}},modes:Ih.filter(e=>function(e){return[...e.widget_feature_show?["show"]:[],...e.widget_feature_tell?["tell"]:[],...e.widget_feature_do?["do"]:[]]}(N).includes(e)).map(e=>({id:e,icon:Ch[e],label:C(e)})),activeMode:n,onModeChange:e=>(e=>{e!==n&&(a(zc(`Switched to ${{show:"Show",tell:"Tell",do:"Do"}[e]} mode`,e,"agent","mode-change")),s(e))})(e),disabled:t.some(e=>e.isPlaceholder),taskRunning:r,onStop:()=>{qc.cleanup(),d?.()}})})]})]})},Ah=[{id:"show-add-product",text:"Show me how to add a new product",icon:/* @__PURE__ */f(up,{name:"mousePointerClick",size:24}),type:"show",isShow:!0},{id:"show-login",text:"Show me how to login",icon:/* @__PURE__ */f(up,{name:"mousePointerClick",size:24}),type:"show",isShow:!0},{id:"do-login",text:"Do the login process for me",icon:/* @__PURE__ */f(up,{name:"ticktick",size:16}),type:"do",isShow:!1},{id:"show-revenue",text:"Show me the revenue metrics",icon:/* @__PURE__ */f(up,{name:"mousePointerClick",size:24}),type:"show",isShow:!0},{id:"tell-conversion-rate",text:"What does my conversion rate mean and how can I improve it?",icon:/* @__PURE__ */f(up,{name:"chatBubble",size:20}),type:"tell",isShow:!1}];function Th(e){switch(e){case"do":/* @__PURE__ */return f(up,{name:"ticktick",size:12});case"show":/* @__PURE__ */return f(up,{name:"mousePointerClick",size:12});default:/* @__PURE__ */return f(up,{name:"chatBubble",size:12})}}var Mh=({actions:e,onActionClick:t})=>{const{config:n}=Qc();return 0===e.length?null:/* @__PURE__ */f(fp,{gap:"sm",children:e.map((e,r)=>/* @__PURE__ */f(lp,{variant:"ghost",size:"sm",full:!0,onClick:n=>t(e,n),className:"hover:bg-primary hover:text-primary-foreground hover:border-primary",style:{backgroundColor:"var(--secondary-bg)",color:n.widget_text_color,paddingTop:"8px",paddingBottom:"8px",boxShadow:Sp},children:/* @__PURE__ */f(vp,{as:"span",weight:"normal",style:{lineHeight:1},children:"show"===e.type?/* @__PURE__ */g(m,{children:["Show me ",e.text.replace(/^Show me\s*/i,"")]}):"do"===e.type?/* @__PURE__ */g(m,{children:["Do ",e.text.replace(/^Do\s*/i,"")]}):e.text})},`welcome-chip-${e.id}-${r}`))})},zh=({config:e,messages:t,onNavigateToChat:n,onChipClick:r})=>{const i=function(e){const t=e.widget_chips;if(t&&Array.isArray(t)&&t.length>0){const e=/* @__PURE__ */new Set;return t.map((t,n)=>{const r=t.chip_text||t.question||"",i=t.chip_mode||t.type||"tell",o="show"===i||"tell"===i||"do"===i?i:"tell",s=`chip-${r.replace(/\s+/g,"-").toLowerCase()}-${n}`;let a=s,l=0;for(;e.has(a);)l++,a=`${s}-${l}`;return e.add(a),{id:a,text:r,icon:Th(o),type:o,isShow:"show"===o}})}return Ah}(e);/* @__PURE__ */
51
51
  return g(fp,{height:"full",overflow:"hidden",id:"view-home",role:"tabpanel","aria-labelledby":"tab-home",children:[/* @__PURE__ */g(fp,{grow:!0,overflowY:"auto",padding:"lg",children:[/* @__PURE__ */g(ku,{style:{textAlign:"center",paddingTop:"8px",paddingBottom:"16px"},children:[/* @__PURE__ */f(vp,{as:"h2",size:"lg",weight:"semibold",children:e.widget_greeting??"Hey There!"}),/* @__PURE__ */f(vp,{as:"p",variant:"muted",size:"sm",style:{marginTop:"2px"},children:e.widget_body??"How can I help you today?"})]}),/* @__PURE__ */g(fp,{gap:"sm",children:[/* @__PURE__ */g(lp,{type:"button",variant:"primary",full:!0,onClick:n,"aria-label":"Ask a question",style:{paddingTop:"10px",paddingBottom:"10px"},children:[/* @__PURE__ */f(up,{name:"chat",size:16}),"Ask a question"]}),/* @__PURE__ */f(Mh,{actions:i,onActionClick:async(e,t)=>{t.preventDefault(),t.stopPropagation(),n(),r(e)}})]})]}),t.length>0&&/* @__PURE__ */g(Bp,{style:{margin:"0 12px 12px 12px"},children:[
52
52
  /* @__PURE__ */f(vp,{as:"p",size:"xs",weight:"semibold",style:{marginBottom:"2px"},children:"Recent conversation"}),