ed-widget 1.56.9 → 1.56.10

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/ed-widget.js CHANGED
@@ -1817,7 +1817,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1817
1817
  <p className="ed-text-border-regular ed-whitespace-pre-line">${e}</p>
1818
1818
  </div>
1819
1819
  ${r}
1820
- </div>`},xV={ANGRY:T.jsx(Ite,{}),SAD:T.jsx(Vte,{}),NEUTRAL:T.jsx(Fte,{}),HAPPY:T.jsx(jte,{}),LOVE:T.jsx(Ute,{})},oce="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI8AAACHCAYAAAAvMAr+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAH2dJREFUeAHtnQt4VNW1x9c+80hIAgxvKBAmAopeLcH2VkQoE24tSr8WaCvWd6K2X28fEm7t59W2l3C1D+/1E9Deeu+1lWAVK2iF3lbRajPyKlYhsaJFA80koCDPCXln5px919ozZzKTzJk558yZV8jv+843J2f2OZnk/Gettfdaex8GQ5jj100e4NJSAF4OHMrxiCv8jg8YbsA3ggxeqCrzwSCFwRDGEKJhq1EwHl3tGasFWVkzGEWUMfHwZZUupStQyYAvxF9L31R31NsNHDeJsY1s+1NeyFU2Nq/Gv6QGjOMDiVfBLWVeGERkRDx88c0rURw1uOfS0dynML7Gvn1TLeQS5oUTBauE26ZthEFCWsVD1oZ3BV7AXQ8YhHFew17ZtAZyAUuEE0biFYPFAqVNPPyaSjfngTqIdU/GrgFQa3v56SrIJhua3CCxJrAOHyh8DsZAfshzJEgTKJwNkIJwCFR2JV9801rIJja2AawFxQjVMAhIi3goxgETrirutQCq+TU3eyAbkNXh5v6OWy8oBnexTeNdthKvrSf+y2ksF49wV8At/WZxzldDNpCgEkzwo8tGwC/njoJbUEAau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8qkrSGahnVzwK+OOuMFJyHGDCu6HKQipNjZppsfmACx5piP7Y7bh9DHqZ1P0+5AnlgVCich0YRALu5cDMJq59bPtTXj0NM/OMUaP0hFdEpfUJi05jUvMIphveF1tj7xk4X+A63Ud/WKiMwlS8xEM1PbrITfGQldFYBZ6KxCaNsKjIKrfZuGfPnlowCWPycjAkIOZH4ayyvfy0bkunuSwVPaHF4XCUK4ripp/NfgsScflYp/vy0Y7Y4qWCNhyRR+EU4WhwQXvc85pOF0Nd41gYxPjx/74t+oAkST71XugFz3EvsQ9fOp7ZNO9dDyiuApD82+Vzrx9X+lYOw9/l638tdd9ut6+jWOz/AXtcu0k24b8pAAAAAElFTkSuQmCC",sce=({surveyData:t,onClose:e,onSubmit:n,isSubmitting:r=!1})=>{var te;const[i,s]=D.useState(!1),[l,u]=D.useState(null),[d,h]=D.useState(null),[m,g]=D.useState(""),y=(t==null?void 0:t.title)||"How was your support experience?",b=(t==null?void 0:t.description)||"",C=(t==null?void 0:t.is_description_enabled)||!1,w=(t==null?void 0:t.active_rating_type)||"numeric",_=(t==null?void 0:t.is_optional_question_enabled)||!1,R=(t==null?void 0:t.is_open_ended_question_enabled)||!1,k=(t==null?void 0:t.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",L=(t==null?void 0:t.optional_question_options)||[],N=(t==null?void 0:t.open_ended_question_title)||"Share your thoughts on the support you received",A=((te=t==null?void 0:t.rating_types)==null?void 0:te.filter(X=>X.rating_type===w).sort((X,ne)=>ne.score-X.score))||[],P=X=>{u(X)},F=X=>{h(ne=>ne===X?null:X)},U=async()=>{if(!l||!n)return;const X={satisfaction_rating_type_id:l.id,optional_question_responses:d?[typeof d=="string"?d:d.label]:null,open_ended_question_response:(m==null?void 0:m.trim())||null};try{if(await n(X)===!1){ii("error","We could not submit your feedback. Please try again.","top-left");return}s(!0)}catch{ii("error","We could not submit your feedback. Please try again.","top-left")}},$=()=>{e&&e()},K=()=>w==="numeric"?T.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[T.jsx("div",{className:Ei("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",ne?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:X.numeric_value}),T.jsx("span",{className:Ei("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="emoji"?T.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:Ei("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[T.jsx("div",{className:Ei("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",ne?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:xV[X.emoji]&&xV[X.emoji]}),T.jsx("span",{className:Ei("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="custom_text"?T.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsx("button",{type:"button",onClick:()=>P(X),className:Ei("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",ne?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:X.label},X.id)})}):null;return i?T.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),T.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:T.jsx(Mo,{src:oce,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):T.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[T.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:y}),C&&b&&T.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:b}),T.jsx("div",{className:"ed-py-2",children:K()}),l&&l.score<=2&&_&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:k}),T.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:L.map((X,ne)=>T.jsx("button",{type:"button",onClick:()=>F(X),className:Ei("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",d===X?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof X=="string"?X:X==null?void 0:X.label},`optional-option-${X.label+ne}`))})]}),l&&R&&(!(l.score<=2&&_)||d)&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:N}),T.jsx("textarea",{placeholder:"Write here",value:m,onChange:X=>g(X.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),l&&T.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:T.jsx(Zf,{title:"Submit",callBack:U,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},lce=({orgBrandSetting:t={},userData:e={},currentConversationID:n,setCurrentConversationID:r})=>{var Je,Ke,ht,At,ct;const{conversationData:i,initialStatesData:s,conversationState:l,inputFieldState:u,setInputFieldState:d,isAIThinking:h,setIsAIThinking:m,handleUpdateConversationActivityAnalytics:g,send:y}=Jh(),{sendMessage:b}=Nx(),{satisfaction_setting:C}=t||{},w=C==null?void 0:C.satisfaction_survey,[_,R]=D.useState(!0),k=D.useRef(null),L=D.useRef(null),N=D.useRef(!1),A=Ko.get("easydesk_chat_widget_conversation_id"),{brand:P}=t,[F,U]=D.useState(null),[$,K]=D.useState(!1),[te,X]=D.useState([]),ne=n||A,[Y]=Ph(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),[H,{loading:G}]=hu(rce,{errorPolicy:"all",fetchPolicy:"no-cache"}),Z=async ke=>{var He,nt;try{const Dt=ace({title:ke==null?void 0:ke.title,message:ke==null?void 0:ke.message,files:ke.conversation_activity_files}),et=await b({is_customer_reply:!0,message:Dt,conversation_id:ne});if(et!=null&&et.id){d(Jt=>({...Jt,ticket_title:ke==null?void 0:ke.ticket_title,ticket_activity:ke==null?void 0:ke.ticket_activity,conversation_activity_files:ke==null?void 0:ke.conversation_activity_files}));const Rt=wS(jr.ticket.success,{ticket_id:(ke==null?void 0:ke.ticketId)||"N/A",customer_email:((He=i==null?void 0:i.contact)==null?void 0:He.person_email)||(u==null?void 0:u.contact_person_email)||"your email"});await b({is_auto_response:!0,message:Rt,conversation_status:"closed",current_stage:"closed"},!0),y({type:In.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Dt){const{message:et,response:Rt}=Dt;ii("error",((nt=Rt==null?void 0:Rt.data)==null?void 0:nt.message)||et,"top-left")}},J=async()=>{try{await b({conversation_id:ne,message:jr.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(ke){console.error("Error creating follow-up message:",ke)}},le=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling initial no click:",He)}},re=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling intermediate yes click:",He)}},ie=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling intermediate no click:",He)}},ce=async()=>{try{await b({conversation_id:ne,message:jr.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(ke){console.error("Error restarting conversation:",ke)}},ge=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling follow-up no click:",He)}},ye=async ke=>{try{await b({conversation_id:ne,message:ke.message,is_customer_reply:ke.is_customer_reply,channel_id:ke.channel_id,current_stage:"agent_chat"}),X([]),await b({conversation_id:ne,message:jr.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(He){console.error("Error selecting channel:",He)}},Re=async ke=>{var He;try{const nt={conversation_id:ne,satisfaction_rating_type_id:ke.satisfaction_rating_type_id,optional_question_responses:ke.optional_question_responses||null,open_ended_question_response:ke.open_ended_question_response||null},{data:Dt}=await H({variables:{inputData:nt}});return!!((He=Dt==null?void 0:Dt.createASatisfactionRating)!=null&&He.id)}catch(nt){return console.error("Error submitting survey:",nt),ii("error","Failed to submit feedback. Please try again.","top-left"),!1}},Se=()=>{y({type:In.RELOAD_CONVERSATION_DATA}),R(!1)},we=()=>{y({type:In.CONVERSATION_CLOSED}),d(s.inputFieldState),U(!1),Ko.remove("easydesk_chat_widget_conversation_id")},$e=((Je=l==null?void 0:l.metaData)==null?void 0:Je.filtered_rows)&&Ot.size(l==null?void 0:l.messages)<((Ke=l==null?void 0:l.metaData)==null?void 0:Ke.filtered_rows),{loadMoreMessages:Ge}=Nx(),We=Ge;D.useEffect(()=>{if(!L.current||N.current)return;const He=setTimeout(()=>{const nt=L.current;nt&&requestAnimationFrame(()=>{nt.scrollTop=nt.scrollHeight})},100);return()=>clearTimeout(He)},[Ot.size(l==null?void 0:l.messages)]),D.useEffect(()=>{if(ne&&L.current){const ke=setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},300);return()=>clearTimeout(ke)}},[ne]),D.useEffect(()=>{ne&&(k.current=null)},[ne]);const Me=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),fe=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!C||!w||!C.is_satisfaction_rating_enabled)return!1;const ke=i==null?void 0:i.type;return!(ke==="ticket"&&!C.is_ticket_feedback_active||ke==="chat"&&!C.is_chat_feedback_active)})(),Ze=()=>{var He;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1];return((He=ke==null?void 0:ke.metadata)==null?void 0:He.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},Ue=()=>{if(h)return!0;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1],He=ke==null?void 0:ke.metadata;return!He||ke!=null&&ke.is_customer_reply?!1:!!(He.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(He.current_stage)||He.has_results===!0||He.has_results===!1)};return D.useEffect(()=>{let ke=[];const He=Ot.debounce(async()=>{await g({seen_activity_ids:ke}),ke=[]},1e3),nt=new IntersectionObserver(et=>{et.forEach(Rt=>{if(Rt.isIntersecting){const Jt=Rt.target.getAttribute("data-message-id");Jt&&ke.push(Jt)}}),Ot.size(ke)&&He()},{threshold:1}),Dt=document.querySelectorAll(".ed-message");return Dt.forEach(et=>nt.observe(et)),()=>{He.cancel(),Dt.forEach(et=>nt.unobserve(et))}},[l==null?void 0:l.messages]),T.jsxs("div",{children:[T.jsx("div",{ref:L,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:T.jsx(Yw,{dataLength:Ot.size(l==null?void 0:l.messages),hasMore:$e,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{N.current=!0,We(),setTimeout(()=>{N.current=!1},500)},children:T.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[Ot.size(l==null?void 0:l.messages)?T.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&T.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[T.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),T.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(ht=l==null?void 0:l.messages)==null?void 0:ht.map(ke=>T.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(ke==null?void 0:ke.type)?T.jsx(bV,{activityMessage:ke,brand:P,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},ke==null?void 0:ke.id):T.jsx(Jle,{log:ke==null?void 0:ke.log},ke==null?void 0:ke.id)},ke==null?void 0:ke.id))]}):T.jsx(nue,{onSubmit:ke=>{d(He=>({...He,contact_person_name:ke==null?void 0:ke.contact_person_name,contact_person_email:ke==null?void 0:ke.contact_person_email}))},orgBrandSetting:t,setSelectedConversationId:r,userData:e}),!h&&(l==null?void 0:l.messages)&&Ot.size(l.messages)>0&&(()=>{const ke=l.messages[l.messages.length-1],{metadata:He}=ke||{};if(He&&!(ke!=null&&ke.is_customer_reply)){const{current_stage:nt}=He;if(!nt&&He.has_results===!0)return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="initial_feedback")return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="followup_feedback")return T.jsx(OS,{type:"followup",sendMessage:b,conversationId:ne,onYes:ce,onNo:ge});if(nt==="intermediate_help")return T.jsx(OS,{type:"intermediate",sendMessage:b,conversationId:ne,onYes:re,onNo:ie});if(nt==="need_help")return T.jsx(CV,{type:"need_help",sendMessage:b,conversationId:ne,showChatButton:$,setIsAIThinking:m,onChannelSelection:ye});if(!He.has_results&&!nt&&!(i!=null&&i.assignee))return T.jsx(CV,{type:"no_results",sendMessage:b,conversationId:ne,setIsAIThinking:m,onChannelSelection:ye});if(nt==="select_channel")return T.jsx(tce,{channels:te,onSubmit:ye});if(nt==="create_a_support_ticket")return T.jsx(BP,{from:"message",isAuthenticated:!0,onSubmit:Z,reqId:null,userData:u,metadata:He})}return null})(),(((At=l==null?void 0:l.writing_realtime_status)==null?void 0:At.is_writing_reply)||h)&&T.jsx("div",{className:"single-message ed-px-5",children:T.jsx(bV,{brand:P,activityMessage:{user:(ct=l==null?void 0:l.writing_realtime_status)==null?void 0:ct.author,is_customer_reply:!1,is_ai_response:h,created_at:Date.now()},isReplying:!0})})]})})}),fe&&_&&T.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:T.jsx(sce,{surveyData:w,onSubmit:Re,isSubmitting:G,onClose:Se})}),((i==null?void 0:i.type)==="ticket"||!Me&&Ot.size(l==null?void 0:l.messages)>=3&&!F&&!Ue()&&F!=="CONVERSATION_ENDED")&&T.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:T.jsx(ece,{conversationData:i,conversationId:ne,handleCreateMessage:b,onAIThinkingChange:m,isAIThinking:h,useAITemplate:!Ze()})}),(i==null?void 0:i.type)!=="ticket"&&(F&&F!=="CONVERSATION_ENDED"||Me)&&T.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:T.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",T.jsx("br",{}),"To start a new chat, ",T.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:we,children:"click here"})]})})]})},uce=({item:t,onSelect:e,userData:n})=>{const{id:r,type:i,status:s,last_conversation_activity:l,organization_brand:u,assignee:d}=t||{},{handleUpdateConversationActivityAnalytics:h}=mu(),{message:m,user:g,created_at:y,analytics:b}=l||{},{status:C}=(b==null?void 0:b[0])||{},{setting:w,name:_}=u||{},{first_name:R,last_name:k,email:L,avatar_file:N}=(d==null?void 0:d.user)||{},A=D.useMemo(()=>R0(R,k,L)||_||"Unknown User",[R,k,L,_]),P=N||(w==null?void 0:w.icon),F=(n==null?void 0:n.id)===(g==null?void 0:g.id),U=ne=>F?"ed-text-border-dark":ne?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",$=async()=>{C!=="seen"&&await h({seen_activity_ids:[l==null?void 0:l.id]}),e(r)},K=D.useMemo(()=>$ue[s],[s]),te=F&&C==="seen",X=D.useMemo(()=>Wue(m),[m]);return T.jsxs("div",{role:"button",tabIndex:0,onClick:$,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[T.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:T.jsx(Mo,{alt:A,path:P==null?void 0:P.key,defaultImageName:_l(L||_),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),T.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[T.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[T.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${U(te)}`,children:m?X:"[Attachment]"}),T.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[T.jsx(CS,{content:T.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?T.jsx(BL,{}):T.jsx(HL,{})}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:`ed-text-12 ${U(te)}`,children:__(A,20)}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:"ed-text-12 ed-text-brand",children:que(y)})]})]}),T.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(t==null?void 0:t.unread_count)>0?T.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:t.unread_count}):!F&&C!=="seen"&&T.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),T.jsx("span",{className:"ed-custom-children",children:T.jsx(vu,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(s)&&T.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${K==null?void 0:K.className}`,children:K==null?void 0:K.label})]})]})},cce="easydesk_chat_widget_conversation_id",fce=({setCurrentConversationID:t,userData:e})=>{const n=D.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:s,loadingStates:l,setOptionData:u,optionData:d}=mu(),{send:h,initialStatesData:m,setConversationState:g}=Jh(),y=async()=>{h({type:In.CONVERSATION_CLOSED}),Ko.remove(cce),t(null),g(m.conversationState),r(!1)},b=w=>{w&&(t(w),r(!1))};D.useEffect(()=>{const w=setTimeout(()=>{var k;const _=(k=n.current)==null?void 0:k.querySelectorAll(".single-message-container"),R=_==null?void 0:_[Ot.size(_)-1];R==null||R.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(w)},[Ot.size(i)]);const C=(s==null?void 0:s.total_rows)>Ot.size(i);return T.jsxs("div",{children:[T.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:T.jsx(Yw,{dataLength:Ot.size(i),hasMore:C,loader:l!=null&&l.fetchMoreLoading?T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsx(lp,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{u({...d,offset:d.offset+d.limit})},children:i==null?void 0:i.map(w=>T.jsx(uce,{item:w,onSelect:b,userData:e},w.id))})}),T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsxs("button",{onClick:y,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),T.jsx(vu,{size:16})]})})]})},dce=()=>{const{setIsChatHistory:t}=mu();return T.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:T.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[T.jsx(Pte,{}),T.jsxs("button",{onClick:()=>t(e=>!e),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",T.jsx(vu,{})]})]})})},hce=({orgBrandSetting:t,setIsPopupOpen:e,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:s,isChatHistory:l,setIsChatHistory:u,setCurrentConversationID:d,currentConversationID:h}=mu(),m=D.useMemo(()=>l?Ot.size(r)?T.jsx(fce,{data:r,userData:n,setCurrentConversationID:d}):T.jsx(dce,{}):T.jsx(lce,{orgBrandSetting:t,setIsPopupOpen:e,userData:n,currentConversationID:h,setCurrentConversationID:d,refreshConversations:s}),[r,n,h,l,t,u,e]);return i!=null&&i.initialLoading?T.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:T.jsx(lp,{})}):T.jsx("div",{children:m})};var RT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};RT.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1820
+ </div>`},xV={ANGRY:T.jsx(Ite,{}),SAD:T.jsx(Vte,{}),NEUTRAL:T.jsx(Fte,{}),HAPPY:T.jsx(jte,{}),LOVE:T.jsx(Ute,{})},oce="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI8AAACHCAYAAAAvMAr+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAH2dJREFUeAHtnQt4VNW1x9c+80hIAgxvKBAmAopeLcH2VkQoE24tSr8WaCvWd6K2X28fEm7t59W2l3C1D+/1E9Deeu+1lWAVK2iF3lbRajPyKlYhsaJFA80koCDPCXln5px919ozZzKTzJk558yZV8jv+843J2f2OZnk/Gettfdaex8GQ5jj100e4NJSAF4OHMrxiCv8jg8YbsA3ggxeqCrzwSCFwRDGEKJhq1EwHl3tGasFWVkzGEWUMfHwZZUupStQyYAvxF9L31R31NsNHDeJsY1s+1NeyFU2Nq/Gv6QGjO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YdnKwdlpesJfu3SZ7rbktvIqWOb60gTZIqOJ0bCgIvD7KVYJT8Yn8agLO9EUHEdYUEJYwaj9WJGVjP406OH4qZOhYLkwj2aH2s4jt5UStAJqp4H6FxTRoc5umFmM+aO6v4eOuTA5OX4GbjNRfFHPUO84DY37/iR282qCn9FVMayCc13VhtkVD+N+M49UamyT4dA5BUocBVASOA31LFwDdAbztX/Hrbg+JB7aAmjFOs7Ai28eEE0K5U4Y3+ODQiWUJ8vFqTf02SQebHB7PC6jq7ITmNBsZik8qkrSGahnVzwK+OOuMFJyHGDCu6HKQipNjZppsfmACx5piP7Y7bh9DHqZ1P0+5AnlgVCich0YRALu5cDMJq59bPtTXj0NM/OMUaP0hFdEpfUJi05jUvMIphveF1tj7xk4X+A63Ud/WKiMwlS8xEM1PbrITfGQldFYBZ6KxCaNsKjIKrfZuGfPnlowCWPycjAkIOZH4ayyvfy0bkunuSwVPaHF4XCUK4ripp/NfgsScflYp/vy0Y7Y4qWCNhyRR+EU4WhwQXvc85pOF0Nd41gYxPjx/74t+oAkST71XugFz3EvsQ9fOp7ZNO9dDyiuApD82+Vzrx9X+lYOw9/l638tdd9ut6+jWOz/AXtcu0k24b8pAAAAAElFTkSuQmCC",sce=({surveyData:t,onClose:e,onSubmit:n,isSubmitting:r=!1})=>{var te;const[i,s]=D.useState(!1),[l,u]=D.useState(null),[d,h]=D.useState(null),[m,g]=D.useState(""),y=(t==null?void 0:t.title)||"How was your support experience?",b=(t==null?void 0:t.description)||"",C=(t==null?void 0:t.is_description_enabled)||!1,w=(t==null?void 0:t.active_rating_type)||"numeric",_=(t==null?void 0:t.is_optional_question_enabled)||!1,R=(t==null?void 0:t.is_open_ended_question_enabled)||!1,k=(t==null?void 0:t.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",L=(t==null?void 0:t.optional_question_options)||[],N=(t==null?void 0:t.open_ended_question_title)||"Share your thoughts on the support you received",A=((te=t==null?void 0:t.rating_types)==null?void 0:te.filter(X=>X.rating_type===w).sort((X,ne)=>ne.score-X.score))||[],P=X=>{u(X)},F=X=>{h(ne=>ne===X?null:X)},U=async()=>{if(!l||!n)return;const X={satisfaction_rating_type_id:l.id,optional_question_responses:d?[typeof d=="string"?d:d.label]:null,open_ended_question_response:(m==null?void 0:m.trim())||null};try{if(await n(X)===!1){ii("error","We could not submit your feedback. Please try again.","top-left");return}s(!0)}catch{ii("error","We could not submit your feedback. Please try again.","top-left")}},$=()=>{e&&e()},K=()=>w==="numeric"?T.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[T.jsx("div",{className:Ei("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",ne?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:X.numeric_value}),T.jsx("span",{className:Ei("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="emoji"?T.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:Ei("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[T.jsx("div",{className:Ei("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",ne?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:xV[X.emoji]&&xV[X.emoji]}),T.jsx("span",{className:Ei("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="custom_text"?T.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsx("button",{type:"button",onClick:()=>P(X),className:Ei("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",ne?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:X.label},X.id)})}):null;return i?T.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),T.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:T.jsx(Mo,{src:oce,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):T.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[T.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:y}),C&&b&&T.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:b}),T.jsx("div",{className:"ed-py-2",children:K()}),l&&l.score<=2&&_&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:k}),T.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:L.map((X,ne)=>T.jsx("button",{type:"button",onClick:()=>F(X),className:Ei("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",d===X?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof X=="string"?X:X==null?void 0:X.label},`optional-option-${X.label+ne}`))})]}),l&&R&&(!(l.score<=2&&_)||d)&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:N}),T.jsx("textarea",{placeholder:"Write here",value:m,onChange:X=>g(X.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),l&&T.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:T.jsx(Zf,{title:"Submit",callBack:U,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},lce=({orgBrandSetting:t={},userData:e={},currentConversationID:n,setCurrentConversationID:r})=>{var Je,Ke,ht,At,ct;const{conversationData:i,initialStatesData:s,conversationState:l,inputFieldState:u,setInputFieldState:d,isAIThinking:h,setIsAIThinking:m,handleUpdateConversationActivityAnalytics:g,send:y}=Jh(),{sendMessage:b}=Nx(),{satisfaction_setting:C}=t||{},w=C==null?void 0:C.satisfaction_survey,[_,R]=D.useState(!0),k=D.useRef(null),L=D.useRef(null),N=D.useRef(!1),A=Ko.get("easydesk_chat_widget_conversation_id"),{brand:P}=t,[F,U]=D.useState(null),[$,K]=D.useState(!1),[te,X]=D.useState([]),ne=n||A,[Y]=Ph(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),[H,{loading:G}]=hu(rce,{errorPolicy:"all",fetchPolicy:"no-cache"}),Z=async ke=>{var He,nt;try{const Dt=ace({title:ke==null?void 0:ke.title,message:ke==null?void 0:ke.message,files:ke.conversation_activity_files}),et=await b({is_customer_reply:!0,message:Dt,conversation_id:ne});if(et!=null&&et.id){d(Jt=>({...Jt,ticket_title:ke==null?void 0:ke.ticket_title,ticket_activity:ke==null?void 0:ke.ticket_activity,conversation_activity_files:ke==null?void 0:ke.conversation_activity_files}));const Rt=wS(jr.ticket.success,{ticket_id:(ke==null?void 0:ke.ticketId)||"N/A",customer_email:((He=i==null?void 0:i.contact)==null?void 0:He.person_email)||(u==null?void 0:u.contact_person_email)||"your email"});await b({is_auto_response:!0,message:Rt,conversation_status:"closed",current_stage:"closed"},!0),y({type:In.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Dt){const{message:et,response:Rt}=Dt;ii("error",((nt=Rt==null?void 0:Rt.data)==null?void 0:nt.message)||et,"top-left")}},J=async()=>{try{await b({conversation_id:ne,message:jr.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(ke){console.error("Error creating follow-up message:",ke)}},le=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling initial no click:",He)}},re=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling intermediate yes click:",He)}},ie=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling intermediate no click:",He)}},ce=async()=>{try{await b({conversation_id:ne,message:jr.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(ke){console.error("Error restarting conversation:",ke)}},ge=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling follow-up no click:",He)}},ye=async ke=>{try{await b({conversation_id:ne,message:ke.message,is_customer_reply:ke.is_customer_reply,channel_id:ke.channel_id,current_stage:"agent_chat"}),X([]),await b({conversation_id:ne,message:jr.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(He){console.error("Error selecting channel:",He)}},Re=async ke=>{var He;try{const nt={conversation_id:ne,satisfaction_rating_type_id:ke.satisfaction_rating_type_id,optional_question_responses:ke.optional_question_responses||null,open_ended_question_response:ke.open_ended_question_response||null},{data:Dt}=await H({variables:{inputData:nt}});return!!((He=Dt==null?void 0:Dt.createASatisfactionRating)!=null&&He.id)}catch(nt){return console.error("Error submitting survey:",nt),ii("error","Failed to submit feedback. Please try again.","top-left"),!1}},Se=()=>{y({type:In.RELOAD_CONVERSATION_DATA}),R(!1)},we=()=>{y({type:In.CONVERSATION_CLOSED}),d(s.inputFieldState),U(!1),Ko.remove("easydesk_chat_widget_conversation_id")},$e=((Je=l==null?void 0:l.metaData)==null?void 0:Je.filtered_rows)&&Ot.size(l==null?void 0:l.messages)<((Ke=l==null?void 0:l.metaData)==null?void 0:Ke.filtered_rows),{loadMoreMessages:Ge}=Nx(),We=Ge;D.useEffect(()=>{if(!L.current||N.current)return;const He=setTimeout(()=>{const nt=L.current;nt&&requestAnimationFrame(()=>{nt.scrollTop=nt.scrollHeight})},100);return()=>clearTimeout(He)},[Ot.size(l==null?void 0:l.messages)]),D.useEffect(()=>{if(ne&&L.current){const ke=setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},300);return()=>clearTimeout(ke)}},[ne]),D.useEffect(()=>{ne&&(k.current=null)},[ne]);const Me=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),fe=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!C||!w||!C.is_satisfaction_rating_enabled)return!1;const ke=i==null?void 0:i.type;return!(ke==="ticket"&&!C.is_ticket_feedback_active||ke==="chat"&&!C.is_chat_feedback_active)})(),Ze=()=>{var He;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1];return((He=ke==null?void 0:ke.metadata)==null?void 0:He.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},Ue=()=>{if(h)return!0;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1],He=ke==null?void 0:ke.metadata;return!He||ke!=null&&ke.is_customer_reply?!1:!!(He.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(He.current_stage)||He.has_results===!0||He.has_results===!1)};return D.useEffect(()=>{let ke=[];const He=Ot.debounce(async()=>{await g({seen_activity_ids:ke}),ke=[]},1e3),nt=new IntersectionObserver(et=>{et.forEach(Rt=>{if(Rt.isIntersecting){const Jt=Rt.target.getAttribute("data-message-id");Jt&&ke.push(Jt)}}),Ot.size(ke)&&He()},{threshold:1}),Dt=document.querySelectorAll(".ed-message");return Dt.forEach(et=>nt.observe(et)),()=>{He.cancel(),Dt.forEach(et=>nt.unobserve(et))}},[l==null?void 0:l.messages]),T.jsxs("div",{children:[T.jsx("div",{ref:L,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:T.jsx(Yw,{dataLength:Ot.size(l==null?void 0:l.messages),hasMore:$e,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{N.current=!0,We(),setTimeout(()=>{N.current=!1},500)},children:T.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[Ot.size(l==null?void 0:l.messages)?T.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&T.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[T.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),T.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(ht=l==null?void 0:l.messages)==null?void 0:ht.map(ke=>T.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(ke==null?void 0:ke.type)?T.jsx(bV,{activityMessage:ke,brand:P,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},ke==null?void 0:ke.id):T.jsx(Jle,{log:ke==null?void 0:ke.log},ke==null?void 0:ke.id)},ke==null?void 0:ke.id))]}):T.jsx(nue,{onSubmit:ke=>{d(He=>({...He,contact_person_name:ke==null?void 0:ke.contact_person_name,contact_person_email:ke==null?void 0:ke.contact_person_email}))},orgBrandSetting:t,setSelectedConversationId:r,userData:e}),!h&&(l==null?void 0:l.messages)&&Ot.size(l.messages)>0&&(()=>{const ke=l.messages[l.messages.length-1],{metadata:He}=ke||{};if(He&&!(ke!=null&&ke.is_customer_reply)){const{current_stage:nt}=He;if(!nt&&He.has_results===!0)return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="initial_feedback")return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="followup_feedback")return T.jsx(OS,{type:"followup",sendMessage:b,conversationId:ne,onYes:ce,onNo:ge});if(nt==="intermediate_help")return T.jsx(OS,{type:"intermediate",sendMessage:b,conversationId:ne,onYes:re,onNo:ie});if(nt==="need_help")return T.jsx(CV,{type:"need_help",sendMessage:b,conversationId:ne,showChatButton:$,setIsAIThinking:m,onChannelSelection:ye});if(!He.has_results&&!nt&&!(i!=null&&i.assignee))return T.jsx(CV,{type:"no_results",sendMessage:b,conversationId:ne,setIsAIThinking:m,onChannelSelection:ye});if(nt==="select_channel")return T.jsx(tce,{channels:te,onSubmit:ye});if(nt==="create_a_support_ticket")return T.jsx(BP,{from:"message",isAuthenticated:!0,onSubmit:Z,reqId:null,userData:u,metadata:He})}return null})(),(((At=l==null?void 0:l.writing_realtime_status)==null?void 0:At.is_writing_reply)||h)&&T.jsx("div",{className:"single-message ed-px-5",children:T.jsx(bV,{brand:P,activityMessage:{user:(ct=l==null?void 0:l.writing_realtime_status)==null?void 0:ct.author,is_customer_reply:!1,is_ai_response:h,created_at:Date.now()},isReplying:!0})})]})})}),fe&&_&&T.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-w-full ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:T.jsx(sce,{surveyData:w,onSubmit:Re,isSubmitting:G,onClose:Se})}),((i==null?void 0:i.type)==="ticket"||!Me&&Ot.size(l==null?void 0:l.messages)>=3&&!F&&!Ue()&&F!=="CONVERSATION_ENDED")&&T.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:T.jsx(ece,{conversationData:i,conversationId:ne,handleCreateMessage:b,onAIThinkingChange:m,isAIThinking:h,useAITemplate:!Ze()})}),(i==null?void 0:i.type)!=="ticket"&&(F&&F!=="CONVERSATION_ENDED"||Me)&&T.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:T.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",T.jsx("br",{}),"To start a new chat, ",T.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:we,children:"click here"})]})})]})},uce=({item:t,onSelect:e,userData:n})=>{const{id:r,type:i,status:s,last_conversation_activity:l,organization_brand:u,assignee:d}=t||{},{handleUpdateConversationActivityAnalytics:h}=mu(),{message:m,user:g,created_at:y,analytics:b}=l||{},{status:C}=(b==null?void 0:b[0])||{},{setting:w,name:_}=u||{},{first_name:R,last_name:k,email:L,avatar_file:N}=(d==null?void 0:d.user)||{},A=D.useMemo(()=>R0(R,k,L)||_||"Unknown User",[R,k,L,_]),P=N||(w==null?void 0:w.icon),F=(n==null?void 0:n.id)===(g==null?void 0:g.id),U=ne=>F?"ed-text-border-dark":ne?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",$=async()=>{C!=="seen"&&await h({seen_activity_ids:[l==null?void 0:l.id]}),e(r)},K=D.useMemo(()=>$ue[s],[s]),te=F&&C==="seen",X=D.useMemo(()=>Wue(m),[m]);return T.jsxs("div",{role:"button",tabIndex:0,onClick:$,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[T.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:T.jsx(Mo,{alt:A,path:P==null?void 0:P.key,defaultImageName:_l(L||_),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),T.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[T.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[T.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${U(te)}`,children:m?X:"[Attachment]"}),T.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[T.jsx(CS,{content:T.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?T.jsx(BL,{}):T.jsx(HL,{})}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:`ed-text-12 ${U(te)}`,children:__(A,20)}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:"ed-text-12 ed-text-brand",children:que(y)})]})]}),T.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(t==null?void 0:t.unread_count)>0?T.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:t.unread_count}):!F&&C!=="seen"&&T.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),T.jsx("span",{className:"ed-custom-children",children:T.jsx(vu,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(s)&&T.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${K==null?void 0:K.className}`,children:K==null?void 0:K.label})]})]})},cce="easydesk_chat_widget_conversation_id",fce=({setCurrentConversationID:t,userData:e})=>{const n=D.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:s,loadingStates:l,setOptionData:u,optionData:d}=mu(),{send:h,initialStatesData:m,setConversationState:g}=Jh(),y=async()=>{h({type:In.CONVERSATION_CLOSED}),Ko.remove(cce),t(null),g(m.conversationState),r(!1)},b=w=>{w&&(t(w),r(!1))};D.useEffect(()=>{const w=setTimeout(()=>{var k;const _=(k=n.current)==null?void 0:k.querySelectorAll(".single-message-container"),R=_==null?void 0:_[Ot.size(_)-1];R==null||R.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(w)},[Ot.size(i)]);const C=(s==null?void 0:s.total_rows)>Ot.size(i);return T.jsxs("div",{children:[T.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:T.jsx(Yw,{dataLength:Ot.size(i),hasMore:C,loader:l!=null&&l.fetchMoreLoading?T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsx(lp,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{u({...d,offset:d.offset+d.limit})},children:i==null?void 0:i.map(w=>T.jsx(uce,{item:w,onSelect:b,userData:e},w.id))})}),T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsxs("button",{onClick:y,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),T.jsx(vu,{size:16})]})})]})},dce=()=>{const{setIsChatHistory:t}=mu();return T.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:T.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[T.jsx(Pte,{}),T.jsxs("button",{onClick:()=>t(e=>!e),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",T.jsx(vu,{})]})]})})},hce=({orgBrandSetting:t,setIsPopupOpen:e,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:s,isChatHistory:l,setIsChatHistory:u,setCurrentConversationID:d,currentConversationID:h}=mu(),m=D.useMemo(()=>l?Ot.size(r)?T.jsx(fce,{data:r,userData:n,setCurrentConversationID:d}):T.jsx(dce,{}):T.jsx(lce,{orgBrandSetting:t,setIsPopupOpen:e,userData:n,currentConversationID:h,setCurrentConversationID:d,refreshConversations:s}),[r,n,h,l,t,u,e]);return i!=null&&i.initialLoading?T.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:T.jsx(lp,{})}):T.jsx("div",{children:m})};var RT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};RT.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1821
1821
  getArticles(queryData: $queryData, optionData: $optionData) {
1822
1822
  data {
1823
1823
  id
@@ -1825,7 +1825,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1825
1825
  }
1826
1826
  }
1827
1827
  }
1828
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function MS(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){MS(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){MS(r,e)}),t.definitions&&t.definitions.forEach(function(r){MS(r,e)})}var kT={};(function(){RT.definitions.forEach(function(e){if(e.name){var n=new Set;MS(e,n),kT[e.name.value]=n}})})();function wV(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function pce(t,e){var n={kind:t.kind,definitions:[wV(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=kT[e]||new Set,i=new Set,s=new Set;for(r.forEach(function(u){s.add(u)});s.size>0;){var l=s;s=new Set,l.forEach(function(u){if(!i.has(u)){i.add(u);var d=kT[u]||new Set;d.forEach(function(h){s.add(h)})}})}return i.forEach(function(u){var d=wV(t,u);d&&n.definitions.push(d)}),n}const mce=pce(RT,"GET_ARTICLES"),vce=t=>{const{userData:e,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:s,setThemeColor:l}=t||{},{activeTab:u,setActiveTab:d,orgBrandSetting:h,setOrgBrandSetting:m,setCurrentConversationID:g,messageListUnreadCount:y}=mu(),{unreadMessages:b}=Jh(),C=y||Ot.size(b),[w,_]=D.useState(""),[R,k]=D.useState(null),[L,N]=D.useState(null),[A,P]=D.useState(!1),[F,U]=D.useState([]),[$,K]=D.useState(!1),[te,X]=D.useState(!1),[ne,Y]=D.useState(!1),[H,G]=D.useState(!1),Z=new URLSearchParams(window.location.search).get("intent");D.useEffect(()=>{const Me=Z||n;Me?Me==="chat"?(Y(!0),G(!1),d("messages"),i(!0)):Me==="kb"&&(G(!0),Y(!1),d("knowledge_base"),i(!0)):(Y(!1),G(!1),i(!1))},[n,Z]);const[J,{loading:le}]=Ph(mce,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:re,data:ie}=Ih(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),ce=async Me=>{var Ue;const{data:fe,error:Ze}=await J(Me);fe!=null&&fe.getArticles&&U(((Ue=fe==null?void 0:fe.getArticles)==null?void 0:Ue.data)||[]),Ze&&console.error(Ze)};D.useEffect(()=>{var Me;ie!=null&&ie.getChannelsForPortal&&X(Ot.size((Me=ie==null?void 0:ie.getChannelsForPortal)==null?void 0:Me.data)>0)},[ie]);const ge=AM(Me=>{ce({variables:{queryData:{search_keyword:Me}}})},500),ye=Me=>{_(Me),ge(Me)},Re=async()=>{K(!0);try{const Me=await aJ();if(Me){const{font:fe,is_knowledge_base_enabled:Ze,theme_color:Ue}=Me;m(Me),l(Ue),gJ(fe),C>0&&te?d("messages"):Ze&&!te||Ze&&te?d("knowledge_base"):!Ze&&te&&d("messages"),K(!1)}}catch(Me){console.error(Me),K(!1)}},Se=()=>{const Me=document.getElementById("ed-widget");i(!r),r&&(e!=null&&e.isAuthenticated)&&g(null),_(""),k(null),N(null),P(!1),Re(),n&&Me&&Me.removeAttribute("ed-widget-intent"),Y(!1),G(!1)};D.useEffect(()=>{Re()},[]),D.useEffect(()=>{if(!h)return;const{is_knowledge_base_enabled:Me}=h;te&&ne?(d("messages"),i(!0)):Me&&H&&(d("knowledge_base"),i(!0))},[h,te,ne]);const we=()=>u==="knowledge_base"?T.jsx(Mne,{loading:le,articleId:L,isAuthenticated:e==null?void 0:e.isAuthenticated,selectedCategory:R,setArticleId:N,setSelectedCategory:k,orgBrandSetting:h,isMobileScreen:s}):u==="messages"?T.jsx(hce,{orgBrandSetting:h,setIsPopupOpen:i,userData:e}):null,{brand:$e,is_knowledge_base_enabled:Ge}=h||{},We=Me=>{d(Me),_(""),k(null),N(null),P(!1)};return!Ge&&!te?null:T.jsxs("div",{children:[te||Ge?T.jsx(Kle,{isPopupOpen:r,handlePopupTrigger:Se,orgBrandSetting:h,isAuthenticated:e==null?void 0:e.isAuthenticated,isMobileScreen:s}):null,T.jsx("div",{className:Ei("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",s?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:T.jsx("div",{className:Ei("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col",s?"":"ed-rounded-[10px]",r?Ei("ed-opacity-100",s?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&T.jsxs(T.Fragment,{children:[T.jsx(Zle,{searchedText:w,selectedCategory:R,setSearchedText:_,setArticleId:N,setSelectedCategory:k,setIsPopupOpen:i,handleSearch:ye,setArticlesData:U,brandInfo:$e,activeTab:u,userData:e,isMobileScreen:s}),T.jsx("div",{className:Ei("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",u==="knowledge_base"?"ed-pb-5":""),children:w?T.jsx("div",{className:"ed-h-full",children:Ot.size(F)?T.jsx(Cee,{articlesData:F,setArticleId:N,setSearchedText:_,setArticlesData:U}):T.jsx(Dne,{setIsCreateNewTicketClicked:P})}):T.jsx("div",{className:Ei("ed-space-y-4",u==="knowledge_base"?"ed-py-1":""),children:we()})}),T.jsx(Qle,{activeTab:u,handleTabChange:We,orgBrandSetting:h,hasLiveChat:te,isMobileScreen:s}),A&&T.jsx(Rte,{setIsCreateNewTicketClicked:P,setSearchedText:_,searchedText:w,isAuthenticated:e==null?void 0:e.isAuthenticated})]})})})]})},gce=[".ed-scope",".ed-","--ed-",".ed-tiptap"],yce="ed-widget-bundle-style",bce=()=>{var t;return(t=document.body)==null?void 0:t.classList.contains("ed-scope")},OT=t=>(t==null?void 0:t.tagName)==="STYLE"&&t.getAttribute("id")===yce,Sce=t=>{OT(t)&&t.getAttribute("data-ed-parent-style-disabled")!=="true"&&(t.setAttribute("media","not all"),t.setAttribute("data-ed-parent-style-disabled","true"))},Ece=(t,e)=>{if(!t)return!1;if(OT(t))return!0;if(t.tagName==="LINK")return e&&t.rel==="stylesheet"&&!!t.href;if(t.tagName!=="STYLE")return!1;if(e)return!0;const n=t.textContent||"";return gce.some(r=>n.includes(r))},TV=t=>{if(!(t!=null&&t.head))return;const e=bce();t.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!Ece(n,e))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),OT(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),e||Sce(n)),t.head.appendChild(r)})},Cce=({children:t,dimensions:e,position:n,themeColor:r})=>{const i=D.useRef(null),[s,l]=D.useState(null),[u,d]=D.useState(null);return D.useEffect(()=>{var w;const h=i.current;if(!h)return()=>{};const m=h.contentDocument||((w=h.contentWindow)==null?void 0:w.document);if(!m)return()=>{};const g=m.createElement("meta");g.name="viewport",g.content=`width=${window.innerWidth}, initial-scale=1.0`,m.head.appendChild(g);const y=()=>{const _=m.querySelector('meta[name="viewport"]');_&&(_.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",y);const b=m.createElement("style");b.textContent=`
1828
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function MS(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){MS(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){MS(r,e)}),t.definitions&&t.definitions.forEach(function(r){MS(r,e)})}var kT={};(function(){RT.definitions.forEach(function(e){if(e.name){var n=new Set;MS(e,n),kT[e.name.value]=n}})})();function wV(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function pce(t,e){var n={kind:t.kind,definitions:[wV(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=kT[e]||new Set,i=new Set,s=new Set;for(r.forEach(function(u){s.add(u)});s.size>0;){var l=s;s=new Set,l.forEach(function(u){if(!i.has(u)){i.add(u);var d=kT[u]||new Set;d.forEach(function(h){s.add(h)})}})}return i.forEach(function(u){var d=wV(t,u);d&&n.definitions.push(d)}),n}const mce=pce(RT,"GET_ARTICLES"),vce=t=>{const{userData:e,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:s,setThemeColor:l}=t||{},{activeTab:u,setActiveTab:d,orgBrandSetting:h,setOrgBrandSetting:m,setCurrentConversationID:g,messageListUnreadCount:y}=mu(),{unreadMessages:b}=Jh(),C=y||Ot.size(b),[w,_]=D.useState(""),[R,k]=D.useState(null),[L,N]=D.useState(null),[A,P]=D.useState(!1),[F,U]=D.useState([]),[$,K]=D.useState(!1),[te,X]=D.useState(!1),[ne,Y]=D.useState(!1),[H,G]=D.useState(!1),Z=new URLSearchParams(window.location.search).get("intent");D.useEffect(()=>{const Me=Z||n;Me?Me==="chat"?(Y(!0),G(!1),d("messages"),i(!0)):Me==="kb"&&(G(!0),Y(!1),d("knowledge_base"),i(!0)):(Y(!1),G(!1),i(!1))},[n,Z]);const[J,{loading:le}]=Ph(mce,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:re,data:ie}=Ih(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),ce=async Me=>{var Ue;const{data:fe,error:Ze}=await J(Me);fe!=null&&fe.getArticles&&U(((Ue=fe==null?void 0:fe.getArticles)==null?void 0:Ue.data)||[]),Ze&&console.error(Ze)};D.useEffect(()=>{var Me;ie!=null&&ie.getChannelsForPortal&&X(Ot.size((Me=ie==null?void 0:ie.getChannelsForPortal)==null?void 0:Me.data)>0)},[ie]);const ge=AM(Me=>{ce({variables:{queryData:{search_keyword:Me}}})},500),ye=Me=>{_(Me),ge(Me)},Re=async()=>{K(!0);try{const Me=await aJ();if(Me){const{font:fe,is_knowledge_base_enabled:Ze,theme_color:Ue}=Me;m(Me),l(Ue),gJ(fe),C>0&&te?d("messages"):Ze&&!te||Ze&&te?d("knowledge_base"):!Ze&&te&&d("messages"),K(!1)}}catch(Me){console.error(Me),K(!1)}},Se=()=>{const Me=document.getElementById("ed-widget");i(!r),r&&(e!=null&&e.isAuthenticated)&&g(null),_(""),k(null),N(null),P(!1),Re(),n&&Me&&Me.removeAttribute("ed-widget-intent"),Y(!1),G(!1)};D.useEffect(()=>{Re()},[]),D.useEffect(()=>{if(!h)return;const{is_knowledge_base_enabled:Me}=h;te&&ne?(d("messages"),i(!0)):Me&&H&&(d("knowledge_base"),i(!0))},[h,te,ne]);const we=()=>u==="knowledge_base"?T.jsx(Mne,{loading:le,articleId:L,isAuthenticated:e==null?void 0:e.isAuthenticated,selectedCategory:R,setArticleId:N,setSelectedCategory:k,orgBrandSetting:h,isMobileScreen:s}):u==="messages"?T.jsx(hce,{orgBrandSetting:h,setIsPopupOpen:i,userData:e}):null,{brand:$e,is_knowledge_base_enabled:Ge}=h||{},We=Me=>{d(Me),_(""),k(null),N(null),P(!1)};return!Ge&&!te?null:T.jsxs("div",{children:[te||Ge?T.jsx(Kle,{isPopupOpen:r,handlePopupTrigger:Se,orgBrandSetting:h,isAuthenticated:e==null?void 0:e.isAuthenticated,isMobileScreen:s}):null,T.jsx("div",{className:Ei("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",s?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:T.jsx("div",{className:Ei("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col ed-relative",s?"":"ed-rounded-[10px]",r?Ei("ed-opacity-100",s?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&T.jsxs(T.Fragment,{children:[T.jsx(Zle,{searchedText:w,selectedCategory:R,setSearchedText:_,setArticleId:N,setSelectedCategory:k,setIsPopupOpen:i,handleSearch:ye,setArticlesData:U,brandInfo:$e,activeTab:u,userData:e,isMobileScreen:s}),T.jsx("div",{className:Ei("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",u==="knowledge_base"?"ed-pb-5":""),children:w?T.jsx("div",{className:"ed-h-full",children:Ot.size(F)?T.jsx(Cee,{articlesData:F,setArticleId:N,setSearchedText:_,setArticlesData:U}):T.jsx(Dne,{setIsCreateNewTicketClicked:P})}):T.jsx("div",{className:Ei("ed-space-y-4",u==="knowledge_base"?"ed-py-1":""),children:we()})}),T.jsx(Qle,{activeTab:u,handleTabChange:We,orgBrandSetting:h,hasLiveChat:te,isMobileScreen:s}),A&&T.jsx(Rte,{setIsCreateNewTicketClicked:P,setSearchedText:_,searchedText:w,isAuthenticated:e==null?void 0:e.isAuthenticated})]})})})]})},gce=[".ed-scope",".ed-","--ed-",".ed-tiptap"],yce="ed-widget-bundle-style",bce=()=>{var t;return(t=document.body)==null?void 0:t.classList.contains("ed-scope")},OT=t=>(t==null?void 0:t.tagName)==="STYLE"&&t.getAttribute("id")===yce,Sce=t=>{OT(t)&&t.getAttribute("data-ed-parent-style-disabled")!=="true"&&(t.setAttribute("media","not all"),t.setAttribute("data-ed-parent-style-disabled","true"))},Ece=(t,e)=>{if(!t)return!1;if(OT(t))return!0;if(t.tagName==="LINK")return e&&t.rel==="stylesheet"&&!!t.href;if(t.tagName!=="STYLE")return!1;if(e)return!0;const n=t.textContent||"";return gce.some(r=>n.includes(r))},TV=t=>{if(!(t!=null&&t.head))return;const e=bce();t.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!Ece(n,e))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),OT(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),e||Sce(n)),t.head.appendChild(r)})},Cce=({children:t,dimensions:e,position:n,themeColor:r})=>{const i=D.useRef(null),[s,l]=D.useState(null),[u,d]=D.useState(null);return D.useEffect(()=>{var w;const h=i.current;if(!h)return()=>{};const m=h.contentDocument||((w=h.contentWindow)==null?void 0:w.document);if(!m)return()=>{};const g=m.createElement("meta");g.name="viewport",g.content=`width=${window.innerWidth}, initial-scale=1.0`,m.head.appendChild(g);const y=()=>{const _=m.querySelector('meta[name="viewport"]');_&&(_.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",y);const b=m.createElement("style");b.textContent=`
1829
1829
  html, body {
1830
1830
  margin: 0;
1831
1831
  padding: 0;
package/npm/ed-widget.js CHANGED
@@ -1616,7 +1616,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1616
1616
  <p className="ed-text-border-regular ed-whitespace-pre-line">${t}</p>
1617
1617
  </div>
1618
1618
  ${r}
1619
- </div>`},Wx={ANGRY:E.jsx(eD,{}),SAD:E.jsx(rD,{}),NEUTRAL:E.jsx(tD,{}),HAPPY:E.jsx(nD,{}),LOVE:E.jsx(iD,{})},_Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI8AAACHCAYAAAAvMAr+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAH2dJREFUeAHtnQt4VNW1x9c+80hIAgxvKBAmAopeLcH2VkQoE24tSr8WaCvWd6K2X28fEm7t59W2l3C1D+/1E9Deeu+1lWAVK2iF3lbRajPyKlYhsaJFA80koCDPCXln5px919ozZzKTzJk558yZV8jv+843J2f2OZnk/Gettfdaex8GQ5jj100e4NJSAF4OHMrxiCv8jg8YbsA3ggxeqCrzwSCFwRDGEKJhq1EwHl3tGasFWVkzGEWUMfHwZZUupStQyYAvxF9L31R31NsNHDeJsY1s+1NeyFU2Nq/Gv6QGjOMDiVfBLWVeGERkRDx88c0rURw1uOfS0dynML7Gvn1TLe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vD7KVYJT8Yn8agLO9EUHEdYUEJYwaj9WJGVjP406OH4qZOhYLkwj2aH2s4jt5UStAJqp4H6FxTRoc5umFmM+aO6v4eOuTA5OX4GbjNRfFHPUO84DY37/iR282qCn9FVMayCc13VhtkVD+N+M49UamyT4dA5BUocBVASOA31LFwDdAbztX/Hrbg+JB7aAmjFOs7Ai28eEE0K5U4Y3+ODQiWUJ8vFqTf02SQebHB7PC6jq7ITmNBsZik8qkrSGahnVzwK+OOuMFJyHGDCu6HKQipNjZppsfmACx5piP7Y7bh9DHqZ1P0+5AnlgVCich0YRALu5cDMJq59bPtTXj0NM/OMUaP0hFdEpfUJi05jUvMIphveF1tj7xk4X+A63Ud/WKiMwlS8xEM1PbrITfGQldFYBZ6KxCaNsKjIKrfZuGfPnlowCWPycjAkIOZH4ayyvfy0bkunuSwVPaHF4XCUK4ripp/NfgsScflYp/vy0Y7Y4qWCNhyRR+EU4WhwQXvc85pOF0Nd41gYxPjx/74t+oAkST71XugFz3EvsQ9fOp7ZNO9dDyiuApD82+Vzrx9X+lYOw9/l638tdd9ut6+jWOz/AXtcu0k24b8pAAAAAElFTkSuQmCC",xY=({surveyData:e,onClose:t,onSubmit:n,isSubmitting:r=!1})=>{var H;const[i,o]=O.useState(!1),[a,s]=O.useState(null),[c,u]=O.useState(null),[d,h]=O.useState(""),p=(e==null?void 0:e.title)||"How was your support experience?",m=(e==null?void 0:e.description)||"",y=(e==null?void 0:e.is_description_enabled)||!1,b=(e==null?void 0:e.active_rating_type)||"numeric",v=(e==null?void 0:e.is_optional_question_enabled)||!1,S=(e==null?void 0:e.is_open_ended_question_enabled)||!1,w=(e==null?void 0:e.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",A=(e==null?void 0:e.optional_question_options)||[],_=(e==null?void 0:e.open_ended_question_title)||"Share your thoughts on the support you received",C=((H=e==null?void 0:e.rating_types)==null?void 0:H.filter(z=>z.rating_type===b).sort((z,K)=>K.score-z.score))||[],k=z=>{s(z)},T=z=>{u(K=>K===z?null:z)},R=async()=>{if(!a||!n)return;const z={satisfaction_rating_type_id:a.id,optional_question_responses:c?[typeof c=="string"?c:c.label]:null,open_ended_question_response:(d==null?void 0:d.trim())||null};try{if(await n(z)===!1){Xt("error","We could not submit your feedback. Please try again.","top-left");return}o(!0)}catch{Xt("error","We could not submit your feedback. Please try again.","top-left")}},F=()=>{t&&t()},D=()=>b==="numeric"?E.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsxs("button",{type:"button",onClick:()=>k(z),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[E.jsx("div",{className:fn("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",K?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:z.numeric_value}),E.jsx("span",{className:fn("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",K?"ed-text-brand":"ed-text-border-dark"),children:z.label})]},z.id)})}):b==="emoji"?E.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsxs("button",{type:"button",onClick:()=>k(z),className:fn("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[E.jsx("div",{className:fn("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",K?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:Wx[z.emoji]&&Wx[z.emoji]}),E.jsx("span",{className:fn("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",K?"ed-text-brand":"ed-text-border-dark"),children:z.label})]},z.id)})}):b==="custom_text"?E.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsx("button",{type:"button",onClick:()=>k(z),className:fn("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",K?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:z.label},z.id)})}):null;return i?E.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[E.jsx("button",{type:"button",onClick:F,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:E.jsx(ci,{size:20})}),E.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),E.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:E.jsx(Tr,{src:_Y,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):E.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[E.jsx("button",{type:"button",onClick:F,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:E.jsx(ci,{size:20})}),E.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[E.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:p}),y&&m&&E.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:m}),E.jsx("div",{className:"ed-py-2",children:D()}),a&&a.score<=2&&v&&E.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[E.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:w}),E.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:A.map((z,K)=>E.jsx("button",{type:"button",onClick:()=>T(z),className:fn("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",c===z?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof z=="string"?z:z==null?void 0:z.label},`optional-option-${z.label+K}`))})]}),a&&S&&(!(a.score<=2&&v)||c)&&E.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[E.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:_}),E.jsx("textarea",{placeholder:"Write here",value:d,onChange:z=>h(z.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),a&&E.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:E.jsx(La,{title:"Submit",callBack:R,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},AY=({orgBrandSetting:e={},userData:t={},currentConversationID:n,setCurrentConversationID:r})=>{var Te,xe,je,ze,Re;const{conversationData:i,initialStatesData:o,conversationState:a,inputFieldState:s,setInputFieldState:c,isAIThinking:u,setIsAIThinking:d,handleUpdateConversationActivityAnalytics:h,send:p}=js(),{sendMessage:m}=Pm(),{satisfaction_setting:y}=e||{},b=y==null?void 0:y.satisfaction_survey,[v,S]=O.useState(!0),w=O.useRef(null),A=O.useRef(null),_=O.useRef(!1),C=Hr.get("easydesk_chat_widget_conversation_id"),{brand:k}=e,[T,R]=O.useState(null),[F,D]=O.useState(!1),[H,z]=O.useState([]),K=n||C,[V]=Es(Xc,{errorPolicy:"all",fetchPolicy:"no-cache"}),[L,{loading:j}]=bo(SY,{errorPolicy:"all",fetchPolicy:"no-cache"}),Y=async de=>{var be,Ne;try{const Qe=wY({title:de==null?void 0:de.title,message:de==null?void 0:de.message,files:de.conversation_activity_files}),we=await m({is_customer_reply:!0,message:Qe,conversation_id:K});if(we!=null&&we.id){c(gt=>({...gt,ticket_title:de==null?void 0:de.ticket_title,ticket_activity:de==null?void 0:de.ticket_activity,conversation_activity_files:de==null?void 0:de.conversation_activity_files}));const qe=eh(Ft.ticket.success,{ticket_id:(de==null?void 0:de.ticketId)||"N/A",customer_email:((be=i==null?void 0:i.contact)==null?void 0:be.person_email)||(s==null?void 0:s.contact_person_email)||"your email"});await m({is_auto_response:!0,message:qe,conversation_status:"closed",current_stage:"closed"},!0),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Qe){const{message:we,response:qe}=Qe;Xt("error",((Ne=qe==null?void 0:qe.data)==null?void 0:Ne.message)||we,"top-left")}},B=async()=>{try{await m({conversation_id:K,message:Ft.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(de){console.error("Error creating follow-up message:",de)}},J=async()=>{var de;try{const{data:be}=await V({variables:{queryData:{is_live_chat_enabled:!0}}}),Ne=De.size((de=be==null?void 0:be.getChannelsForPortal)==null?void 0:de.data)>0&&!(e!=null&&e.is_off_hour);D(Ne),await m({conversation_id:K,message:Ft.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(be){console.error("Error handling initial no click:",be)}},W=async()=>{var de;try{const{data:be}=await V({variables:{queryData:{is_live_chat_enabled:!0}}}),Ne=De.size((de=be==null?void 0:be.getChannelsForPortal)==null?void 0:de.data)>0&&!(e!=null&&e.is_off_hour);D(Ne),await m({conversation_id:K,message:Ft.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(be){console.error("Error handling intermediate yes click:",be)}},G=async()=>{var de;try{const be=((de=i==null?void 0:i.contact)==null?void 0:de.person_name)||"there",Ne=eh(Ft.ai.goodbye,{name:be});await m({conversation_id:K,message:Ne,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"resolved"}),R("CONVERSATION_ENDED")}catch(be){console.error("Error handling intermediate no click:",be)}},$=async()=>{try{await m({conversation_id:K,message:Ft.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(de){console.error("Error restarting conversation:",de)}},ie=async()=>{var de;try{const be=((de=i==null?void 0:i.contact)==null?void 0:de.person_name)||"there",Ne=eh(Ft.ai.goodbye,{name:be});await m({conversation_id:K,message:Ne,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"resolved"}),R("CONVERSATION_ENDED")}catch(be){console.error("Error handling follow-up no click:",be)}},ae=async de=>{try{await m({conversation_id:K,message:de.message,is_customer_reply:de.is_customer_reply,channel_id:de.channel_id,current_stage:"agent_chat"}),z([]),await m({conversation_id:K,message:Ft.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(be){console.error("Error selecting channel:",be)}},ce=async de=>{var be;try{const Ne={conversation_id:K,satisfaction_rating_type_id:de.satisfaction_rating_type_id,optional_question_responses:de.optional_question_responses||null,open_ended_question_response:de.open_ended_question_response||null},{data:Qe}=await L({variables:{inputData:Ne}});return!!((be=Qe==null?void 0:Qe.createASatisfactionRating)!=null&&be.id)}catch(Ne){return console.error("Error submitting survey:",Ne),Xt("error","Failed to submit feedback. Please try again.","top-left"),!1}},oe=()=>{p({type:ut.RELOAD_CONVERSATION_DATA}),S(!1)},ue=()=>{p({type:ut.CONVERSATION_CLOSED}),c(o.inputFieldState),R(!1),Hr.remove("easydesk_chat_widget_conversation_id")},ye=((Te=a==null?void 0:a.metaData)==null?void 0:Te.filtered_rows)&&De.size(a==null?void 0:a.messages)<((xe=a==null?void 0:a.metaData)==null?void 0:xe.filtered_rows),{loadMoreMessages:Ce}=Pm(),Se=Ce;O.useEffect(()=>{if(!A.current||_.current)return;const be=setTimeout(()=>{const Ne=A.current;Ne&&requestAnimationFrame(()=>{Ne.scrollTop=Ne.scrollHeight})},100);return()=>clearTimeout(be)},[De.size(a==null?void 0:a.messages)]),O.useEffect(()=>{if(K&&A.current){const de=setTimeout(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},300);return()=>clearTimeout(de)}},[K]),O.useEffect(()=>{K&&(w.current=null)},[K]);const he=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),q=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!y||!b||!y.is_satisfaction_rating_enabled)return!1;const de=i==null?void 0:i.type;return!(de==="ticket"&&!y.is_ticket_feedback_active||de==="chat"&&!y.is_chat_feedback_active)})(),ke=()=>{var be;if(!(a!=null&&a.messages)||De.size(a.messages)===0)return!1;const de=a.messages[a.messages.length-1];return((be=de==null?void 0:de.metadata)==null?void 0:be.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},ve=()=>{if(u)return!0;if(!(a!=null&&a.messages)||De.size(a.messages)===0)return!1;const de=a.messages[a.messages.length-1],be=de==null?void 0:de.metadata;return!be||de!=null&&de.is_customer_reply?!1:!!(be.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(be.current_stage)||be.has_results===!0||be.has_results===!1)};return O.useEffect(()=>{let de=[];const be=De.debounce(async()=>{await h({seen_activity_ids:de}),de=[]},1e3),Ne=new IntersectionObserver(we=>{we.forEach(qe=>{if(qe.isIntersecting){const gt=qe.target.getAttribute("data-message-id");gt&&de.push(gt)}}),De.size(de)&&be()},{threshold:1}),Qe=document.querySelectorAll(".ed-message");return Qe.forEach(we=>Ne.observe(we)),()=>{be.cancel(),Qe.forEach(we=>Ne.unobserve(we))}},[a==null?void 0:a.messages]),E.jsxs("div",{children:[E.jsx("div",{ref:A,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:E.jsx(Qg,{dataLength:De.size(a==null?void 0:a.messages),hasMore:ye,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{_.current=!0,Se(),setTimeout(()=>{_.current=!1},500)},children:E.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[De.size(a==null?void 0:a.messages)?E.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&E.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[E.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),E.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(je=a==null?void 0:a.messages)==null?void 0:je.map(de=>E.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(de==null?void 0:de.type)?E.jsx(Vx,{activityMessage:de,brand:k,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},de==null?void 0:de.id):E.jsx(gG,{log:de==null?void 0:de.log},de==null?void 0:de.id)},de==null?void 0:de.id))]}):E.jsx(EG,{onSubmit:de=>{c(be=>({...be,contact_person_name:de==null?void 0:de.contact_person_name,contact_person_email:de==null?void 0:de.contact_person_email}))},orgBrandSetting:e,setSelectedConversationId:r,userData:t}),!u&&(a==null?void 0:a.messages)&&De.size(a.messages)>0&&(()=>{const de=a.messages[a.messages.length-1],{metadata:be}=de||{};if(be&&!(de!=null&&de.is_customer_reply)){const{current_stage:Ne}=be;if(!Ne&&be.has_results===!0)return E.jsx(oh,{type:"initial",sendMessage:m,conversationId:K,onYes:B,onNo:J});if(Ne==="initial_feedback")return E.jsx(oh,{type:"initial",sendMessage:m,conversationId:K,onYes:B,onNo:J});if(Ne==="followup_feedback")return E.jsx(oh,{type:"followup",sendMessage:m,conversationId:K,onYes:$,onNo:ie});if(Ne==="intermediate_help")return E.jsx(oh,{type:"intermediate",sendMessage:m,conversationId:K,onYes:W,onNo:G});if(Ne==="need_help")return E.jsx(zx,{type:"need_help",sendMessage:m,conversationId:K,showChatButton:F,setIsAIThinking:d,onChannelSelection:ae});if(!be.has_results&&!Ne&&!(i!=null&&i.assignee))return E.jsx(zx,{type:"no_results",sendMessage:m,conversationId:K,setIsAIThinking:d,onChannelSelection:ae});if(Ne==="select_channel")return E.jsx(bY,{channels:H,onSubmit:ae});if(Ne==="create_a_support_ticket")return E.jsx(cw,{from:"message",isAuthenticated:!0,onSubmit:Y,reqId:null,userData:s,metadata:be})}return null})(),(((ze=a==null?void 0:a.writing_realtime_status)==null?void 0:ze.is_writing_reply)||u)&&E.jsx("div",{className:"single-message ed-px-5",children:E.jsx(Vx,{brand:k,activityMessage:{user:(Re=a==null?void 0:a.writing_realtime_status)==null?void 0:Re.author,is_customer_reply:!1,is_ai_response:u,created_at:Date.now()},isReplying:!0})})]})})}),q&&v&&E.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:E.jsx(xY,{surveyData:b,onSubmit:ce,isSubmitting:j,onClose:oe})}),((i==null?void 0:i.type)==="ticket"||!he&&De.size(a==null?void 0:a.messages)>=3&&!T&&!ve()&&T!=="CONVERSATION_ENDED")&&E.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:E.jsx(yY,{conversationData:i,conversationId:K,handleCreateMessage:m,onAIThinkingChange:d,isAIThinking:u,useAITemplate:!ke()})}),(i==null?void 0:i.type)!=="ticket"&&(T&&T!=="CONVERSATION_ENDED"||he)&&E.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:E.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",E.jsx("br",{}),"To start a new chat, ",E.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:ue,children:"click here"})]})})]})},kY=({item:e,onSelect:t,userData:n})=>{const{id:r,type:i,status:o,last_conversation_activity:a,organization_brand:s,assignee:c}=e||{},{handleUpdateConversationActivityAnalytics:u}=So(),{message:d,user:h,created_at:p,analytics:m}=a||{},{status:y}=(m==null?void 0:m[0])||{},{setting:b,name:v}=s||{},{first_name:S,last_name:w,email:A,avatar_file:_}=(c==null?void 0:c.user)||{},C=O.useMemo(()=>nd(S,w,A)||v||"Unknown User",[S,w,A,v]),k=_||(b==null?void 0:b.icon),T=(n==null?void 0:n.id)===(h==null?void 0:h.id),R=K=>T?"ed-text-border-dark":K?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",F=async()=>{y!=="seen"&&await u({seen_activity_ids:[a==null?void 0:a.id]}),t(r)},D=O.useMemo(()=>cY[o],[o]),H=T&&y==="seen",z=O.useMemo(()=>uY(d),[d]);return E.jsxs("div",{role:"button",tabIndex:0,onClick:F,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[E.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:E.jsx(Tr,{alt:C,path:k==null?void 0:k.key,defaultImageName:qi(A||v),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),E.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[E.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[E.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${R(H)}`,children:d?z:"[Attachment]"}),E.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[E.jsx(qf,{content:E.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?E.jsx(cC,{}):E.jsx(lC,{})}),E.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),E.jsx("p",{className:`ed-text-12 ${R(H)}`,children:_1(C,20)}),E.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),E.jsx("p",{className:"ed-text-12 ed-text-brand",children:lY(p)})]})]}),E.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(e==null?void 0:e.unread_count)>0?E.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:e.unread_count}):!T&&y!=="seen"&&E.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),E.jsx("span",{className:"ed-custom-children",children:E.jsx(Co,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(o)&&E.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${D==null?void 0:D.className}`,children:D==null?void 0:D.label})]})]})},TY="easydesk_chat_widget_conversation_id",OY=({setCurrentConversationID:e,userData:t})=>{const n=O.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:o,loadingStates:a,setOptionData:s,optionData:c}=So(),{send:u,initialStatesData:d,setConversationState:h}=js(),p=async()=>{u({type:ut.CONVERSATION_CLOSED}),Hr.remove(TY),e(null),h(d.conversationState),r(!1)},m=b=>{b&&(e(b),r(!1))};O.useEffect(()=>{const b=setTimeout(()=>{var w;const v=(w=n.current)==null?void 0:w.querySelectorAll(".single-message-container"),S=v==null?void 0:v[De.size(v)-1];S==null||S.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(b)},[De.size(i)]);const y=(o==null?void 0:o.total_rows)>De.size(i);return E.jsxs("div",{children:[E.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:E.jsx(Qg,{dataLength:De.size(i),hasMore:y,loader:a!=null&&a.fetchMoreLoading?E.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:E.jsx(Zs,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{s({...c,offset:c.offset+c.limit})},children:i==null?void 0:i.map(b=>E.jsx(kY,{item:b,onSelect:m,userData:t},b.id))})}),E.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:E.jsxs("button",{onClick:p,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[E.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),E.jsx(Co,{size:16})]})})]})},NY=()=>{const{setIsChatHistory:e}=So();return E.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:E.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[E.jsx($j,{}),E.jsxs("button",{onClick:()=>e(t=>!t),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[E.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",E.jsx(Co,{})]})]})})},RY=({orgBrandSetting:e,setIsPopupOpen:t,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:o,isChatHistory:a,setIsChatHistory:s,setCurrentConversationID:c,currentConversationID:u}=So(),d=O.useMemo(()=>a?De.size(r)?E.jsx(OY,{data:r,userData:n,setCurrentConversationID:c}):E.jsx(NY,{}):E.jsx(AY,{orgBrandSetting:e,setIsPopupOpen:t,userData:n,currentConversationID:u,setCurrentConversationID:c,refreshConversations:o}),[r,n,u,a,e,s,t]);return i!=null&&i.initialLoading?E.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:E.jsx(Zs,{})}):E.jsx("div",{children:d})};var Oy={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};Oy.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1619
+ </div>`},Wx={ANGRY:E.jsx(eD,{}),SAD:E.jsx(rD,{}),NEUTRAL:E.jsx(tD,{}),HAPPY:E.jsx(nD,{}),LOVE:E.jsx(iD,{})},_Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI8AAACHCAYAAAAvMAr+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAH2dJREFUeAHtnQt4VNW1x9c+80hIAgxvKBAmAopeLcH2VkQoE24tSr8WaCvWd6K2X28fEm7t59W2l3C1D+/1E9Deeu+1lWAVK2iF3lbRajPyKlYhsaJFA80koCDPCXln5px919ozZzKTzJk558yZV8jv+843J2f2OZnk/Gettfdaex8GQ5jj100e4NJSAF4OHMrxiCv8jg8YbsA3gg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W8K3nM4WCYsTU8INxYaF6jlm0XNTznKc2l4FY20TP4/1j0dlpTqS/IfahkKlq0kbbktdGX0raGtVj0mBMVwbIiL6bhu6ClBYdnKwdlpesJfu3SZ7rbktvIqWOb60gTZIqOJ0bCgIvD7KVYJT8Yn8agLO9EUHEdYUEJYwaj9WJGVjP406OH4qZOhYLkwj2aH2s4jt5UStAJqp4H6FxTRoc5umFmM+aO6v4eOuTA5OX4GbjNRfFHPUO84DY37/iR282qCn9FVMayCc13VhtkVD+N+M49UamyT4dA5BUocBVASOA31LFwDdAbztX/Hrbg+JB7aAmjFOs7Ai28eEE0K5U4Y3+ODQiWUJ8vFqTf02SQebHB7PC6jq7ITmNBsZik8qkrSGahnVzwK+OOuMFJyHGDCu6HKQipNjZppsfmACx5piP7Y7bh9DHqZ1P0+5AnlgVCich0YRALu5cDMJq59bPtTXj0NM/OMUaP0hFdEpfUJi05jUvMIphveF1tj7xk4X+A63Ud/WKiMwlS8xEM1PbrITfGQldFYBZ6KxCaNsKjIKrfZuGfPnlowCWPycjAkIOZH4ayyvfy0bkunuSwVPaHF4XCUK4ripp/NfgsScflYp/vy0Y7Y4qWCNhyRR+EU4WhwQXvc85pOF0Nd41gYxPjx/74t+oAkST71XugFz3EvsQ9fOp7ZNO9dDyiuApD82+Vzrx9X+lYOw9/l638tdd9ut6+jWOz/AXtcu0k24b8pAAAAAElFTkSuQmCC",xY=({surveyData:e,onClose:t,onSubmit:n,isSubmitting:r=!1})=>{var H;const[i,o]=O.useState(!1),[a,s]=O.useState(null),[c,u]=O.useState(null),[d,h]=O.useState(""),p=(e==null?void 0:e.title)||"How was your support experience?",m=(e==null?void 0:e.description)||"",y=(e==null?void 0:e.is_description_enabled)||!1,b=(e==null?void 0:e.active_rating_type)||"numeric",v=(e==null?void 0:e.is_optional_question_enabled)||!1,S=(e==null?void 0:e.is_open_ended_question_enabled)||!1,w=(e==null?void 0:e.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",A=(e==null?void 0:e.optional_question_options)||[],_=(e==null?void 0:e.open_ended_question_title)||"Share your thoughts on the support you received",C=((H=e==null?void 0:e.rating_types)==null?void 0:H.filter(z=>z.rating_type===b).sort((z,K)=>K.score-z.score))||[],k=z=>{s(z)},T=z=>{u(K=>K===z?null:z)},R=async()=>{if(!a||!n)return;const z={satisfaction_rating_type_id:a.id,optional_question_responses:c?[typeof c=="string"?c:c.label]:null,open_ended_question_response:(d==null?void 0:d.trim())||null};try{if(await n(z)===!1){Xt("error","We could not submit your feedback. Please try again.","top-left");return}o(!0)}catch{Xt("error","We could not submit your feedback. Please try again.","top-left")}},F=()=>{t&&t()},D=()=>b==="numeric"?E.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsxs("button",{type:"button",onClick:()=>k(z),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[E.jsx("div",{className:fn("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",K?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:z.numeric_value}),E.jsx("span",{className:fn("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",K?"ed-text-brand":"ed-text-border-dark"),children:z.label})]},z.id)})}):b==="emoji"?E.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsxs("button",{type:"button",onClick:()=>k(z),className:fn("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[E.jsx("div",{className:fn("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",K?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:Wx[z.emoji]&&Wx[z.emoji]}),E.jsx("span",{className:fn("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",K?"ed-text-brand":"ed-text-border-dark"),children:z.label})]},z.id)})}):b==="custom_text"?E.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:C.map(z=>{const K=(a==null?void 0:a.id)===z.id;return E.jsx("button",{type:"button",onClick:()=>k(z),className:fn("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",K?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:z.label},z.id)})}):null;return i?E.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[E.jsx("button",{type:"button",onClick:F,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:E.jsx(ci,{size:20})}),E.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),E.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:E.jsx(Tr,{src:_Y,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):E.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[E.jsx("button",{type:"button",onClick:F,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:E.jsx(ci,{size:20})}),E.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[E.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:p}),y&&m&&E.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:m}),E.jsx("div",{className:"ed-py-2",children:D()}),a&&a.score<=2&&v&&E.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[E.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:w}),E.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:A.map((z,K)=>E.jsx("button",{type:"button",onClick:()=>T(z),className:fn("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",c===z?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof z=="string"?z:z==null?void 0:z.label},`optional-option-${z.label+K}`))})]}),a&&S&&(!(a.score<=2&&v)||c)&&E.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[E.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:_}),E.jsx("textarea",{placeholder:"Write here",value:d,onChange:z=>h(z.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),a&&E.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:E.jsx(La,{title:"Submit",callBack:R,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},AY=({orgBrandSetting:e={},userData:t={},currentConversationID:n,setCurrentConversationID:r})=>{var Te,xe,je,ze,Re;const{conversationData:i,initialStatesData:o,conversationState:a,inputFieldState:s,setInputFieldState:c,isAIThinking:u,setIsAIThinking:d,handleUpdateConversationActivityAnalytics:h,send:p}=js(),{sendMessage:m}=Pm(),{satisfaction_setting:y}=e||{},b=y==null?void 0:y.satisfaction_survey,[v,S]=O.useState(!0),w=O.useRef(null),A=O.useRef(null),_=O.useRef(!1),C=Hr.get("easydesk_chat_widget_conversation_id"),{brand:k}=e,[T,R]=O.useState(null),[F,D]=O.useState(!1),[H,z]=O.useState([]),K=n||C,[V]=Es(Xc,{errorPolicy:"all",fetchPolicy:"no-cache"}),[L,{loading:j}]=bo(SY,{errorPolicy:"all",fetchPolicy:"no-cache"}),Y=async de=>{var be,Ne;try{const Qe=wY({title:de==null?void 0:de.title,message:de==null?void 0:de.message,files:de.conversation_activity_files}),we=await m({is_customer_reply:!0,message:Qe,conversation_id:K});if(we!=null&&we.id){c(gt=>({...gt,ticket_title:de==null?void 0:de.ticket_title,ticket_activity:de==null?void 0:de.ticket_activity,conversation_activity_files:de==null?void 0:de.conversation_activity_files}));const qe=eh(Ft.ticket.success,{ticket_id:(de==null?void 0:de.ticketId)||"N/A",customer_email:((be=i==null?void 0:i.contact)==null?void 0:be.person_email)||(s==null?void 0:s.contact_person_email)||"your email"});await m({is_auto_response:!0,message:qe,conversation_status:"closed",current_stage:"closed"},!0),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Qe){const{message:we,response:qe}=Qe;Xt("error",((Ne=qe==null?void 0:qe.data)==null?void 0:Ne.message)||we,"top-left")}},B=async()=>{try{await m({conversation_id:K,message:Ft.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(de){console.error("Error creating follow-up message:",de)}},J=async()=>{var de;try{const{data:be}=await V({variables:{queryData:{is_live_chat_enabled:!0}}}),Ne=De.size((de=be==null?void 0:be.getChannelsForPortal)==null?void 0:de.data)>0&&!(e!=null&&e.is_off_hour);D(Ne),await m({conversation_id:K,message:Ft.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(be){console.error("Error handling initial no click:",be)}},W=async()=>{var de;try{const{data:be}=await V({variables:{queryData:{is_live_chat_enabled:!0}}}),Ne=De.size((de=be==null?void 0:be.getChannelsForPortal)==null?void 0:de.data)>0&&!(e!=null&&e.is_off_hour);D(Ne),await m({conversation_id:K,message:Ft.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(be){console.error("Error handling intermediate yes click:",be)}},G=async()=>{var de;try{const be=((de=i==null?void 0:i.contact)==null?void 0:de.person_name)||"there",Ne=eh(Ft.ai.goodbye,{name:be});await m({conversation_id:K,message:Ne,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"resolved"}),R("CONVERSATION_ENDED")}catch(be){console.error("Error handling intermediate no click:",be)}},$=async()=>{try{await m({conversation_id:K,message:Ft.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(de){console.error("Error restarting conversation:",de)}},ie=async()=>{var de;try{const be=((de=i==null?void 0:i.contact)==null?void 0:de.person_name)||"there",Ne=eh(Ft.ai.goodbye,{name:be});await m({conversation_id:K,message:Ne,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),p({type:ut.UPDATE_CONVERSATION_STATUS,status:"resolved"}),R("CONVERSATION_ENDED")}catch(be){console.error("Error handling follow-up no click:",be)}},ae=async de=>{try{await m({conversation_id:K,message:de.message,is_customer_reply:de.is_customer_reply,channel_id:de.channel_id,current_stage:"agent_chat"}),z([]),await m({conversation_id:K,message:Ft.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(be){console.error("Error selecting channel:",be)}},ce=async de=>{var be;try{const Ne={conversation_id:K,satisfaction_rating_type_id:de.satisfaction_rating_type_id,optional_question_responses:de.optional_question_responses||null,open_ended_question_response:de.open_ended_question_response||null},{data:Qe}=await L({variables:{inputData:Ne}});return!!((be=Qe==null?void 0:Qe.createASatisfactionRating)!=null&&be.id)}catch(Ne){return console.error("Error submitting survey:",Ne),Xt("error","Failed to submit feedback. Please try again.","top-left"),!1}},oe=()=>{p({type:ut.RELOAD_CONVERSATION_DATA}),S(!1)},ue=()=>{p({type:ut.CONVERSATION_CLOSED}),c(o.inputFieldState),R(!1),Hr.remove("easydesk_chat_widget_conversation_id")},ye=((Te=a==null?void 0:a.metaData)==null?void 0:Te.filtered_rows)&&De.size(a==null?void 0:a.messages)<((xe=a==null?void 0:a.metaData)==null?void 0:xe.filtered_rows),{loadMoreMessages:Ce}=Pm(),Se=Ce;O.useEffect(()=>{if(!A.current||_.current)return;const be=setTimeout(()=>{const Ne=A.current;Ne&&requestAnimationFrame(()=>{Ne.scrollTop=Ne.scrollHeight})},100);return()=>clearTimeout(be)},[De.size(a==null?void 0:a.messages)]),O.useEffect(()=>{if(K&&A.current){const de=setTimeout(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},300);return()=>clearTimeout(de)}},[K]),O.useEffect(()=>{K&&(w.current=null)},[K]);const he=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),q=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!y||!b||!y.is_satisfaction_rating_enabled)return!1;const de=i==null?void 0:i.type;return!(de==="ticket"&&!y.is_ticket_feedback_active||de==="chat"&&!y.is_chat_feedback_active)})(),ke=()=>{var be;if(!(a!=null&&a.messages)||De.size(a.messages)===0)return!1;const de=a.messages[a.messages.length-1];return((be=de==null?void 0:de.metadata)==null?void 0:be.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},ve=()=>{if(u)return!0;if(!(a!=null&&a.messages)||De.size(a.messages)===0)return!1;const de=a.messages[a.messages.length-1],be=de==null?void 0:de.metadata;return!be||de!=null&&de.is_customer_reply?!1:!!(be.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(be.current_stage)||be.has_results===!0||be.has_results===!1)};return O.useEffect(()=>{let de=[];const be=De.debounce(async()=>{await h({seen_activity_ids:de}),de=[]},1e3),Ne=new IntersectionObserver(we=>{we.forEach(qe=>{if(qe.isIntersecting){const gt=qe.target.getAttribute("data-message-id");gt&&de.push(gt)}}),De.size(de)&&be()},{threshold:1}),Qe=document.querySelectorAll(".ed-message");return Qe.forEach(we=>Ne.observe(we)),()=>{be.cancel(),Qe.forEach(we=>Ne.unobserve(we))}},[a==null?void 0:a.messages]),E.jsxs("div",{children:[E.jsx("div",{ref:A,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:E.jsx(Qg,{dataLength:De.size(a==null?void 0:a.messages),hasMore:ye,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{_.current=!0,Se(),setTimeout(()=>{_.current=!1},500)},children:E.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[De.size(a==null?void 0:a.messages)?E.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&E.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[E.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),E.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(je=a==null?void 0:a.messages)==null?void 0:je.map(de=>E.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(de==null?void 0:de.type)?E.jsx(Vx,{activityMessage:de,brand:k,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},de==null?void 0:de.id):E.jsx(gG,{log:de==null?void 0:de.log},de==null?void 0:de.id)},de==null?void 0:de.id))]}):E.jsx(EG,{onSubmit:de=>{c(be=>({...be,contact_person_name:de==null?void 0:de.contact_person_name,contact_person_email:de==null?void 0:de.contact_person_email}))},orgBrandSetting:e,setSelectedConversationId:r,userData:t}),!u&&(a==null?void 0:a.messages)&&De.size(a.messages)>0&&(()=>{const de=a.messages[a.messages.length-1],{metadata:be}=de||{};if(be&&!(de!=null&&de.is_customer_reply)){const{current_stage:Ne}=be;if(!Ne&&be.has_results===!0)return E.jsx(oh,{type:"initial",sendMessage:m,conversationId:K,onYes:B,onNo:J});if(Ne==="initial_feedback")return E.jsx(oh,{type:"initial",sendMessage:m,conversationId:K,onYes:B,onNo:J});if(Ne==="followup_feedback")return E.jsx(oh,{type:"followup",sendMessage:m,conversationId:K,onYes:$,onNo:ie});if(Ne==="intermediate_help")return E.jsx(oh,{type:"intermediate",sendMessage:m,conversationId:K,onYes:W,onNo:G});if(Ne==="need_help")return E.jsx(zx,{type:"need_help",sendMessage:m,conversationId:K,showChatButton:F,setIsAIThinking:d,onChannelSelection:ae});if(!be.has_results&&!Ne&&!(i!=null&&i.assignee))return E.jsx(zx,{type:"no_results",sendMessage:m,conversationId:K,setIsAIThinking:d,onChannelSelection:ae});if(Ne==="select_channel")return E.jsx(bY,{channels:H,onSubmit:ae});if(Ne==="create_a_support_ticket")return E.jsx(cw,{from:"message",isAuthenticated:!0,onSubmit:Y,reqId:null,userData:s,metadata:be})}return null})(),(((ze=a==null?void 0:a.writing_realtime_status)==null?void 0:ze.is_writing_reply)||u)&&E.jsx("div",{className:"single-message ed-px-5",children:E.jsx(Vx,{brand:k,activityMessage:{user:(Re=a==null?void 0:a.writing_realtime_status)==null?void 0:Re.author,is_customer_reply:!1,is_ai_response:u,created_at:Date.now()},isReplying:!0})})]})})}),q&&v&&E.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-w-full ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:E.jsx(xY,{surveyData:b,onSubmit:ce,isSubmitting:j,onClose:oe})}),((i==null?void 0:i.type)==="ticket"||!he&&De.size(a==null?void 0:a.messages)>=3&&!T&&!ve()&&T!=="CONVERSATION_ENDED")&&E.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:E.jsx(yY,{conversationData:i,conversationId:K,handleCreateMessage:m,onAIThinkingChange:d,isAIThinking:u,useAITemplate:!ke()})}),(i==null?void 0:i.type)!=="ticket"&&(T&&T!=="CONVERSATION_ENDED"||he)&&E.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:E.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",E.jsx("br",{}),"To start a new chat, ",E.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:ue,children:"click here"})]})})]})},kY=({item:e,onSelect:t,userData:n})=>{const{id:r,type:i,status:o,last_conversation_activity:a,organization_brand:s,assignee:c}=e||{},{handleUpdateConversationActivityAnalytics:u}=So(),{message:d,user:h,created_at:p,analytics:m}=a||{},{status:y}=(m==null?void 0:m[0])||{},{setting:b,name:v}=s||{},{first_name:S,last_name:w,email:A,avatar_file:_}=(c==null?void 0:c.user)||{},C=O.useMemo(()=>nd(S,w,A)||v||"Unknown User",[S,w,A,v]),k=_||(b==null?void 0:b.icon),T=(n==null?void 0:n.id)===(h==null?void 0:h.id),R=K=>T?"ed-text-border-dark":K?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",F=async()=>{y!=="seen"&&await u({seen_activity_ids:[a==null?void 0:a.id]}),t(r)},D=O.useMemo(()=>cY[o],[o]),H=T&&y==="seen",z=O.useMemo(()=>uY(d),[d]);return E.jsxs("div",{role:"button",tabIndex:0,onClick:F,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[E.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:E.jsx(Tr,{alt:C,path:k==null?void 0:k.key,defaultImageName:qi(A||v),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),E.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[E.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[E.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${R(H)}`,children:d?z:"[Attachment]"}),E.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[E.jsx(qf,{content:E.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?E.jsx(cC,{}):E.jsx(lC,{})}),E.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),E.jsx("p",{className:`ed-text-12 ${R(H)}`,children:_1(C,20)}),E.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),E.jsx("p",{className:"ed-text-12 ed-text-brand",children:lY(p)})]})]}),E.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(e==null?void 0:e.unread_count)>0?E.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:e.unread_count}):!T&&y!=="seen"&&E.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),E.jsx("span",{className:"ed-custom-children",children:E.jsx(Co,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(o)&&E.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${D==null?void 0:D.className}`,children:D==null?void 0:D.label})]})]})},TY="easydesk_chat_widget_conversation_id",OY=({setCurrentConversationID:e,userData:t})=>{const n=O.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:o,loadingStates:a,setOptionData:s,optionData:c}=So(),{send:u,initialStatesData:d,setConversationState:h}=js(),p=async()=>{u({type:ut.CONVERSATION_CLOSED}),Hr.remove(TY),e(null),h(d.conversationState),r(!1)},m=b=>{b&&(e(b),r(!1))};O.useEffect(()=>{const b=setTimeout(()=>{var w;const v=(w=n.current)==null?void 0:w.querySelectorAll(".single-message-container"),S=v==null?void 0:v[De.size(v)-1];S==null||S.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(b)},[De.size(i)]);const y=(o==null?void 0:o.total_rows)>De.size(i);return E.jsxs("div",{children:[E.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:E.jsx(Qg,{dataLength:De.size(i),hasMore:y,loader:a!=null&&a.fetchMoreLoading?E.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:E.jsx(Zs,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{s({...c,offset:c.offset+c.limit})},children:i==null?void 0:i.map(b=>E.jsx(kY,{item:b,onSelect:m,userData:t},b.id))})}),E.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:E.jsxs("button",{onClick:p,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[E.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),E.jsx(Co,{size:16})]})})]})},NY=()=>{const{setIsChatHistory:e}=So();return E.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:E.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[E.jsx($j,{}),E.jsxs("button",{onClick:()=>e(t=>!t),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[E.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",E.jsx(Co,{})]})]})})},RY=({orgBrandSetting:e,setIsPopupOpen:t,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:o,isChatHistory:a,setIsChatHistory:s,setCurrentConversationID:c,currentConversationID:u}=So(),d=O.useMemo(()=>a?De.size(r)?E.jsx(OY,{data:r,userData:n,setCurrentConversationID:c}):E.jsx(NY,{}):E.jsx(AY,{orgBrandSetting:e,setIsPopupOpen:t,userData:n,currentConversationID:u,setCurrentConversationID:c,refreshConversations:o}),[r,n,u,a,e,s,t]);return i!=null&&i.initialLoading?E.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:E.jsx(Zs,{})}):E.jsx("div",{children:d})};var Oy={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};Oy.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1620
1620
  getArticles(queryData: $queryData, optionData: $optionData) {
1621
1621
  data {
1622
1622
  id
@@ -1624,7 +1624,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1624
1624
  }
1625
1625
  }
1626
1626
  }
1627
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function sh(e,t){if(e.kind==="FragmentSpread")t.add(e.name.value);else if(e.kind==="VariableDefinition"){var n=e.type;n.kind==="NamedType"&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(r){sh(r,t)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(r){sh(r,t)}),e.definitions&&e.definitions.forEach(function(r){sh(r,t)})}var Ny={};(function(){Oy.definitions.forEach(function(t){if(t.name){var n=new Set;sh(t,n),Ny[t.name.value]=n}})})();function Gx(e,t){for(var n=0;n<e.definitions.length;n++){var r=e.definitions[n];if(r.name&&r.name.value==t)return r}}function PY(e,t){var n={kind:e.kind,definitions:[Gx(e,t)]};e.hasOwnProperty("loc")&&(n.loc=e.loc);var r=Ny[t]||new Set,i=new Set,o=new Set;for(r.forEach(function(s){o.add(s)});o.size>0;){var a=o;o=new Set,a.forEach(function(s){if(!i.has(s)){i.add(s);var c=Ny[s]||new Set;c.forEach(function(u){o.add(u)})}})}return i.forEach(function(s){var c=Gx(e,s);c&&n.definitions.push(c)}),n}const IY=PY(Oy,"GET_ARTICLES"),MY=e=>{const{userData:t,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:o,setThemeColor:a}=e||{},{activeTab:s,setActiveTab:c,orgBrandSetting:u,setOrgBrandSetting:d,setCurrentConversationID:h,messageListUnreadCount:p}=So(),{unreadMessages:m}=js(),y=p||De.size(m),[b,v]=O.useState(""),[S,w]=O.useState(null),[A,_]=O.useState(null),[C,k]=O.useState(!1),[T,R]=O.useState([]),[F,D]=O.useState(!1),[H,z]=O.useState(!1),[K,V]=O.useState(!1),[L,j]=O.useState(!1),Y=new URLSearchParams(window.location.search).get("intent");O.useEffect(()=>{const he=Y||n;he?he==="chat"?(V(!0),j(!1),c("messages"),i(!0)):he==="kb"&&(j(!0),V(!1),c("knowledge_base"),i(!0)):(V(!1),j(!1),i(!1))},[n,Y]);const[B,{loading:J}]=Es(IY,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:W,data:G}=Ss(Xc,{errorPolicy:"all",fetchPolicy:"no-cache"}),$=async he=>{var ve;const{data:q,error:ke}=await B(he);q!=null&&q.getArticles&&R(((ve=q==null?void 0:q.getArticles)==null?void 0:ve.data)||[]),ke&&console.error(ke)};O.useEffect(()=>{var he;G!=null&&G.getChannelsForPortal&&z(De.size((he=G==null?void 0:G.getChannelsForPortal)==null?void 0:he.data)>0)},[G]);const ie=Z8(he=>{$({variables:{queryData:{search_keyword:he}}})},500),ae=he=>{v(he),ie(he)},ce=async()=>{D(!0);try{const he=await wM();if(he){const{font:q,is_knowledge_base_enabled:ke,theme_color:ve}=he;d(he),a(ve),LM(q),y>0&&H?c("messages"):ke&&!H||ke&&H?c("knowledge_base"):!ke&&H&&c("messages"),D(!1)}}catch(he){console.error(he),D(!1)}},oe=()=>{const he=document.getElementById("ed-widget");i(!r),r&&(t!=null&&t.isAuthenticated)&&h(null),v(""),w(null),_(null),k(!1),ce(),n&&he&&he.removeAttribute("ed-widget-intent"),V(!1),j(!1)};O.useEffect(()=>{ce()},[]),O.useEffect(()=>{if(!u)return;const{is_knowledge_base_enabled:he}=u;H&&K?(c("messages"),i(!0)):he&&L&&(c("knowledge_base"),i(!0))},[u,H,K]);const ue=()=>s==="knowledge_base"?E.jsx(JD,{loading:J,articleId:A,isAuthenticated:t==null?void 0:t.isAuthenticated,selectedCategory:S,setArticleId:_,setSelectedCategory:w,orgBrandSetting:u,isMobileScreen:o}):s==="messages"?E.jsx(RY,{orgBrandSetting:u,setIsPopupOpen:i,userData:t}):null,{brand:ye,is_knowledge_base_enabled:Ce}=u||{},Se=he=>{c(he),v(""),w(null),_(null),k(!1)};return!Ce&&!H?null:E.jsxs("div",{children:[H||Ce?E.jsx(hG,{isPopupOpen:r,handlePopupTrigger:oe,orgBrandSetting:u,isAuthenticated:t==null?void 0:t.isAuthenticated,isMobileScreen:o}):null,E.jsx("div",{className:fn("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",o?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:E.jsx("div",{className:fn("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col",o?"":"ed-rounded-[10px]",r?fn("ed-opacity-100",o?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&E.jsxs(E.Fragment,{children:[E.jsx(mG,{searchedText:b,selectedCategory:S,setSearchedText:v,setArticleId:_,setSelectedCategory:w,setIsPopupOpen:i,handleSearch:ae,setArticlesData:R,brandInfo:ye,activeTab:s,userData:t,isMobileScreen:o}),E.jsx("div",{className:fn("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",s==="knowledge_base"?"ed-pb-5":""),children:b?E.jsx("div",{className:"ed-h-full",children:De.size(T)?E.jsx(UF,{articlesData:T,setArticleId:_,setSearchedText:v,setArticlesData:R}):E.jsx(qD,{setIsCreateNewTicketClicked:k})}):E.jsx("div",{className:fn("ed-space-y-4",s==="knowledge_base"?"ed-py-1":""),children:ue()})}),E.jsx(pG,{activeTab:s,handleTabChange:Se,orgBrandSetting:u,hasLiveChat:H,isMobileScreen:o}),C&&E.jsx(Yj,{setIsCreateNewTicketClicked:k,setSearchedText:v,searchedText:b,isAuthenticated:t==null?void 0:t.isAuthenticated})]})})})]})},LY=[".ed-scope",".ed-","--ed-",".ed-tiptap"],FY="ed-widget-bundle-style",jY=()=>{var e;return(e=document.body)==null?void 0:e.classList.contains("ed-scope")},Ry=e=>(e==null?void 0:e.tagName)==="STYLE"&&e.getAttribute("id")===FY,DY=e=>{Ry(e)&&e.getAttribute("data-ed-parent-style-disabled")!=="true"&&(e.setAttribute("media","not all"),e.setAttribute("data-ed-parent-style-disabled","true"))},VY=(e,t)=>{if(!e)return!1;if(Ry(e))return!0;if(e.tagName==="LINK")return t&&e.rel==="stylesheet"&&!!e.href;if(e.tagName!=="STYLE")return!1;if(t)return!0;const n=e.textContent||"";return LY.some(r=>n.includes(r))},Yx=e=>{if(!(e!=null&&e.head))return;const t=jY();e.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!VY(n,t))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),Ry(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),t||DY(n)),e.head.appendChild(r)})},UY=({children:e,dimensions:t,position:n,themeColor:r})=>{const i=O.useRef(null),[o,a]=O.useState(null),[s,c]=O.useState(null);return O.useEffect(()=>{var b;const u=i.current;if(!u)return()=>{};const d=u.contentDocument||((b=u.contentWindow)==null?void 0:b.document);if(!d)return()=>{};const h=d.createElement("meta");h.name="viewport",h.content=`width=${window.innerWidth}, initial-scale=1.0`,d.head.appendChild(h);const p=()=>{const v=d.querySelector('meta[name="viewport"]');v&&(v.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",p);const m=d.createElement("style");m.textContent=`
1627
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function sh(e,t){if(e.kind==="FragmentSpread")t.add(e.name.value);else if(e.kind==="VariableDefinition"){var n=e.type;n.kind==="NamedType"&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(r){sh(r,t)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(r){sh(r,t)}),e.definitions&&e.definitions.forEach(function(r){sh(r,t)})}var Ny={};(function(){Oy.definitions.forEach(function(t){if(t.name){var n=new Set;sh(t,n),Ny[t.name.value]=n}})})();function Gx(e,t){for(var n=0;n<e.definitions.length;n++){var r=e.definitions[n];if(r.name&&r.name.value==t)return r}}function PY(e,t){var n={kind:e.kind,definitions:[Gx(e,t)]};e.hasOwnProperty("loc")&&(n.loc=e.loc);var r=Ny[t]||new Set,i=new Set,o=new Set;for(r.forEach(function(s){o.add(s)});o.size>0;){var a=o;o=new Set,a.forEach(function(s){if(!i.has(s)){i.add(s);var c=Ny[s]||new Set;c.forEach(function(u){o.add(u)})}})}return i.forEach(function(s){var c=Gx(e,s);c&&n.definitions.push(c)}),n}const IY=PY(Oy,"GET_ARTICLES"),MY=e=>{const{userData:t,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:o,setThemeColor:a}=e||{},{activeTab:s,setActiveTab:c,orgBrandSetting:u,setOrgBrandSetting:d,setCurrentConversationID:h,messageListUnreadCount:p}=So(),{unreadMessages:m}=js(),y=p||De.size(m),[b,v]=O.useState(""),[S,w]=O.useState(null),[A,_]=O.useState(null),[C,k]=O.useState(!1),[T,R]=O.useState([]),[F,D]=O.useState(!1),[H,z]=O.useState(!1),[K,V]=O.useState(!1),[L,j]=O.useState(!1),Y=new URLSearchParams(window.location.search).get("intent");O.useEffect(()=>{const he=Y||n;he?he==="chat"?(V(!0),j(!1),c("messages"),i(!0)):he==="kb"&&(j(!0),V(!1),c("knowledge_base"),i(!0)):(V(!1),j(!1),i(!1))},[n,Y]);const[B,{loading:J}]=Es(IY,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:W,data:G}=Ss(Xc,{errorPolicy:"all",fetchPolicy:"no-cache"}),$=async he=>{var ve;const{data:q,error:ke}=await B(he);q!=null&&q.getArticles&&R(((ve=q==null?void 0:q.getArticles)==null?void 0:ve.data)||[]),ke&&console.error(ke)};O.useEffect(()=>{var he;G!=null&&G.getChannelsForPortal&&z(De.size((he=G==null?void 0:G.getChannelsForPortal)==null?void 0:he.data)>0)},[G]);const ie=Z8(he=>{$({variables:{queryData:{search_keyword:he}}})},500),ae=he=>{v(he),ie(he)},ce=async()=>{D(!0);try{const he=await wM();if(he){const{font:q,is_knowledge_base_enabled:ke,theme_color:ve}=he;d(he),a(ve),LM(q),y>0&&H?c("messages"):ke&&!H||ke&&H?c("knowledge_base"):!ke&&H&&c("messages"),D(!1)}}catch(he){console.error(he),D(!1)}},oe=()=>{const he=document.getElementById("ed-widget");i(!r),r&&(t!=null&&t.isAuthenticated)&&h(null),v(""),w(null),_(null),k(!1),ce(),n&&he&&he.removeAttribute("ed-widget-intent"),V(!1),j(!1)};O.useEffect(()=>{ce()},[]),O.useEffect(()=>{if(!u)return;const{is_knowledge_base_enabled:he}=u;H&&K?(c("messages"),i(!0)):he&&L&&(c("knowledge_base"),i(!0))},[u,H,K]);const ue=()=>s==="knowledge_base"?E.jsx(JD,{loading:J,articleId:A,isAuthenticated:t==null?void 0:t.isAuthenticated,selectedCategory:S,setArticleId:_,setSelectedCategory:w,orgBrandSetting:u,isMobileScreen:o}):s==="messages"?E.jsx(RY,{orgBrandSetting:u,setIsPopupOpen:i,userData:t}):null,{brand:ye,is_knowledge_base_enabled:Ce}=u||{},Se=he=>{c(he),v(""),w(null),_(null),k(!1)};return!Ce&&!H?null:E.jsxs("div",{children:[H||Ce?E.jsx(hG,{isPopupOpen:r,handlePopupTrigger:oe,orgBrandSetting:u,isAuthenticated:t==null?void 0:t.isAuthenticated,isMobileScreen:o}):null,E.jsx("div",{className:fn("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",o?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:E.jsx("div",{className:fn("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col ed-relative",o?"":"ed-rounded-[10px]",r?fn("ed-opacity-100",o?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&E.jsxs(E.Fragment,{children:[E.jsx(mG,{searchedText:b,selectedCategory:S,setSearchedText:v,setArticleId:_,setSelectedCategory:w,setIsPopupOpen:i,handleSearch:ae,setArticlesData:R,brandInfo:ye,activeTab:s,userData:t,isMobileScreen:o}),E.jsx("div",{className:fn("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",s==="knowledge_base"?"ed-pb-5":""),children:b?E.jsx("div",{className:"ed-h-full",children:De.size(T)?E.jsx(UF,{articlesData:T,setArticleId:_,setSearchedText:v,setArticlesData:R}):E.jsx(qD,{setIsCreateNewTicketClicked:k})}):E.jsx("div",{className:fn("ed-space-y-4",s==="knowledge_base"?"ed-py-1":""),children:ue()})}),E.jsx(pG,{activeTab:s,handleTabChange:Se,orgBrandSetting:u,hasLiveChat:H,isMobileScreen:o}),C&&E.jsx(Yj,{setIsCreateNewTicketClicked:k,setSearchedText:v,searchedText:b,isAuthenticated:t==null?void 0:t.isAuthenticated})]})})})]})},LY=[".ed-scope",".ed-","--ed-",".ed-tiptap"],FY="ed-widget-bundle-style",jY=()=>{var e;return(e=document.body)==null?void 0:e.classList.contains("ed-scope")},Ry=e=>(e==null?void 0:e.tagName)==="STYLE"&&e.getAttribute("id")===FY,DY=e=>{Ry(e)&&e.getAttribute("data-ed-parent-style-disabled")!=="true"&&(e.setAttribute("media","not all"),e.setAttribute("data-ed-parent-style-disabled","true"))},VY=(e,t)=>{if(!e)return!1;if(Ry(e))return!0;if(e.tagName==="LINK")return t&&e.rel==="stylesheet"&&!!e.href;if(e.tagName!=="STYLE")return!1;if(t)return!0;const n=e.textContent||"";return LY.some(r=>n.includes(r))},Yx=e=>{if(!(e!=null&&e.head))return;const t=jY();e.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!VY(n,t))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),Ry(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),t||DY(n)),e.head.appendChild(r)})},UY=({children:e,dimensions:t,position:n,themeColor:r})=>{const i=O.useRef(null),[o,a]=O.useState(null),[s,c]=O.useState(null);return O.useEffect(()=>{var b;const u=i.current;if(!u)return()=>{};const d=u.contentDocument||((b=u.contentWindow)==null?void 0:b.document);if(!d)return()=>{};const h=d.createElement("meta");h.name="viewport",h.content=`width=${window.innerWidth}, initial-scale=1.0`,d.head.appendChild(h);const p=()=>{const v=d.querySelector('meta[name="viewport"]');v&&(v.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",p);const m=d.createElement("style");m.textContent=`
1628
1628
  html, body {
1629
1629
  margin: 0;
1630
1630
  padding: 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ed-widget",
3
3
  "description": "A flexible and lightweight EasyDesk chat widget for React apps and websites. Supports both React integration and CDN-based embedding for fast, real-time customer support.",
4
- "version": "1.56.9",
4
+ "version": "1.56.10",
5
5
  "private": false,
6
6
  "author": "Gain Solutions AS",
7
7
  "license": "MIT",