@lemonsliceai/lemon-slice-widget 1.0.27 → 1.0.28
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
51
51
|
absolute right-0 bottom-0 top-0 transition-all duration-150 flex items-end p-2
|
|
52
52
|
${M.trim()?"opacity-100 blur-0 scale-100 pointer-events-auto":"opacity-0 blur-sm scale-95 pointer-events-none"}
|
|
53
53
|
`,children:A("button",{onClick:h,className:"py-1 px-3 rounded-3xl bg-white hover:bg-white/80 cursor-pointer transition-colors h-[28px]]","aria-label":"Send message",children:A(K1,{strokeWidth:2,size:20,color:"black"})})})]})}),A(fr.div,{layout:!0,animate:{opacity:M.trim()?0:1,scale:M.trim()?.2:1,width:M.trim()?0:"auto",filter:M.trim()?"blur(20px)":"blur(0px)"},transition:{layout:{duration:.25,ease:"easeOut"},opacity:{duration:.25},width:{duration:.25,ease:"easeOut"},scale:{duration:.25,ease:"easeOut"},filter:{duration:.25}},className:`flex items-center gap-1 flex-none ${!ie||r?"pl-1":""}
|
|
54
|
-
`,children:[A("button",{onClick:P,className:`w-11 h-11 flex-none rounded-full flex items-center justify-center backdrop-blur-xl cursor-pointer transition-colors duration-150 ${l?"bg-white/10 hover:bg-white/15 shadow-inset-white-10":"bg-white hover:bg-white/90"}`,children:l?A(rx,{className:"size-5 text-red-500"}):A(I1,{className:"size-5 text-black"})}),A("div",{className:"relative",ref:le,children:[A("button",{onClick:I=>{I.stopPropagation(),K(!W)},className:"w-11 h-11 flex-none rounded-full flex items-center justify-center bg-white/10 hover:bg-white/15 backdrop-blur-xl cursor-pointer transition-colors duration-150 shadow-inset-white-10","aria-label":"Speaker options",children:A(A1,{className:"size-5 text-white"})}),W&&$&&(()=>{const I=le.current?.getRootNode(),F=I===document?document.body:I;return jl(A("div",{ref:u,className:"fixed w-40 bg-white/10 backdrop-blur-xl rounded-2xl shadow-lg shadow-inset-white-10 z-[9999] flex flex-col p-1 gap-1",style:ie?{bottom:$.bottom,left:$.centerX,transform:"translateX(-50%)"}:{bottom:$.bottom,right:$.right},children:A("button",{onClick:()=>D(),className:"w-full px-3 py-2 flex items-center gap-3 hover:bg-white/10 transition-colors text-left rounded-xl",children:f?A(Fe,{children:[A(V1,{className:"size-5 text-white flex-shrink-0"}),A("span",{className:"text-white text-sm",children:"Speaker off"})]}):A(Fe,{children:[A(R1,{className:"size-5 text-white flex-shrink-0"}),A("span",{className:"text-white text-sm",children:"Speaker on"})]})})}),F)})()]})]}),ie&&!r&&e&&A("button",{onClick:e,className:"w-11 h-11 flex-none rounded-full flex items-center justify-center bg-white/10 hover:bg-white/15 backdrop-blur-xl cursor-pointer transition-colors duration-150 shadow-inset-white-10","aria-label":"Close",children:A(zm,{className:"size-6 text-white"})})]})]})]})}const ax=15e3,sx=
|
|
54
|
+
`,children:[A("button",{onClick:P,className:`w-11 h-11 flex-none rounded-full flex items-center justify-center backdrop-blur-xl cursor-pointer transition-colors duration-150 ${l?"bg-white/10 hover:bg-white/15 shadow-inset-white-10":"bg-white hover:bg-white/90"}`,children:l?A(rx,{className:"size-5 text-red-500"}):A(I1,{className:"size-5 text-black"})}),A("div",{className:"relative",ref:le,children:[A("button",{onClick:I=>{I.stopPropagation(),K(!W)},className:"w-11 h-11 flex-none rounded-full flex items-center justify-center bg-white/10 hover:bg-white/15 backdrop-blur-xl cursor-pointer transition-colors duration-150 shadow-inset-white-10","aria-label":"Speaker options",children:A(A1,{className:"size-5 text-white"})}),W&&$&&(()=>{const I=le.current?.getRootNode(),F=I===document?document.body:I;return jl(A("div",{ref:u,className:"fixed w-40 bg-white/10 backdrop-blur-xl rounded-2xl shadow-lg shadow-inset-white-10 z-[9999] flex flex-col p-1 gap-1",style:ie?{bottom:$.bottom,left:$.centerX,transform:"translateX(-50%)"}:{bottom:$.bottom,right:$.right},children:A("button",{onClick:()=>D(),className:"w-full px-3 py-2 flex items-center gap-3 hover:bg-white/10 transition-colors text-left rounded-xl",children:f?A(Fe,{children:[A(V1,{className:"size-5 text-white flex-shrink-0"}),A("span",{className:"text-white text-sm",children:"Speaker off"})]}):A(Fe,{children:[A(R1,{className:"size-5 text-white flex-shrink-0"}),A("span",{className:"text-white text-sm",children:"Speaker on"})]})})}),F)})()]})]}),ie&&!r&&e&&A("button",{onClick:e,className:"w-11 h-11 flex-none rounded-full flex items-center justify-center bg-white/10 hover:bg-white/15 backdrop-blur-xl cursor-pointer transition-colors duration-150 shadow-inset-white-10","aria-label":"Close",children:A(zm,{className:"size-6 text-white"})})]})]})]})}const ax=15e3,sx=2e4;function cx({hideUI:e=!1,showKeyboardOnMobile:t=!1}){const{setWidgetState:n,widgetState:r,isAgentVideoReady:i,showMinimizeButton:o,isImageChangeRequested:a,customActiveWidth:s,customActiveHeight:c,customMinimizedWidth:l,customMinimizedHeight:d,videoButtonText:f,skipWelcomeVideo:m,audioPermissionBlocked:g,retryDailyAudioRef:y}=At(),{agentData:v}=Qt(),{isAudioMuted:b,setIsAudioMuted:_,setIsMicMuted:S}=ro(),{hasUserInteracted:T,setHasUserInteracted:M}=er(),{errorMsg:x,setErrorMsg:C,nonFatalErrorMsg:E}=io(),{resetDailyState:O}=At(),V=Xt({filter:"remote"}),B=ae(null),[N,z]=te(!1),[R,ee]=te(!1),X=ae(null),{isMobileDevice:Z}=ws(),[W,K]=te(!1),$=ae(null),[U,ie]=te(!1),le=ae(null),u=ae(null),p=ae(null),[h,w]=te(!1),k=ae(null),P=ae(!1),D=v?.first_video_url,I=v?.allow_image_edits||!1;J(()=>{const Te=r===ke,rn=Te?Z?200:252:Z?120:144,Nc=Te?Z?300:377:Z?180:216,So=Te?s:l,Ym=Te?c:d,Sx=So!==null?So:rn,xx=Ym!==null?Ym:Nc,Xm=document.querySelector("lemon-slice-widget");Xm&&Xm.dispatchEvent(new CustomEvent("widget-size-change",{detail:{width:Sx,height:xx,isExpanded:Te,isMobile:Z,state:r},bubbles:!0,composed:!0}))},[r,Z,s,c,l,d]),J(()=>{(r===et||r===ke)&&B.current&&(B.current.currentTime=0,B.current.play().catch(Te=>{console.error("Error restarting video:",Te)}))},[r]),J(()=>{if(r!==ke||!T||!B.current||!b)return;const Te=B.current,rn=()=>{_(!1),Te.removeEventListener("playing",rn)};if(!Te.paused&&!Te.ended){_(!1);return}return Te.addEventListener("playing",rn),()=>{Te.removeEventListener("playing",rn)}},[r,T,b,_]),J(()=>(V.length>0&&i?(X.current!==null&&clearTimeout(X.current),X.current=window.setTimeout(()=>{ee(!0),X.current=null},300)):(ee(!1),X.current!==null&&(clearTimeout(X.current),X.current=null)),()=>{X.current!==null&&(clearTimeout(X.current),X.current=null)}),[V.length,i]),J(()=>{r===ke&&m&&M(!0)},[r,m,M]),J(()=>(V.length>0&&i&&I?(ie(!0),le.current!==null&&clearTimeout(le.current),le.current=window.setTimeout(()=>{ie(!1),le.current=null},ax)):(ie(!1),le.current!==null&&(clearTimeout(le.current),le.current=null)),()=>{le.current!==null&&(clearTimeout(le.current),le.current=null)}),[V.length,i,I]);const F=()=>{n(et),_(!0),S(!0),x&&(C(""),O()),K(!0),$.current!==null&&clearTimeout($.current),$.current=window.setTimeout(()=>{K(!1),$.current=null},3e3)},G=()=>{n(Et)},ue=()=>{n(ke),_(!1),x&&(C(""),O())},nt=V.length>0&&i,Dt=r===ke&&(!T||nt||r===ke&&!nt&&T&&!x)&&!x&&!e,In=(r===et||r===Et||r===ke&&!T&&!x)&&!(m&&r===ke),Ae=r===ke&&!R&&T&&!x;J(()=>{if(!Ae){w(!1),k.current!==null&&(clearTimeout(k.current),k.current=null),R&&(P.current=!1);return}if(P.current){w(!0);return}return k.current=window.setTimeout(()=>{P.current=!0,w(!0),k.current=null},sx),()=>{k.current!==null&&(clearTimeout(k.current),k.current=null)}},[Ae,R]);const Ze=r===ke&&R&&T&&!x,Ut=r===ke&&x&&!e,Dn=r===ke&&T&&E&&!e,hr=r===ke&&R&&U&&I&&!a&&!x&&!E&&!e&&(!Z||t),Ln=r===ke&&nt&&a&&!E&&!x&&!e;return A("div",{onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),className:`relative overflow-hidden transition-all bg-black
|
|
55
55
|
${e?"":"rounded-3xl shadow-4xl"}
|
|
56
56
|
${r===Et?"duration-300 ease-in":"duration-300 ease-out"}
|
|
57
57
|
${r===ke?`${s===null?Z?"w-[200px]":"w-[252px]":""} ${c===null?Z?"h-[300px]":"h-[377px]":""}`:`${l===null?Z?"w-[120px]":"w-[144px]":""} ${d===null?Z?"h-[180px]":"h-[216px]":""}`}`,style:{...r===Et?{transform:"translateX(100%) scale(0.8, 0.5)",filter:"blur(12px)",opacity:0,pointerEvents:"none"}:{transform:"translateX(0) scale(1)",filter:"blur(0px)",opacity:1},...r===ke&&s!==null&&{width:`${s}px`},...r===ke&&c!==null&&{height:`${c}px`},...(r===et||r===Et)&&l!==null&&{width:`${l}px`},...(r===et||r===Et)&&d!==null&&{height:`${d}px`}},children:[!e&&r===ke&&!(Z&&Dt&&!t)&&A("button",{onClick:F,className:`absolute top-2 right-2 p-2 rounded-full flex items-center justify-center
|