1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1013],{26729:function(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function o(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,o,s,a){if("function"!=typeof o)throw TypeError("The listener must be a function");var l=new i(o,s||e,a),r=n?n+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],l]:e._events[r].push(l):(e._events[r]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function l(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1)),l.prototype.eventNames=function(){var e,o,i=[];if(0===this._eventsCount)return i;for(o in e=this._events)t.call(e,o)&&i.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},l.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var i=0,s=o.length,a=Array(s);i<s;i++)a[i]=o[i].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},l.prototype.emit=function(e,t,o,i,s,a){var l=n?n+e:e;if(!this._events[l])return!1;var r,c,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,o),!0;case 4:return d.fn.call(d.context,t,o,i),!0;case 5:return d.fn.call(d.context,t,o,i,s),!0;case 6:return d.fn.call(d.context,t,o,i,s,a),!0}for(c=1,r=Array(u-1);c<u;c++)r[c-1]=arguments[c];d.fn.apply(d.context,r)}else{var h,g=d.length;for(c=0;c<g;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,o);break;case 4:d[c].fn.call(d[c].context,t,o,i);break;default:if(!r)for(h=1,r=Array(u-1);h<u;h++)r[h-1]=arguments[h];d[c].fn.apply(d[c].context,r)}}return!0},l.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,o,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return a(this,s),this;var l=this._events[s];if(l.fn)l.fn!==t||i&&!l.once||o&&l.context!==o||a(this,s);else{for(var r=0,c=[],d=l.length;r<d;r++)(l[r].fn!==t||i&&!l[r].once||o&&l[r].context!==o)&&c.push(l[r]);c.length?this._events[s]=1===c.length?c[0]:c:a(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l},68038:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/agents",function(){return n(39072)}])},29355:function(e,t,n){"use strict";n.d(t,{y:function(){return p}});var o=n(85893),i=n(57747),s=n(61557),a=n(10991),l=n(40853),r=n(81136),c=n(99840),d=n(80510),u=n(4693),h=n(15115),g=n(64698);let p=e=>{let{data:t,columns:n,emptyMessage:p,isLoading:x,size:m="md",border:b=!1,caption:v,extraTableComponent:j,tableProps:f={},extraRows:y,rowProps:C}=e,S=new Map;for(let{key:e,render:t}of n)t&&e&&S.set(e,t);return(0,o.jsx)(i.xu,{...b&&{borderWidth:"thin",borderRadius:"lg",p:"2"},children:(0,o.jsx)(s.x,{children:(0,o.jsxs)(a.i,{fontSize:"sm",variant:"simple",size:m,...f,children:[v&&(0,o.jsx)(l.R,{children:v}),0===t.length&&(0,o.jsxs)(l.R,{w:"full",children:[x?(0,o.jsx)(r.$,{}):p||"No data to show",!!j&&!x&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),j]})]}),(0,o.jsx)(c.h,{bgColor:"gray.50",children:(0,o.jsx)(d.Tr,{children:n.map(e=>{let{key:t,header:n,width:i}=e;return(0,o.jsx)(u.Th,{width:i,children:n},String(t))})})}),(0,o.jsxs)(h.p,{children:[t.map((e,t)=>(0,o.jsx)(d.Tr,{...null==C?void 0:C(e),children:n.map(t=>{var n,i;let{key:s,styleProps:a={}}=t;return(0,o.jsx)(g.Td,{maxW:"400px",wordBreak:"break-word",whiteSpace:"pre-wrap",...a,children:null!==(i=null===(n=S.get(s))||void 0===n?void 0:n(e))&&void 0!==i?i:String(e[s])},String(s))})},t)),y]})]})})})}},39072:function(e,t,n){"use strict";n.r(t),n.d(t,{AgentsContent:function(){return to},default:function(){return ti}});var o=n(85893),i=n(60875),s=n(50348),a=n(21267);let l=[{name:"Basic Settings",fields:[{key:"name",label:"Name"},{key:"tagline",label:"Tagline"},{key:"colorTheme",label:"Color Theme"},{key:"fontColor",label:"Font Color"},{key:"fontSize",label:"Font Size"},{key:"pictureUrl",label:"Logo"}]},{name:"General Settings",fields:[{key:"openAiModel",label:"AI Model"},{key:"customPrompt",label:"Custom Prompt"},{key:"promptOverride",label:"Prompt Override"},{key:"role",label:"Role"},{key:"language",label:"Language"},{key:"responseLength",label:"Response Length"},{key:"responseType",label:"Response Type"},{key:"temperature",label:"Temperature"},{key:"contactButtonLink",label:"Contact Button Link"},{key:"termsAndConditionsLink",label:"Terms & Conditions Link"},{key:"shouldSuggestedQuestionsDisappear",label:"Suggested Questions Disappear"},{key:"shouldCustomLinksDisappear",label:"Custom Links Disappear"},{key:"contextLength",label:"Context Length"},{key:"greetingMessage",label:"Greeting Message"},{key:"shouldSpontaneouslyGreet",label:"Spontaneous Greeting"},{key:"fallbackMessage",label:"Fallback Message"},{key:"shouldPlayInitialVideo",label:"Play Initial Video"},{key:"shouldAllowImageUpload",label:"Allow Image Upload"},{key:"use24HourTimeFormat",label:"24-Hour Time Format"},{key:"shouldSurveyAfterChatEnded",label:"Survey After Chat"},{key:"surveyAfterChatEndedDelay",label:"Survey Delay"},{key:"surveyUserMessage",label:"Survey User Message"},{key:"badChatRatingMessage",label:"Bad Rating Message"},{key:"showRatingBanner",label:"Show Rating Banner"},{key:"shouldCiteSources",label:"Cite Sources"},{key:"citeSourcesType",label:"Citation Type"},{key:"shouldAppendUtmSource",label:"Append UTM Source"},{key:"shouldCitePdfs",label:"Cite PDFs"},{key:"linksStayOnSamePage",label:"Links Stay On Same Page"},{key:"greetingBehavior",label:"Greeting Behavior"}]},{name:"Lead Collection Settings",fields:[{key:"isCollectionMandatory",label:"Mandatory Collection"},{key:"collectFieldsAfterNumMessages",label:"Collect After Messages"},{key:"shouldCollectEmail",label:"Collect Email"},{key:"emailCollectionMessage",label:"Email Collection Message"},{key:"shouldCollectName",label:"Collect Name"},{key:"nameCollectionMessage",label:"Name Collection Message"},{key:"shouldCollectPhoneNumber",label:"Collect Phone Number"},{key:"phoneNumberCollectionMessage",label:"Phone Collection Message"}
1,{key:"shouldSendEmailAfterLeadCollected",label:"Send Email After Lead"},{key:"enableLeadsCollectedMessage",label:"Lead Collected Message"},{key:"leadsCollectedMessage",label:"Lead Collected Text"},{key:"collectEmailIndex",label:"Email Collection Index"},{key:"collectNameIndex",label:"Name Collection Index"},{key:"collectPhoneNumberIndex",label:"Phone Collection Index"}]},{name:"Human Handover Settings",fields:[{key:"enableLeavingAnEmail",label:"Enable Human Handover"},{key:"showLeaveAnEmailAfterNumMessages",label:"Show After Messages"},{key:"applyDelayToHandoverTriggers",label:"Apply Delay To Handover Triggers"},{key:"leaveAnEmailMessage",label:"Handover Request Message"},{key:"handoverSucceededMessage",label:"Handover Success Message"},{key:"shouldTriggerHumanSupportNativePrompt",label:"Native Trigger Prompt"},{key:"shouldAutoAskToLeaveEmail",label:"Auto Ask for Email"},{key:"autoAskToLeaveEmailThreshold",label:"Auto Ask Threshold"},{key:"shouldAutoAskToLeaveEmailAfterFailingToReply",label:"Auto Ask After Fail"},{key:"autoAskToLeaveEmailAfterFailingToReplyThreshold",label:"Fail Threshold"},{key:"supportEmails",label:"Support Emails"}]},{name:"Live Chat Settings",fields:[{key:"enableLiveChat",label:"Enable Live Chat"},{key:"showLiveChatAfterNumMessages",label:"Show After Messages"}]},{name:"Security Settings",fields:[{key:"rateLimitNumMessages",label:"Rate Limit Messages"},{key:"rateLimitFrequencyInSeconds",label:"Rate Limit Frequency"},{key:"rateLimitedMessage",label:"Rate Limited Message"},{key:"whitelistedDomains",label:"Whitelisted Domains"},{key:"enableOpenAiModeration",label:"OpenAI Moderation"},{key:"isPrivate",label:"Private Chatbot"},{key:"passphrase",label:"Passphrase"},{key:"enableReportHarmfulContent",label:"Report Harmful Content"}]},{name:"Advanced Settings",fields:[{key:"maxQuestionLength",label:"Max Question Length"},{key:"avatarUrl",label:"Avatar URL"},{key:"knowledgeBaseSelectionMessage",label:"KB Selection Message"},{key:"knowledgeBaseSelectedMessage",label:"KB Selected Message"},{key:"showRestartConversation",label:"Show Restart"},{key:"shouldAutoRestartChat",label:"Auto Restart Chat"},{key:"autoRestartChatAfterHours",label:"Auto Restart Chat After Hours"},{key:"searchStrategy",label:"Search Strategy"}]}],r=(e,t,n,o)=>{let i=n=>{let o=[],i=l.find(e=>e.name===n);return i&&i.fields.forEach(n=>{let{key:i,label:s}=n;if(!(i in e)||!(i in t))return;let a=e[i],l=t[i];(Array.isArray(a)?JSON.stringify(a):a)!==(Array.isArray(l)?JSON.stringify(l):l)&&o.push({field:s,from:l||"None",to:a||"None"})}),o},s=i("Basic Settings"),a=i("General Settings"),r=i("Lead Collection Settings"),c=i("Human Handover Settings"),d=i("Live Chat Settings"),u=i("Security Settings"),h=i("Advanced Settings"),g=[],p=[];
1n&&o&&n.additionalLanguages.forEach(e=>{let t=o.additionalLanguages.find(t=>t.language===e.language);if(t){let n=[e.tagline!==t.tagline,e.greetingMessage!==t.greetingMessage,e.fallbackMessage!==t.fallbackMessage,e.badChatRatingMessage!==t.badChatRatingMessage,e.surveyUserMessage!==t.surveyUserMessage,e.emailCollectionMessage!==t.emailCollectionMessage,e.nameCollectionMessage!==t.nameCollectionMessage,e.phoneNumberCollectionMessage!==t.phoneNumberCollectionMessage,e.customEmailCollectionMessage!==t.customEmailCollectionMessage,e.customEmailCollectedMessage!==t.customEmailCollectedMessage,e.leaveAnEmailMessage!==t.leaveAnEmailMessage].filter(Boolean).length;n>0&&p.push({language:e.language,messageCount:n})}else{let t=[e.tagline,e.greetingMessage,e.fallbackMessage,e.badChatRatingMessage,e.surveyUserMessage,e.emailCollectionMessage,e.nameCollectionMessage,e.phoneNumberCollectionMessage,e.customEmailCollectionMessage,e.customEmailCollectedMessage,e.leaveAnEmailMessage].filter(Boolean).length;g.push({language:e.language,messageCount:t})}});let x=[];return e.workflows&&t.workflows&&e.workflows.forEach(e=>{let n=e.name,o=0;for(;t.workflows.find(e=>e.name===n);)o++,n="".concat(e.name," (Copy").concat(o>1?" ".concat(o):"",")");x.push({name:n,trigger:e.trigger})}),{basicSettings:{changed:s},generalSettings:{changed:a},leadCollectionSettings:{changed:r},humanHandoverSettings:{changed:c},liveChatSettings:{changed:d},securitySettings:{changed:u},advancedSettings:{changed:h},languages:{added:g,updated:p},workflows:{added:x}}},c=e=>e.basicSettings.changed.length>0||e.generalSettings.changed.length>0||e.leadCollectionSettings.changed.length>0||e.humanHandoverSettings.changed.length>0||e.liveChatSettings.changed.length>0||e.securitySettings.changed.length>0||e.advancedSettings.changed.length>0||e.languages.added.length>0||e.languages.updated.length>0||e.workflows.added.length>0;var d=n(59007),u=n(7963),h=n(35541),g=n(83589),p=n(14581),x=n(64859),m=n(93717),b=n(57747),v=n(36948),j=n(71293),f=n(66205),y=n(54346),C=n(48783),S=n(85970),k=n(5418),w=n(41731),E=n(45966),I=n(81136),A=n(14253),O=n(34292),z=n(93108),D=n(85945),M=n(16058),T=n(67294),R=n(34052);function L(e){let{isOpen:t,onClose:n,targetChatbotId:i,targetChatbotName:s}=e,a=(0,u.p)(),l=(0,D.NL)(),[L,N]=(0,T.useState)(""),[_,P]=(0,T.useState)(null),[W,F]=(0,T.useState)(!1),[G,q]=(0,T.useState)(!1),{data:U,isLoading:B}=d.S.chatbot.getChatbotsBasicInfo.useQuery(),{data:J}=d.S.chatbot.getChatBotQuery.useQuery({chatbotId:L},{enabled:!!L}),{data:H}=d.S.chatbot.getChatBotQuery.useQuery({chatbotId:i},{enabled:!!i}),{data:Q}=d.S.chatbot.getChatbotLanguages.useQuery({chatbotId:L},{enabled:!!L}),{data:Y}=d.S.chatbot.getChatbotLanguages.useQuery({chatbotId:i},{enabled:!!i}),V=d.S.chatbot.copySettingsFromChatbot.useMutation({onSuccess:()=>{a({title:"Settings copied successfully!",description:"Settings have been copied from ".concat(null==J?void 0:J.name," to ").concat(s),status:"success",duration:5e3,isClosable:!0}),l.invalidateQueries((0,M.Ol)(d.S.chatbot.getChatBotQuery,{chatbotId:i})),l.invalidateQueries((0,M.Ol)(d.S.chatbot.getChatbotLanguages,{chatbotId:i})),l.invalidateQueries((0,M.Ol)(d.S.chatbot.getChatbots)),n()},onError:e=>{a({title:"Failed to copy settings",description:e.message,status:"error",duration:5e3,isClosable:!0})}}),Z=()=>{J&&H&&Q&&Y&&(F(!0),P(r(J,H,Q,Y)),F(!1))},X=e=>{N(e),P(null)};(0,T.useEffect)(()=>{J&&H&&Q&&Y&&Z()},[J,H,Q,Y]);let $=null==U?void 0:U.filter(e=>e.id!==i),K=!!_&&c(_);return(0,o.jsxs)(h.u_,{isOpen:t,onClose:n,size:"xl",children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxH:"90vh",overflow:"hidden",children:[(0,o.jsx)(x.x,{children:(0,o.jsxs)(m.k,{alignItems:"center",gap:3,children:[(0,o.jsx)(b.xu,{bg:"blue.500",p:2,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"md",w:"32px",h:"32px",children:(0,o.jsx)(v.J,{as:R.C3L,color:"white",boxSize:"18px"})}),(0,o.jsxs)(j.x,{children:["Copy Settings to ",s]})]})}),(0,o.jsx)(f.o,{}),(0,o.jsx)(y.f,{overflowY:"auto",maxH:"calc(90vh - 200px)",children:(0,o.jsxs)(C.g,{spacing:6,align:"stretch",children:[(0,o.jsxs)(S.NI,{children:[(0,o.jsx)(k.l,{fontSize:"sm",fontWeight:"medium",children:"Select chatbot to copy settings from:"}),(0,o.jsx)(w.P,{placeholder:"Choose a chatbot...",value:L,onChange:e=>X(e.target.value),size:"sm",isDisabled:B,children:null==$?void 0:$.map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))}),B&&(0,o.jsx)(j.x,{fontSize:"xs",color:"gray.500",mt:1,children:"Loading chatbots..."})]}),L&&(0,o.jsx)(b.xu,{p:4,bg:"orange.50",borderRadius:"md",borderWidth:1,borderColor:"orange.200",children:(0,o.jsx)(E.X,{isChecked:G,onChange:e=>q(e.target.checked),size:"sm",children:(0,o.jsxs)(C.g,{align:"start",spacing:1,children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",children:"Also copy data sources"}),(0,o.jsxs)(j.x,{fontSize:"xs",color:"orange.700",children:["â ï¸ This will completely replace all existing data sources in ",s]}),(0,o.jsx)(j.x,{fontSize:"xs",color:"gray.600",children:"Includes: webpages, PDF files, Google Drive files, SharePoint files, and all indexed content"})]})})}),L&&(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",mb:3,children:"Changes Preview:"}),W?(0,o.jsxs)(m.k,{justify:"center",p:4,children:[(0,o.jsx)(I.$,{size:"sm"}),(0,o.jsx)(j.x,{ml:2,fontSize:"sm",color:"gray.500",children:"Calculating differences..."})]}):_?(0,o.jsx)(C.g,{spacing:4,align:"stretch",children:K?(0,o.jsxs)(o.Fragment,{children:[(()=>{let e=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"blue.50";return 0===t.length?null:(0,o.jsxs)(b.xu,{children:[(0,o.jsxs)(j.x,{fontSize:"sm",fontWeight:"medium",mb:2,children:[e,":"]}
1),(0,o.jsx)(C.g,{spacing:2,align:"stretch",children:t.map((e,t)=>(0,o.jsxs)(m.k,{align:"center",gap:2,p:2,bg:n,borderRadius:"md",fontSize:"sm",children:[(0,o.jsxs)(j.x,{fontWeight:"medium",children:[e.field,":"]}),(0,o.jsx)(j.x,{color:"gray.600",children:String(e.from)}),(0,o.jsx)(v.J,{as:R.Rgz,color:"blue.500"}),(0,o.jsx)(j.x,{color:"blue.600",fontWeight:"medium",children:String(e.to)})]},t))})]},e)};return(0,o.jsxs)(o.Fragment,{children:[e("Basic Settings Changes",_.basicSettings.changed),e("General Settings Changes",_.generalSettings.changed,"green.50"),e("Lead Collection Changes",_.leadCollectionSettings.changed,"orange.50"),e("Human Handover Changes",_.humanHandoverSettings.changed,"purple.50"),e("Live Chat Changes",_.liveChatSettings.changed,"pink.50"),e("Security Changes",_.securitySettings.changed,"red.50"),e("Advanced Settings Changes",_.advancedSettings.changed,"gray.50")]})})(),(_.languages.added.length>0||_.languages.updated.length>0)&&(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",mb:2,children:"Language Changes:"}),(0,o.jsxs)(C.g,{spacing:2,align:"stretch",children:[_.languages.added.map((e,t)=>(0,o.jsxs)(m.k,{align:"center",gap:2,p:2,bg:"green.50",borderRadius:"md",fontSize:"sm",children:[(0,o.jsx)(v.J,{as:R.OvN,color:"green.500"}),(0,o.jsxs)(j.x,{children:["Add ",(0,o.jsx)("strong",{children:e.language})," ","language with ",e.messageCount," custom messages"]})]},t)),_.languages.updated.map((e,t)=>(0,o.jsx)(m.k,{align:"center",gap:2,p:2,bg:"orange.50",borderRadius:"md",fontSize:"sm",children:(0,o.jsxs)(j.x,{children:["Update ",(0,o.jsx)("strong",{children:e.language})," ","language messages (",e.messageCount," ","changes)"]})},t))]})]}),_.workflows.added.length>0&&(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",mb:2,children:"Workflows to Add:"}),(0,o.jsx)(C.g,{spacing:2,align:"stretch",children:_.workflows.added.map((e,t)=>(0,o.jsxs)(m.k,{align:"center",gap:2,p:2,bg:"purple.50",borderRadius:"md",fontSize:"sm",children:[(0,o.jsx)(v.J,{as:R.OvN,color:"purple.500"}),(0,o.jsxs)(j.x,{children:[(0,o.jsx)("strong",{children:e.name})," -"," ",e.trigger," trigger"]})]},t))})]})]}):(0,o.jsx)(b.xu,{p:4,bg:"gray.50",borderRadius:"md",textAlign:"center",children:(0,o.jsx)(j.x,{fontSize:"sm",color:"gray.600",children:"No differences found. The selected chatbot has identical basic settings."})})}):null]})]})}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[(0,o.jsx)(z.z,{variant:"ghost",onClick:n,children:"Cancel"}),(0,o.jsx)(z.z,{colorScheme:"brand",onClick:()=>{L&&(K||G)&&V.mutate({chatbotId:L,targetChatbotId:i,copyDataSources:G})},isDisabled:!L||!K&&!G,isLoading:V.isLoading,loadingText:"Copying...",children:"Copy Settings"})]})})]})]})}var N=n(22052),_=n(51998),P=n(84790),W=n(57169);let F=e=>{let{isOpen:t,onClose:n,onOpen:i,chatbot:s,isLoading:a,onSubmit:l}=e,[r,c]=(0,T.useState)("");return(0,o.jsxs)(h.u_,{isOpen:t,onClose:n,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxW:"450px",children:[(0,o.jsx)(x.x,{children:(0,o.jsx)(j.x,{layerStyle:"header",fontSize:"16px",mt:4,children:"Disable ".concat(null==s?void 0:s.name)})}),(0,o.jsxs)(y.f,{display:"flex",flexDir:"column",fontSize:"14px",children:[(0,o.jsx)(j.x,{children:"After you disable your chatbot, your chatbot will no longer be able to reply to questions. A default message keyed in by you will be displayed instead."}),(0,o.jsx)(b.xu,{mt:4}),(0,o.jsx)(k.l,{children:"Default Message:"}),(0,o.jsx)(W.g,{value:r,onChange:e=>c(e.target.value),placeholder:P.Bf,rows:5})]}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[(0,o.jsx)(z.z,{onClick:n,isLoading:a,children:"Close"}),(0,o.jsx)(z.z,{colorScheme:"brand",type:"submit",isLoading:a,onClick:()=>{l(r)},children:"Confirm"})]})})]})]})};var G=n(78604),q=n(49289),U=n(74153),B=n(7405),J=n(92798);function H(e){let{isOpen:t,onClose:n,chatbotId:i,chatbotName:s,onSuccess:a}=e,l=(0,u.p)(),[r,c]=(0,T.useState)(!0),[m,v]=(0,T.useState)(!0),[S,k]=(0,T.useState)(!0),[w,I]=(0,T.useState)(!0),O=d.S.chatbot.duplicateChatbot.useMutation({onSuccess:()=>{l({title:"Chatbot duplicated successfully!",description:"".concat(s," has been duplicated"),status:"success",duration:5e3,isClosable:!0}),n(),null==a||a()},onError:e=>{l({title:"Failed to duplicate chatbot",description:e.message,status:"error",duration:5e3,isClosable:!0})}});return(0,o.jsxs)(h.u_,{isOpen:t,onClose:n,size:"md",children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{children:[(0,o.jsxs)(x.x,{children:[(0,o.jsx)(R.
1C3L,{style:{display:"inline",marginRight:"8px"}}),"Duplicate Chatbot"]}),(0,o.jsx)(f.o,{}),(0,o.jsx)(y.f,{children:(0,o.jsxs)(C.g,{align:"stretch",spacing:4,children:[(0,o.jsxs)(j.x,{children:["You are about to duplicate ",(0,o.jsx)("strong",{children:s}),". Choose what to include in the duplicate:"]}),(0,o.jsx)(q.i,{}),(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(j.x,{fontWeight:"medium",mb:3,children:"Choose what data sources to include:"}),(0,o.jsxs)(C.g,{align:"stretch",spacing:3,children:[(0,o.jsx)(E.X,{isChecked:r,onChange:e=>c(e.target.checked),colorScheme:"brand",children:(0,o.jsx)(j.x,{children:"URLs and web pages"})}),(0,o.jsx)(E.X,{isChecked:m,onChange:e=>v(e.target.checked),colorScheme:"brand",children:(0,o.jsx)(j.x,{children:"Files (Uploaded, Google Drive, Sharepoint)"})}),(0,o.jsx)(E.X,{isChecked:S,onChange:e=>k(e.target.checked),colorScheme:"brand",children:(0,o.jsx)(j.x,{children:"Corrections"})}),(0,o.jsx)(E.X,{isChecked:w,onChange:e=>I(e.target.checked),colorScheme:"brand",children:(0,o.jsx)(j.x,{children:"FAQ (formerly Raw Text)"})})]})]}),!r&&!m&&!S&&!w&&(0,o.jsxs)(U.b,{status:"info",borderRadius:"md",children:[(0,o.jsx)(B.z,{}),(0,o.jsx)(J.X,{fontSize:"sm",children:"The duplicate will include all settings and configuration but no training data. You'll need to add data sources manually."})]}),(r||m||S||w)&&(!r||!m||!S||!w)&&(0,o.jsxs)(U.b,{status:"warning",borderRadius:"md",children:[(0,o.jsx)(B.z,{}),(0,o.jsx)(J.X,{fontSize:"sm",children:"Only selected data types will be duplicated. Other data sources will need to be added manually."})]})]})}),(0,o.jsxs)(A.m,{children:[(0,o.jsx)(z.z,{variant:"ghost",mr:3,onClick:n,children:"Cancel"}),(0,o.jsx)(z.z,{colorScheme:"brand",onClick:()=>{O.mutate({chatbotId:i,duplicateUrls:r,duplicateFiles:m,duplicateCorrections:S,duplicateRawText:w})},isLoading:O.isLoading,leftIcon:(0,o.jsx)(R.C3L,{}),children:"Duplicate"})]})]})]})}var Q=n(24281),Y=n(22335),V=n(59462);function Z(e){let{onCreate:t}=e,{data:n,isLoading:i}=d.S.chatbot.getBotScopeSummary.useQuery(),[s,a]=(0,T.useState)(void 0),l=d.S.workspaces.setSelectedWorkspace.useMutation({onSuccess:()=>{window.location.reload()},onError:()=>{a(void 0)}}),r=e=>{a(e),l.mutate({workspaceId:e})};if(i||!n)return(0,o.jsx)(m.k,{justify:"center",align:"center",py:16,children:(0,o.jsx)(I.$,{size:"lg"})});let c=n.otherScopesWithBots,u=(0,o.jsx)(m.k,{align:"center",justify:"center",boxSize:"48px",borderRadius:"full",bg:"gray.100",color:"gray.500",children:(0,o.jsx)(R.WY8,{size:22})});if(0===c.length)return(0,o.jsxs)(C.g,{spacing:4,textAlign:"center",py:16,px:6,children:[(0,o.jsx)(m.k,{align:"center",justify:"center",boxSize:"48px",borderRadius:"full",bg:"gray.100",color:"brand.500",children:(0,o.jsx)(R.OvN,{size:22})}),(0,o.jsxs)(C.g,{spacing:1,children:[(0,o.jsx)(j.x,{fontSize:"lg",fontWeight:"semibold",children:"Create your first AI agent"}),(0,o.jsx)(j.x,{color:"gray.500",maxW:"sm",children:"Train it on your website or documents in a couple of minutes."})]}),(0,o.jsx)(z.z,{colorScheme:"brand",leftIcon:(0,o.jsx)(R.OvN,{}),onClick:t,children:"Create agent"})]});let h=1===c.length?c[0]:null;return(0,o.jsxs)(C.g,{spacing:5,textAlign:"center",py:16,px:6,children:[u,(0,o.jsxs)(C.g,{spacing:1,children:[(0,o.jsxs)(j.x,{fontSize:"lg",fontWeight:"semibold",children:["No agents in ",n.current.name," yet"]}),(0,o.jsx)(j.x,{color:"gray.500",maxW:"md",children:h?"Your ".concat(1===h.count?"agent is":"".concat(h.count," agents are")," in ").concat(h.name,"."):"Your agents are in your other teams."})]}),h?(0,o.jsxs)(z.z,{colorScheme:"brand",rightIcon:(0,o.jsx)(R.Rgz,{}),isLoading:s===h.id,onClick:()=>r(h.id),children:["Switch to ",h.name]}):(0,o.jsx)(C.g,{spacing:2,w:"full",maxW:"sm",children:c.map(e=>{var t;return(0,o.jsxs)(m.k,{as:"button",w:"full",align:"center",gap:3,px:4,py:3,borderRadius:"lg",border:"1px solid",borderColor:"gray.200",bg:"white",_hover:{bg:"gray.50",borderColor:"gray.300"},transition:"background 0.15s, border-color 0.15s",onClick:()=>r(e.id),disabled:l.isLoading,children:[(0,o.jsxs)(b.xu,{textAlign:"left",flex:1,minW:0,children:[(0,o.jsx)(j.x,{fontWeight:"medium",noOfLines:1,children:e.name}),(0,o.jsxs)(j.x,{fontSize:"sm",color:"gray.500",children:[e.count," agent",1===e.count?"":"s"]})]}),s===e.id?(0,o.jsx)(I.$,{size:"sm",color:"gray.400"}):(0,o.jsx)(v.J,{as:R.Rgz,color:"gray.400",boxSize:4})]},null!==(t=e.id)&&void 0!==t?t:"personal")})}),(0,o.jsxs)(z.z,{variant:"ghost",size:"sm",color:"gray.500",onClick:t,children:["or create an agent in ",n.current.name]})]})}var X=n(47029),$=n(8371),K=n(74e3),ee=n(2914),et=function(e){var t,n;let{isOpen:i,onClose:s,editingChatbot:a}=e,[l,r]=(0,T.useState)(null),{data:c,isLoading:u,refetch:f}=d.S.chatbot.getFilesCrawled.useQuery({chatbotId:null!==(t=null==a?void 0:a.id)&&void 0!==t?t:""},{enabled:!!(null==a?void 0:a.id)}),S=null==c?void 0:c.files;return null==c||c.chars,(0,T.useEffect)(()=>{var e;(null==a?void 0:null===(e=a.knowledgeBases)||void 0===e?void 0:e[0])&&r(null==a?void 0:a.knowledgeBases[0].id),a&&f()},[a]),(0,o.jsxs)(h.u_,{isOpen:i,onClose:s,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxW:"560px",children:[(0,o.jsx)(x.x,{children:"Files Indexed"}),(0,o.jsx)(y.f,{children:(0,o.jsxs)(C.g,{alignItems:"flex-start",children:[(0,o.jsx)(j.x,{layerStyle:"regularImportant",children:"Total Files indexed: ".concat(null!==(n=null==S?void 0:S.length)&&void 0!==n?n:0)}),(0,o.jsx)(m.k,{flexWrap:"wrap",gap:"2",children:(null==a?void 0:a.knowledgeBases)&&a.knowledgeBases.length>0&&a.knowledgeBases.map(e=>(0,o.jsx)($.Vp,{colorScheme:"gray",borderColor:"blue.300",cursor:"pointer",borderWidth:l===e.id?"2px":0,onClick:()=>{r(e.id)},children:(0,o.jsx)($.Sn,{children:e.name})},e.id))}),u?(0,o.jsx)(I.$,{}):S?(0,o.jsx)(b.xu,{borderWidth:"thin",p:2,borderRadius:"lg",maxH:"60vh",overflowY:"auto",fontSize:"sm",w:"full",children:null==S?void 0:S.filter(e=>!e.knowledgeBaseId||l===e.knowledgeBaseId).map(e=>{let{pdfName:t,type:n,subType:i,pageTitle:s}=e;return(0,o.jsxs)(m.k,{gap:"2",alignItems:"center",children:["MICROSOFT_SHAREPOINT"===n&&(0,o.jsx)(v.J,{as:ee.oV6}),"GOOGLE_DRIVE"===n&&(0,o.jsx)(v.J,{as:ee.dv9}),"YOUTUBE_VIDEO"===i&&(0,o.jsx)(v.J,{as:ee.V2E}),"IMAGE"===i&&(0,o.jsx)(v.J,{as:R.LFN,color:"blue.500"}),("FILE"===n||"PDF"===n)&&"YOUTUBE_VIDEO"!==i&&"IMAGE"!==i&&(0,o.jsx)(v.J,{as:R.NOg}),(0,o.jsx)(j.x,{children:t})]},t)})}):(0,o.jsx)(j.x,{children:"No Files indexed"}),a&&(0,o.jsx)(j.x,{layerStyle:"regularImportant",children:"Pages last updated on ".concat((0,K.Z)(a.updatedAt,"MMMM d, yyyy"))})]})}),(0,o.jsx)(A.m,{children:(0,o.jsx)(O.U,{children:(0,o.jsx)(z.z,{onClick:s,children:"Close"})})})]})]})},en=n(77213),eo=n(22275),ei=n(18652),es=n(5460);function ea(e){let{isOpen:t,onClose:n,currentWorkspace:i,onMoveChatbot:s,isLoading:a}=e,[l,r]=(0,T.useState)(""),[c,u]=(0,T.useState)(!1),{data:m,isLoading:v}=d.S.chatbot.getPersonalChatbots.useQuery(void 0,{enabled:t}),S=null==m?void 0:m.find(e=>e.id===l),k=()=>{r(""),u(!1),n()};return i?(0,o.jsxs)(h.u_,{isOpen:t,onClose:k,size:"md",children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{children:[(0,o.jsx)(x.x,{children:c?"Confirm Move":"Move Chatbot to Team"}),(0,o.jsx)(f.o,{}),(0,o.jsx)(y.f,{children:c?(0,o.jsxs)(C.g,{spacing:4,align:"stretch",children:[(0,o.jsxs)(U.b,{status:"warning",children:[(0,o.jsx)(B.z,{}),(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(ei.C,{children:"Confirm chatbot move"}),(0,o.jsx)(J.X,{children:"Are you sure you want to move this chatbot to your team? This action cannot be undone."})]})]}),S&&(0,o.jsxs)(b.xu,{p:4,borderWidth:1,borderRadius:"md",bg:"gray.50",children:[(0,o.jsx)(j.x,{fontWeight:"semibold",mb:2,children:"Chatbot to move:"}),(0,o.jsxs)(O.U,{children:[(0,o.jsx)(es.E,{borderRadius:"full",boxSize:"40px",src:S.pictureUrl||P.rD,alt:S.name}),(0,o.jsxs)(C.g,{align:"start",spacing:0,children:[(0,o.jsx)(j.x,{fontWeight:"medium",children:S.name}),(0,o.jsx)(j.x,{fontSize:"sm",color:"gray.600",children:S.role.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")})]})]})]}),(0,o.jsxs)(b.xu,{p:4,borderWidth:1,borderRadius:"md",bg:"blue.50",children:[(0,o.jsx)(j.x,{fontWeight:"semibold",mb:2,children:"Destination team:"}),(0,o.jsxs)(O.U,{children:[(0,o.jsx)(es.E,{borderRadius:"full",boxSize:"40px",src:i.imageUrl||P.rD,alt:i.name}),(0,o.jsx)(j.x,{fontWeight:"medium",children:i.name})]})]})]}):(0,o.jsxs)(C.g,{spacing:4,align:"stretch",children:[(0,o.jsx)(j.x,{fontSize:"sm",color:"gray.600",children:'Select a personal chatbot to move to "'.concat(i.name,'"')}),v?(0,o.jsx)(j.x,{children:"Loading your chatbots..."}):m&&m.length>0?(0,o.jsx)(w.P,{placeholder:"Select a chatbot to move",value:l,onCh
1ange:e=>r(e.target.value),children:m.map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))}):(0,o.jsxs)(U.b,{status:"info",children:[(0,o.jsx)(B.z,{}),(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(ei.C,{children:"No personal chatbots found!"}),(0,o.jsx)(J.X,{children:"You don't have any personal chatbots that can be moved to a team. All your chatbots are either already in teams or you haven't created any yet."})]})]})]})}),(0,o.jsx)(A.m,{children:c?(0,o.jsxs)(O.U,{spacing:3,children:[(0,o.jsx)(z.z,{variant:"ghost",onClick:()=>{u(!1)},children:"Back"}),(0,o.jsx)(z.z,{colorScheme:"red",onClick:()=>{l&&s(l)},isLoading:a,loadingText:"Moving...",children:"Move Chatbot"})]}):(0,o.jsxs)(O.U,{spacing:3,children:[(0,o.jsx)(z.z,{variant:"ghost",onClick:k,children:"Cancel"}),(0,o.jsx)(z.z,{colorScheme:"brand",onClick:()=>{l&&u(!0)},isDisabled:!l||v,children:"Next"})]})})]})]}):null}var el=n(32282),er=n(4954),ec=n(20559),ed=n(88902),eu=n(41664),eh=n.n(eu);let eg=e=>{let{isOpen:t,onClose:n,chatbot:i}=e;return(0,o.jsxs)(h.u_,{isOpen:t,onClose:n,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{children:[(0,o.jsx)(x.x,{children:(0,o.jsx)(j.x,{layerStyle:"header",fontSize:"16px",mt:4,children:"Team member limit for ".concat(null==i?void 0:i.name," reached")})}),(0,o.jsxs)(y.f,{display:"flex",flexDir:"column",fontSize:"14px",children:[(0,o.jsxs)(j.x,{children:["You have reached the maximum number of ",(0,o.jsxs)("strong",{children:["(",(0,P.iP)((null==i?void 0:i.owner.subscriptionType)||"NONE",null==i?void 0:i.owner.extraSeats),")"]})," team member(s) eligible for the ",(0,o.jsx)("strong",{children:null==i?void 0:i.owner.subscriptionType})," "," plan."]}),(0,o.jsx)(j.x,{pt:"4",children:"Please upgrade your account to invite more team members"})]}),(0,o.jsx)(A.m,{justifyContent:"flex-start",children:(0,o.jsxs)(O.U,{w:"full",children:[(0,o.jsx)(z.z,{onClick:n,children:"Close"}),(0,o.jsx)(z.z,{colorScheme:"brand",style:{marginLeft:"auto"},children:(0,o.jsx)(eh(),{href:"https://wonderchat.io/pricing",target:"_blank",children:"View Plans"})}),(0,o.jsx)(z.z,{colorScheme:"brand",children:(0,o.jsx)(eh(),{href:"subscription",children:"Upgrade Plan"})})]})})]})]})};var ep=n(66924),ex=n(32397),em=n(81303),eb=n(81471),ev=n(12319),ej=n(46968),ef=n(25244),ey=n(21464),eC=n(29355),eS=n(47583),ek=n(70386),ew=n(81399),eE=n(22697),eI=n(47880),eA=n(19784),eO=n(2287),ez=n(2989),eD=n(45527),eM=n(606),eT=n(85392),eR=n(6147),eL=n(19754),eN=n(13990),e_=n(40607),eP=n(55281),eW=n(32568),eF=n(22797),eG=n(32883),eq=n(89993),eU=n(5674),eB=n(66712),eJ=n(91170),eH=n(4040),eQ=n(74970),eY=n(20967),eV=n(70959),eZ=n(44461),eX=n(24124),e$=n(80510),eK=n(64698),e0=n(24880),e1=n(73804),e5=n(70385),e2=n(12903),e4=n(33299),e9=n(11163),e3=n(58192),e7=n(44173),e6=n(52435);function e8(e,t){var n,o,i,s;if(!t)return!1;let a=null==t?void 0:null===(n=t.user)||void 0===n?void 0:n.email,l=null==t?void 0:null===(o=t.user)||void 0===o?void 0:o.googleWorkspaceGroupIds;return(null==t?void 0:t.workspace)?(null==t?void 0:t.workspace.myRole)!=="MEMBER":a===(null==e?void 0:null===(i=e.owner)||void 0===i?void 0:i.email)||(null==e?void 0:null===(s=e.TeamMember.find(e=>e.user.email===a))||void 0===s?void 0:s.role)==="ADMIN"||(null==e?void 0:e.whitelistedGoogleGroups.filter(e=>"USER"!==e.type).some(e=>null==l?void 0:l.includes(e.groupId)))}let te={0:"MINE",1:"SHARED"};function tt(e){var t,n,i,s,a,l,r,c,d,u;let{chatbot:h,chatbotDisplayType:g,session:p,onOpenDisableBot:x,setEditingChatbotId:f,updateChatbotStateMutation:y,onOpenUrlList:C,onOpenBotEditPages:S,onOpenBotReindex:k,onOpenFileList:w,onOpenBotEditFiles:E,onOpenGoogleDriveReindex:A,onOpenEmbeddedSites:O,onOpenWhatsappIntegration:D,onOpenSlackConnection:M,onOpenTelegramConnection:T,onOpenTeamsConnection:L,onOpenFacebookMessengerIntegration:N,onOpenDiscordIntegration:_,onOpenPhonecallIntegration:W,onOpenDialpadIntegration:F,onOpenTwilioIntegration:G,onOpenInstagramIntegration:U,onOpenEmailIntegration:B,router:J,onOpenEmbed:H,updateChatbotIsPrivateMutation:Q,onOpenInviteTeamMember:Y,onOpenTeamMemberLimitReached:V,toast:Z,onOpenOverageBotMessage:X,duplicateChatbotMutation:$,leaveChatbotMutation:K,onOpenDelete:et,isBotLimitReached:en,onOpenViewTeamMember:eo,onOpenCopySettings:ei,onOpenDuplicateChatbot:ea,onOpenFrozenChatbot:el,onUnfreezeChatbot:er}=e;return null==p||null===(n=p.data)||void 0===n||null===(t=n.user)||void 0===t||t.subscriptionType,(0,o.jsx)(eN.Z,{size:"sm",variant:"outline",children:(0,o.jsx)(e_.e,{p:4,children:(0,o.jsxs)(eP.K,{spacing:3,children:[(0,o.jsxs)(m.k,{align:"center",gap:3,children:[(0,o.jsx)(es.E,{borderRadius:"full",borderColor:"gray",alt:"Bot display picture",boxSize:"40px",src:h.pictureUrl||P.rD}),(0,o.jsxs)(b.xu,{flex:1,minW:0,children:[(0,o.jsxs)(m.k,{align:"center",gap:2,mb:1,children:[(0,o.jsx)(eh(),{href:"/agents/settings/".concat(h.id),children:(0,o.jsx)(j.x,{fontSize:"md",fontWeight:"semibold",color:"blue.500",_hover:{textDecoration:"underline"},noOfLines:1,children:h.name})}),h.isPrivate&&(0,o.jsx)(eW.u,{label:"Private chatbots are only visible to you and your team members",children:(0,o.jsx)(eI.m,{color:"gray.500",boxSize:3})})]}),(0,o.jsx)(j.x,{color:"gray.500",fontSize:"sm",children:h.role.split("_").map(e=>(0,eE.Mp)(e.toLowerCase())).join(" ")})]})]}),(0,o.jsx)(q.i,{}),(0,o.jsxs)(m.k,{justify:"space-between",align:"center",children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",children:"Status:"}),(0,o.jsx)(b.xu,{children:"CREATING"===h.chatbotState||"REINDEXING"===h.chatbotState||"ADDING"===h.chatbotState||"DELETING"===h.chatbotState?(0,o.jsxs)(m.k,{align:"center",gap:2,children:[(0,o.jsx)(I.$,{size:"sm"}),(0,o.jsxs)(j.x,{fontSize:"sm",children:[(0,eE.Mp)(h.chatbotState.toLowerCase()),"ADDING"===h.chatbotState?" to":"DELETING"===h.chatbotState?" from":""," ","bot..."]})]}):h.isFrozen?(0,o.jsx)(eW.u,{label:"This chatbot is frozen due to plan limits. Click to learn more.",children:(0,o.jsxs)(m.k,{align:"center",gap:2,cursor:"pointer",onClick:()=>{f(h.id),el()},children:[(0,o.jsx)(j.x,{fontSize:"sm",color:"blue.500",children:"Frozen"}),(0,o.jsx)(v.J,{color:"blue.400",as:ee.l51})]})}):"ERROR"===h.chatbotState?(0,o.jsxs)(m.k,{align:"center",gap:2,children:[(0,o.jsx)(j.x,{fontSize:"sm",color:"red.500",children:"Error"}),(0,o.jsx)(eW.u,{label:"Something went wrong when creating your bot. Please try deleting this chatbot and recreating a new one. Contact support if problem still persists.",children:(0,o.jsx)(v.J,{color:"red",as:R.BJv})})]}):(0,o.jsx)(eF.r,{colorScheme:"green",size:"sm",isChecked:"ENABLED"===h.chatbotState,onChange:()=>{"ENABLED"===h.chatbotState?(f(h.id),x()):y.mutate({chatbotId:h.id,newState:"ENABLED"})}})})]}),(0,o.jsxs)(m.k,{justify:"space-between",align:"center",children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",children:"Pages:"}),(0,o.jsxs)(m.k,{align:"center",gap:2,children:[(0,o.jsx)(eG.r,{fontSize:"sm",color:"blue.500",onClick:()=>{C(),f(h.id)},children:h.webpagesCount}),(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eA.d,{}),"aria-label":"Edit chatbot pages",onClick:()=>{S(),f(h.id)},isDisabled:"CREATING"===h.chatbotState||"REINDEXING"===h.chatbotState||"ADDING"===h.chatbotState||"DELETING"===h.chatbotState||!e8(h,null==p?void 0:p.data)})]})]}),(0,o.jsxs)(m.k,{justify:"space-between",align:"center",children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",children:"Files:"}),(0,o.jsxs)(m.k,{align:"center",gap:2,children:[(0,o.jsx)(eG.r,{fontSize:"sm",color:"blue.500",onClick:()=>{w(),f(h.id)},children:h.filesCount}),(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eA.d,{}),"aria-label":"Add file to chatbot",onClick:()=>{f(h.id),E()},isDisabled:"CREATING"===h.chatbotState||"REINDEXING"===h.chatbotState||"ADDING"===h.chatbotState||"DELETING"===h.chatbotState||!e8(h,null==p?void 0:p.data)})]})]}),(0,o.jsxs)(m.k,{justify:"space-between",align:"center",children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",children:"Tools:"}),(0,o.jsx)(eG.r,{fontSize:"sm",color:"blue.500",onClick:()=>{J.push("/agents/settings/".concat(h.id,"?tab=tools"))},children:h.totalActionsCount})]}),(0,o.jsxs)(b.xu,{children:[(0,o.jsx)(j.x,{fontSize:"sm",fontWeight:"medium",mb:2,children:"Channels:"}),(0,o.jsxs)(eU.M,{columns:3,spacing:3,justifyItems:"center",children:[(0,o.jsx)(v.J,{as:R.RsK,boxSize:"5",cursor:"pointer",color:(null===(i=h.chatbotEmbedPings)||void 0===i?void 0:i.length)?"blue.400":"gray.400",onClick:()=>{f(h.id),O()}}),(0,o.jsx)(v.J,{as:ee.xpo,boxSize:"5",cursor:"pointer",color:h.isWhatsAppConnected?"green.400":h.selectedPhoneNumber?"orange.400":"gray.400",onClick:()=>{f(h.id),D()}}),(0,o.jsx)(v.J,{as:ej.J,boxSize:"5",cursor:"pointer",color:(null===(s=h.DialpadChatbotConnection)||void 0===s?void 0:s.phoneNumber)?"purple.400":"gray.400",onClick:()=>{f(h.id),F()}}),(0,o.jsx)(v.J,{as:e6.P2y,boxSize:"5",cursor:"pointer",color:h.twilioPhoneNumber?"#F22F46":"gray.400",onClick:()=>{f(h.id),G()},title:"Twilio"}),(0,o.jsx)(v.J,{as:(null==h?void 0:h.slackConnection)?ev.u:ee.w5k,boxSize:"5",color:"gray.400",cursor:"pointer",onClick:()=>{f(h.id),M()}}),(0,o.jsx)(v.J,{as:ee.AGi,boxSize:"5",color:(null==h?void 0:h.telegramConnection)?"#229ED9":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),T()},title:"Telegram"}),(0,o.jsx)(v.J,{as:e7.O8v,boxSize:"5",color:(null==h?void 0:null===(a=h.microsoftTeamsConnections)||void 0===a?void 0:a.length)?"#5B5FC7":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),L()}}),(0,o.jsx)(v.J,{as:ee.sAh,boxSize:"5",color:h.chatbotFacebookMessengerConnection?"blue.500":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),N()}}),(0,o.jsx)(v.J,{as:ee.Zf_,boxSize:"5",color:h.chatbotInstagramConnections.length?"#e1306c":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),U()}}),(0,o.jsx)(v.J,{as:ee.j2d,boxSize:"6",pb:"4px",color:h.chatbotDiscordChannelConnections&&(null===(l=h.chatbotDiscordChannelConnections)||void 0===l?void 0:l.length)>0?"#7289da":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),_()}}),(null==p?void 0:null===(d=p.data)||void 0===d?void 0:null===(c=d.user)||void 0===c?void 0:null===(r=c.email)||void 0===r?void 0:r.endsWith("@wonderchat.io"))&&(0,o.jsx)(v.J,{as:ee.SRX,boxSize:"5",color:(null===(u=h.chatbotNylasConnections)||void 0===u?void 0:u.length)>0?"purple.500":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),B()}}),(0,o.jsx)(eO.q,{boxSize:"5",color:h.retellAgentId?"blue.400":"gray.400",cursor:"pointer",onClick:()=>{f(h.id),W()}})]})]}),(0,o.jsx)(q.i,{}),(0,o.jsxs)(m.k,{justify:"space-between",gap:2,children:[(0,o.jsx)(z.z,{size:"sm",colorScheme:"brand",variant:"outline",flex:1,isDisabled:!e8(h,null==p?void 0:p.data),onClick:()=>{J.push("/agents/settings/".concat(h.id))},children:"Edit"}),(0,o.jsxs)(eB.v,{children:[(0,o.jsx)(eJ.j,{as:eq.h,icon:(0,o.jsx)(R.$Pu,{}),size:"sm"}),(0,o.jsxs)(eH.q,{children:[(0,o.jsxs)(eQ.s,{isDisabled:"ENABLED"!==h.chatbotState,onClick:()=>
1J.push("/preview/".concat(h.id)),children:[(0,o.jsx)(v.J,{as:R.rDJ,mr:"2"}),"View Chatbot"]}),h.isFrozen&&(0,o.jsxs)(eQ.s,{onClick:()=>er(h),children:[(0,o.jsx)(v.J,{as:ee.l51,mr:"2"}),"Unfreeze Chatbot"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{H(),f(h.id)},children:[(0,o.jsx)(v.J,{as:R.xqv,mr:"2"}),"Embed to website"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{f(h.id),eo()},children:[(0,o.jsx)(v.J,{as:R.WY8,mr:"2"}),"Manage team"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{h&&Q.mutate({chatbotId:h.id,isPrivate:!h.isPrivate})},children:[h.isPrivate?(0,o.jsx)(ez.Q,{mr:"2"}):(0,o.jsx)(eI.m,{mr:"2"}),"Make chatbot ".concat(h.isPrivate?"public":"private")]}),"SHARED"===g?(0,o.jsxs)(eQ.s,{onClick:()=>{K.mutate({chatbotId:h.id})},children:[(0,o.jsx)(v.J,{as:R.xqh,mr:"2"}),"Leave chatbot team"]}):(0,o.jsxs)(eQ.s,{onClick:()=>{et(),f(h.id)},color:"red.500",children:[(0,o.jsx)(eD.p,{mr:"2"}),"Delete chatbot"]})]})]})]}),h.TeamMember.length+h.TeamInvitation.length>0?(0,o.jsxs)(z.z,{size:"sm",variant:"ghost",leftIcon:(0,o.jsx)(v.J,{as:R.WY8}),onClick:()=>{f(h.id),eo()},children:[h.TeamMember.length+h.TeamInvitation.length+1," ","members"]}):(0,o.jsx)(z.z,{size:"sm",variant:"ghost",leftIcon:(0,o.jsx)(v.J,{as:R.zy7}),onClick:()=>{f(h.id),Y()},children:"Invite member"})]})})})}function tn(e){var t,n,o,i,s,a,l,r;return!!e&&(null!==(s=null===(t=e.TeamMember)||void 0===t?void 0:t.length)&&void 0!==s?s:0)+(null!==(a=null===(n=e.TeamInvitation)||void 0===n?void 0:n.length)&&void 0!==a?a:0)+1<(0,P.iP)(null!==(l=e.owner.subscriptionType)&&void 0!==l?l:"NONE",e.owner.extraSeats)+(null!==(r=null===(i=e.owner.addons)||void 0===i?void 0:null===(o=i.find(e=>"SEATS"===e.name))||void 0===o?void 0:o.quantity)&&void 0!==r?r:0)}function to(){var e,t,n,l,r,c,f,S,k,w,W,q,U,B,J,$,ei,eu,ef,to,ti,ts,ta,tl,tr,tc,td,tu,th,tg,tp,tx,tm,tb,tv,tj,tf,ty,tC,tS,tk,tw,tE,tI,tA,tO,tz,tD,tM,tT,tR,tL,tN,t_,tP,tW,tF;let tG=(0,u.p)(),tq=(0,e4.useSession)(),tU=(0,e9.useRouter)(),tB=(0,D.NL)();(0,T.useContext)(e2.Z);let[tJ,tH]=(0,T.useState)(!1),[tQ,tY]=(0,T.useState)("info"),[tV,tZ]=(0,T.useState)([]),[tX,t$]=(0,T.useState)(null),[tK,t0]=(0,T.useState)(null),[t1,t5]=(0,T.useState)("UPLOAD_FILE"),[t2,t4]=(0,T.useState)(0),[t9,t3]=(0,T.useState)(0),[t7,t6]=(0,T.useState)(0),[t8,ne]=(0,T.useState)(!1),{data:nt}=d.S.user.getUserFeatureFlags.useQuery(),nn=(0,e3.U0)(),no=d.S.useUtils(),{data:ni,refetch:ns}=d.S.teams.getPendingInvitations.useQuery(),na=d.S.teams.acceptInvitation.useMutation({onSuccess:()=>{io(),ns()}}),nl=d.S.teams.rejectInvitation.useMutation({onSuccess:()=>{io(),ns()}}),{onClose:nr,onOpen:nc,isOpen:nd}=(0,eY.q)(),{onClose:nu,onOpen:nh,isOpen:ng}=(0,eY.q)(),np=()=>{null==nn||nn.capture("create bot modal opened"),nc()},{onClose:nx,onOpen:nm,isOpen:nb}=(0,eY.q)(),{onClose:nv,onOpen:nj,isOpen:nf}=(0,eY.q)(),{onClose:ny,onOpen:nC,isOpen:nS}=(0,eY.q)(),{onClose:nk,onOpen:nw,isOpen:nE}=(0,eY.q)(),{onClose:nI,onOpen:nA,isOpen:nO}=(0,eY.q)(),{onClose:nz,onOpen:nD,isOpen:nM}=(0,eY.q)(),{onClose:nT,onOpen:nR,isOpen:nL}=(0,eY.q)(),{onClose:nN,onOpen:n_,isOpen:nP}=(0,eY.q)(),{onClose:nW,onOpen:nF,isOpen:nG}=(0,eY.q)(),{onClose:nq,onOpen:nU,isOpen:nB}=(0,eY.q)(),{onClose:nJ,onOpen:nH,isOpen:nQ}=(0,eY.q)(),{onClose:nY,onOpen:nV,isOpen:nZ}=(0,eY.q)(),{onClose:nX,onOpen:n$,isOpen:nK}=(0,eY.q)(),{onClose:n0,onOpen:n1,isOpen:n5}=(0,eY.q)(),{onClose:n2,onOpen:n4,isOpen:n9}=(0,eY.q)(),{onClose:n3,onOpen:n7,isOpen:n6}=(0,eY.q)(),{onClose:n8,onOpen:oe,isOpen:ot}=(0,eY.q)(),{onClose:on,onOpen:oo,isOpen:oi}=(0,eY.q)(),{onClose:os,onOpen:oa,isOpen:ol}=(0,eY.q)(),{onClose:or,onOpen:oc,isOpen:od}=(0,eY.q)(),{onClose:ou,onOpen:oh,isOpen:og}=(0,eY.q)(),{onClose:op,onOpen:ox,isOpen:om}=(0,eY.q)(),{onClose:ob,onOpen:ov,isOpen:oj}=(0,eY.q)(),{onClose:of,onOpen:oy,isOpen:oC}=(0,eY.q)(),{onClose:oS,onOpen:ok,isOpen:ow}=(0,eY.q)(),{onClose:oE,onOpen:oI,isOpen:oA}=(0,eY.q)(),{onClose:oO,onOpen:oz,isOpen:oD}=(0,eY.q)(),{onClose:oM,onOpen:oT,isOpen:oR}=(0,eY.q)(),{onClose:oL,onOpen:oN,isOpen:o_}=(0,eY.q)(),{onClose:oP,onOpen:oW,isOpen:oF}=(0,eY.q)(),{onClose:oG,onOpen:oq,isOpen:oU}=(0,eY.q)(),{onClose:oB,onOpen:oJ,isOpen:oH}=(0,eY.q)(),{onClose:oQ,onOpen:oY,isOpen:oV}=(0,eY.q)(),{onClose:oZ,onOpen:oX,isOpen:o$}=(0,eY.q)(),{onClose:oK,onOpen:o0,isOpen:o1}=(0,eY.q)(),{onClose:o5,onOpen:o2,isOpen:o4}=(0,eY.q)(),{isLoading:o9,data:o3,isError:o7,refetch:o6}=d.S.chatbot.getChatbots.useQuery(void 0,{refetchInterval:e=>!!(e&&e.some(e=>"REINDEXING"===e.chatbotState||"CREATING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState))&&1e4}),{isLoading:o8,data:ie,isError:it,refetch:io}=d.S.chatbot.getSharedChatbots.useQuery(void 0,{refetchInterval:e=>!!(e&&e.some(e=>"REINDEXING"===e.chatbotState||"CREATING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState))&&1e4}),ii=(0,T.useMemo)(()=>o3&&o3.length>0,[o3]),is=(0,T.useMemo)(()=>ii?t2:1,[ii,t2]),ia=(0,T.useMemo)(()=>te[is],[is]),il=(0,T.useMemo)(()=>{var e,t;return!o9&&!o8&&(null!==(e=null==o3?void 0:o3.length)&&void 0!==e?e:0)===0&&(null!==(t=null==ie?void 0:ie.length)&&void 0!==t?t:0)===0&&!(ni&&ni.length>0)},[o9,o8,o3,ie,ni]),ir=(0,T.useMemo)(()=>{var e;return tK&&null!==(e=[...null!=o3?o3:[],...null!=ie?ie:[]].find(e=>e.id===tK))&&void 0!==e?e:null},[tK,o3,ie]),ic=d.S.chatbot.thawChatbot.useMutation({onSuccess:(e,t)=>{e.success?(tY("info"),tZ([]),nu(),o6(),io(),no.chatbot.getChatBotPublicQuery.reset({chatbotId:t.chatbotId}
1),tG({title:"Chatbot unfrozen!",description:"Your chatbot has been unfrozen. Please ensure it is enabled to start taking questions.",status:"success",duration:3e3})):(tY("violation"),tZ(e.reasons))},onError:e=>{var t;tY("info"),tZ([]),tG({title:null!==(t=e.message)&&void 0!==t?t:"Failed to unfreeze chatbot",description:"An error occurred while trying to unfreeze the chatbot. Please contact support if the issue persists.",status:"error",duration:3e3})}}),id=e=>{t0(e.id),tY("loading"),nh(),ic.mutate({chatbotId:e.id})},iu=d.S.chatbot.deleteChatbot.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{o6(),io(),nv(),tG({title:"Chatbot deleted",status:"success",duration:1500,isClosable:!0})}}),ih=d.S.crawler.addFilesToChatbot.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{o6(),io(),nq(),tG({title:"Adding files!",description:"We will send you an email when it's done!",status:"success",duration:1500,isClosable:!0})}}),ig=d.S.crawler.deleteFilesFromChatbot.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{o6(),io(),nq(),tG({title:"Files deleting!",status:"success",duration:1500,isClosable:!0})}}),ip=d.S.crawler.addWebpageToChatbot.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{o6(),io(),nW(),tG({title:"Webpages adding!",status:"success",duration:1500,isClosable:!0})}}),ix=d.S.crawler.deleteWebpageFromChatbot.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{o6(),io(),nW(),tG({title:"Webpages deleting!",status:"success",duration:1500,isClosable:!0})}}),im=d.S.teams.deleteTeamMember.useMutation({onError:e=>{console.log(e)},onSuccess:e=>{nX(),tG({title:"Removed ".concat(e.deletedEmail," from ").concat(e.chatbotName,"!"),status:"success",duration:1500,isClosable:!0}),o6()}}),ib=d.S.chatbot.duplicateChatbot.useMutation({onError:e=>
1{console.log(e),tG({title:"".concat(e),status:"error",duration:1500,isClosable:!0})},onSuccess:e=>{o6(),tG({title:"Duplicating chatbot!",status:"success",duration:1500,isClosable:!0})}}),iv=d.S.workspaces.addChatbotToWorkspace.useMutation({onError:e=>{console.log(e),tG({title:"Failed to move chatbot to team",description:e.message,status:"error",duration:3e3,isClosable:!0})},onSuccess:()=>{o6(),io(),oZ(),tG({title:"Chatbot moved to team successfully!",status:"success",duration:3e3,isClosable:!0})}}),ij=d.S.teams.leaveTeam.useMutation({onError:e=>{console.log(e),tG({title:"".concat(e),status:"error",duration:1500,isClosable:!0})},onSuccess:e=>{io(),tG({title:"Left the chatbot team",status:"success",duration:1500,isClosable:!0})}}),iy=d.S.chatbot.updateChatbotState.useMutation({onError:e=>{var t;tG({title:null!==(t=e.message)&&void 0!==t?t:String(e),status:"error",duration:1500,isClosable:!0})},onSuccess:e=>{o6(),io(),tG({title:"Updated chatbot state!",status:"success",duration:1500,isClosable:!0})},onSettled:()=>{n2()}}),iC=d.S.chatbot.updateChatbotIsPrivate.useMutation({onError:e=>{var t;tG({title:null!==(t=e.message)&&void 0!==t?t:String(e),status:"error",duration:1500,isClosable:!0})},onSuccess:e=>{o6(),io(),tG({title:"Made chatbot ".concat(e?"private":"public","!"),status:"success",duration:1500,isClosable:!0})},onSettled:()=>{n2()}}),iS=d.S.teams.updateTeamMemberRole.useMutation({onSuccess:e=>{let{email:t,newRole:n}=e,o=(0,M.Ol)(d.S.chatbot.getChatbots,void 0,"query");tB.setQueryData(o,e=>{if(e){let i=e.find(e=>e.id===tK);if(i){var o;let e=null===(o=i.TeamMember)||void 0===o?void 0:o.find(e=>e.user.email===t);e&&(e.role=n)}return[...e]}}),o6(),tG({status:"success",title:"Updated role of ".concat(t)})},onError:e=>{tG({status:"error",title:e.message})}});(0,T.useEffect)(()=>{var e;(null==tq?void 0:null===(e=tq.data)||void 0===e?void 0:e.user)&&"true"===tU.query.newUser&&!sessionStorage.getItem("signUpEventFired_".concat(tq.data.user.email))&&(dataLayer.push({event:"sign_up",login:{email:tq.data.user.email,sign_up_on:new Date}}),(0,ew.FZ)(ew.KW.signUp,{email:tq.data.user.email}),sessionStorage.setItem("signUpEventFired_".concat(tq.data.user.email),"true"))},[tq,tU.query]),(0,T.useEffect)(()=>{var e,t,n;(null===(e=tq.data)||void 0===e?void 0:e.user)&&("USER"===tq.data.user.highestGoogleWorkspaceType&&"NONE"===tq.data.user.subscriptionType&&t4(1),nn.identify(tq.data.user.id,{email:tq.data.user.email,name:tq.data.user.name,subscription_type:null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.subscriptionType,number_of_messages:tq.data.user.messageQuota,...o3&&{chatbot_names:o3.map(e=>e.name).join(", ")}}))},[tq,o3]),(0,T.useEffect)(()=>{var e,t,n,o,i,s,a,l,r,c,d,u,h,g,p,x,m,b,v,j,f,y,C;if((null==tU?void 0:null===(e=tU.query)||void 0===e?void 0:e.zendeskAuthStatus)==="success"){tG({status:"success",description:'Successfully connected your account to Zendesk! You can now connect your chatbots to Zendesk under "Integrations"'}),tU.push("/");return}if((null==tU?void 0:null===(t=tU.query)||void 0===t?void 0:t.zendeskAuthStatus)==="error"){tG({status:"error",description:"Something went wrong when connecting your account to Zendesk, please try again. If the problem persists, contact us at [email protected]"}),tU.push("/");return}if((null==tU?void 0:null===(n=tU.query)||void 0===n?void 0:n.hubspotAuthStatus)==="success"){tG({status:"success",description:'Successfully connected your account to HubSpot! You can now connect your chatbots to HubSpot under "Integrations"'}),tU.push("/");return}if((null==tU?void 0:null===(o=tU.query)||void 0===o?void 0:o.hubspotAuthStatus)==="error"){tG({status:"error",description:"Something went wrong when connecting your account to HubSpot, please try again. If the problem persists, contact us at [email protected]"}),tU.push("/");return}if((null==tU?void 0:null===(i=tU.query)||void 0===i?void 0:i.googleDriveAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to Google Drive! You can now add files to your chatbots from Google Drive"}),tU.push("/");return}if((null==tU?void 0:null===(s=tU.query)||void 0===s?void 0:s.googleDriveAuthStatus)==="error"&&tG({status:"error",description:"Something went wrong when connecting your account to Google Drive, please try again. If the problem persists, contact us at [email protected]"}),(null==tU?void 0:null===(a=tU.query)||void 0===a?void 0:a.dialpadAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to Dialpad! You can now connect your chatbots to Dialpad under Dashboard > Channels"}),tU.push("/");return}if((null==tU?void 0:null===(l=tU.query)||void 0===l?void 0:l.dialpadAuthStatus)==="error"&&tG({status:"error",description:"Something went wrong when connecting your account to Dialpad please try again. If the problem persists, contact us at [email protected]"}),(null==tU?void 0:null===(r=tU.query)||void 0===r?void 0:r.microsoftSharePointAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to Microsoft SharePoint! You can now add files to your chatbots from your Microsoft SharePoint sites"}),tU.push("/");return}if((null==tU?void 0:null===(c=tU.query)||void 0===c?void 0:c.microsoftSharePointAuthStatus)==="error"&&tG({status:"error",description:(null==tU?void 0:null===(C=tU.query)||void 0===C?void 0:C.errMsg)||"Something went wrong when connecting your account to Microsoft SharePoint, please try again. If the problem persists, contact us at [email protected]"}),(null==tU?void 0:null===(d=tU.query)||void 0===d?void 0:d.googleWorksp
1aceAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to Google Workspace! You can now use your Google Workspace roles to control access to your chatbots!"}),tU.push("/");return}if((null==tU?void 0:null===(u=tU.query)||void 0===u?void 0:u.googleWorkspaceAuthStatus)==="error"&&tG({status:"error",description:"Something went wrong when connecting your account to Google Workspace, please try again. If the problem persists, contact us at [email protected]"}),(null==tU?void 0:null===(h=tU.query)||void 0===h?void 0:h.slackAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to Slack! You can now connect your chatbots to your Slack workspace under Settings > Integrations"}),tU.push("/");return}if((null===(g=tU.query)||void 0===g?void 0:g.slackAuthStatus)==="alreadyExists"){tG({status:"error",description:"This slack workspace has already been connected to an account on Wonderchat. If this is unexpected, please contact us at [email protected]"}),tU.push("/");return}if((null==tU?void 0:null===(p=tU.query)||void 0===p?void 0:p.slackAuthStatus)==="reconnected"){tG({status:"success",description:"Slack workspace reconnected. Any newly approved scopes are now active."}),tU.push("/");return}if((null==tU?void 0:null===(x=tU.query)||void 0===x?void 0:x.slackAuthStatus)==="reconnectMismatch"){tG({status:"error",description:"Reconnect failed: you authorized a different Slack workspace than the one you were reconnecting. Please try again and select the same workspace."}),tU.push("/");return}if((null==tU?void 0:null===(m=tU.query)||void 0===m?void 0:m.slackAuthStatus)==="error"){tG({status:"error",description:"Something went wrong when connecting your account to Slack, please try again. If the problem persists, contact us at [email protected]"}),tU.push("/");return}if((null==tU?void 0:null===(b=tU.query)||void 0===b?void 0:b.shopifyAuthStatus)==="success"){tG({status:"success",description:"Successfully connected your account to your Shopify Store! You can now connect your chatbots to your Shopify store under Settings > Integrations"}),tU.push("/");return}if((null==tU?void 0:null===(v=tU.query)||void 0===v?void 0:v.shopifyAuthStatus)==="already_exists")tG({status:"error",description:"Your Shopify Store has already been connected to your Wonderchat account. Please go to Settings > Integrations > Shopify to connect your store to an existing chatbot"});else if((null==tU?void 0:null===(j=tU.query)||void 0===j?void 0:j.shopifyAuthStatus)==="error"){tG({status:"error",description:"Something went wrong when connecting your account to Shopify, please try again. If the problem persists, contact us at [email protected]"}),tU.push("/");return}else if((null==tU?void 0:null===(f=tU.query)||void 0===f?void 0:f.shopifyAuthStatus)==="requires_upgrade"){tG({status:"error",description:"Shopify Integration is only available on the ".concat((0,ek.Vo)("TOOLS_SHOPIFY")," Plan and above. Please upgrade your plan to use the Shopify Integration!")}),tU.push("/");return}(null==tU?void 0:null===(y=tU.query)||void 0===y?void 0:y.action)==="create_chatbot"&&np()},[tU.query]);let ik=(null===(t=tq.data)||void 0===t?void 0:null===(e=t.user)||void 0===e?void 0:e.role)!=="ADMIN"&&(null!==(tL=null==o3?void 0:o3.length)&&void 0!==tL?tL:0)>=(0,P.Fu)(null!==(tN=(null===(l=tq.data)||void 0===l?void 0:null===(n=l.workspace)||void 0===n?void 0:n.subscriptionType)||(null===(c=tq.data)||void 0===c?void 0:null===(r=c.user)||void 0===r?void 0:r.subscriptionType))&&void 0!==tN?tN:"NONE",null!==(t_=null===(S=tq.data)||void 0===S?void 0:null===(f=S.workspace)||void 0===f?void 0:f.ownerCreatedAt)&&void 0!==t_?t_:null===(w=tq.data)||void 0===w?void 0:null===(k=w.user)||void 0===k?void 0:k.createdAt,null===(q=tq.data)||void 0===q?void 0:null===(W=q.user)||void 0===W?void 0:W.extraRecurringBots)+(null!==(tP=null===(J=tq.data)||void 0===J?void 0:null===(B=J.user)||void 0===B?void 0:null===(U=B.addons)||void 0===U?void 0:U.reduce((e,t)=>{if("BOT_CAPACITY"===t.name){var n;return e+(null!==(n=null==t?void 0:t.quantity)&&void 0!==n?n:0)}return e},0))&&void 0!==tP?tP:0)||"loading"===tq.status;return(0,o.jsxs)(b.xu,{py:"2",px:"8",children:[(0,o.jsxs)(m.k,{children:[(0,o.jsx)(j.x,{layerStyle:"header",flex:1,children:"Agents"}),(0,o.jsxs)(O.U,{spacing:3,children:[(!(null===(eu=tq.data)||void 0===eu?void 0:null===(ei=eu.user)||void 0===ei?void 0:null===($=ei.email)||void 0===$?void 0:$.endsWith("@supportninja.com"))||(null==tq?void 0:null===(to=tq.data)||void 0===to?void 0:null===(ef=to.user)||void 0===ef?void 0:ef.email)==="[email protected]")&&(0,o.jsx)(eW.u,{label:ik?"You have reached the maximum number of Chatbots for your current plan. If you need more Chatbots, please head to Subscription and upgrade your plan":(null===(ti=tq.data)||void 0===ti?void 0:ti.workspace)&&(null===(ts=tq.data)||void 0===ts?void 0:ts.workspace.myRole)==="MEMBER"?"Only administrators can create chatbots in a team":void 0,children:(0,o.jsxs)(z.z,{isDisabled:ik&&!(null===(tl=tq.data)||void 0===tl?void 0:null===(ta=tl.user)||void 0===ta?void 0:ta.enableOverage)||"loading"===tq.status||!!(null===(tr=tq.data)||void 0===tr?void 0:tr.workspace)&&(null===(tc=tq.data)||void 0===tc?void 0:tc.workspace.myRole)==="MEMBER",colorScheme:"brand",onClick:()=>{var e,t,n,o;if((null===(t=tq.data)||void 0===t?void 0:null===(e=t.user)||void 0===e?void 0:e.enableOverage)&&ik&&!localStorage.getItem("shouldNotShowOverageChatbotModal")){n1();return}dataLayer.push({event:"create_bot_clicked",data:{email:null==tq?void 0:null===(o=tq.data)||void 0===o?void 0:null===(n=o.user)||void 0===n?void 0:n.email}}),np(),t0(null)},children:[(0,o.jsx)(b.xu,{as:"span",mr:"2",fontSize:"20px",alignItems:"center",justifyContent:"center",display:"flex",children:(0,o.jsx)(R.OvN,{})}),"Create Agent"]})}),(null===(td=tq.data)||void 0===td?void 0:td.workspace)&&(0,o.jsx)(eW.u,{label:"Move your personal chatbots to this team",children:(0,o.jsxs)(z.z,{isDisabled:!1,color:"white",bgColor:"blue.500",_hover:{bgColor:"blue.600"},onClick:()=>{oX()},children:[(0,o.jsx)(b.xu,{as:"span",mr:"2",fontSize:"16px",alignItems:"center",justifyContent:"center",display:"flex",children:(0,o.jsx)(R.zy7,{})}),"Move to Team"]})})]})]}),((null==tq?void 0:null===(th=tq.data)||void 0===th?void 0:null===(tu=th.user)||void 0===tu?void 0:tu.highestGoogleWorksp
1aceType)!=="USER"||(null===(tp=tq.data)||void 0===tp?void 0:null===(tg=tp.user)||void 0===tg?void 0:tg.subscriptionType)!=="NONE")&&!(null===(tx=tq.data)||void 0===tx?void 0:tx.workspace)&&ii&&(0,o.jsx)(eV.m,{variant:"solid-rounded",size:"sm",index:t2,onChange:e=>{(0===e||1===e)&&t4(e)},children:(0,o.jsxs)(eZ.t,{bgColor:"gray.200",display:"flex",w:"max-content",borderRadius:"full",p:"1",children:[(0,o.jsx)(eX.O,{_selected:{shadow:"md",bg:"white",color:"black"},children:"Personal"}),(0,o.jsx)(eX.O,{_selected:{shadow:"md",bg:"white",color:"black"},ml:"2",children:"Shared with me"})]})}),(0,o.jsx)(b.xu,{pb:"4"}),(0,o.jsx)(b.xu,{bgColor:"white",borderRadius:"12px",border:"1px solid",borderColor:"gray.100",overflow:"hidden",display:{base:"none",lg:"block"},children:il?(0,o.jsx)(Z,{onCreate:np}):(0,o.jsx)(eC.y,{isLoading:"MINE"===ia?o9:o8,data:"MINE"===ia?null!=o3?o3:[]:null!=ie?ie:[],columns:[{key:"chatbotState",header:"Status",styleProps:{width:"100px",textAlign:"center",px:1},render:e=>{let{chatbotState:t}=e;if("CREATING"===t||"REINDEXING"===t||"ADDING"===t||"DELETING"===t){let e=(0,eE.Mp)(t.toLowerCase());return"ADDING"===t?e+=" to":"DELETING"===t&&(e+=" from"),(0,o.jsxs)(m.k,{alignItems:"center",justifyContent:"center",flexDir:"column",gap:1,children:[(0,o.jsx)(I.$,{h:4,w:4}),(0,o.jsx)(j.x,{children:"".concat(e," bot...")})]})}return e.isFrozen?(0,o.jsx)(eW.u,{label:"This chatbot is frozen due to plan limits. Click to learn more.",children:(0,o.jsxs)(m.k,{align:"center",justify:"center",gap:2,cursor:"pointer",onClick:()=>{t0(e.id),nh()},children:[(0,o.jsx)(j.x,{fontSize:"sm",color:"blue.500",children:"Frozen"}),(0,o.jsx)(v.J,{color:"blue.400",as:ee.l51})]})}):"ERROR"===t?(0,o.jsx)(b.xu,{layerStyle:"regularImportant",display:"flex",alignItems:"center",children:(0,o.jsx)(eW.u,{label:"Something went wrong when creating your bot. Please try deleting this chatbot and recreating a new one. Contact support if problem still persists.",children:(0,o.jsxs)(m.k,{alignItems:"center",mx:"auto",children:[(0,o.jsx)(j.x,{children:"Error"}),(0,o.jsx)(v.J,{color:"red",ml:2,as:R.BJv})]})})}):(0,o.jsx)(eF.r,{colorScheme:"green",isChecked:"ENABLED"===e.chatbotState,onChange:t=>{"ENABLED"===e.chatbotState?(t0(e.id),n4()):iy.mutate({chatbotId:e.id,newState:"ENABLED"})}})}},{key:"name",header:"Bot name",styleProps:{minWidth:"330px"},render:e=>(0,o.jsxs)(m.k,{flexDir:"row",alignItems:"center",layerStyle:"regularImportant",children:[(0,o.jsx)(es.E,{borderRadius:"8px",alt:"Bot display picture",boxSize:"45px",src:e.pictureUrl?e.pictureUrl:P.rD,mr:"4"}),(0,o.jsxs)(m.k,{flexDir:"column",alignItems:"flex-start",children:[(0,o.jsxs)(b.xu,{sx:{"& > *":{display:"inline",verticalAlign:"middle"}},children:[(0,o.jsx)(b.xu,{fontSize:"md",fontWeight:"semibold",color:"blue.500",_hover:{textDecoration:"underline"},children:(0,o.jsx)(eh(),{href:"/agents/settings/".concat(e.id),children:e.name})}),(0,o.jsxs)(b.xu,{ml:1,verticalAlign:"middle",display:"inline",children:[e.isPrivate&&(0,o.jsx)(eW.u,{label:"Private chatbots are only visible to you and your team members",children:(0,o.jsx)(eI.m,{color:"gray.500",boxSize:3,verticalAlign:"middle",ml:1})}),e.TeamMember.length+e.TeamInvitation.length>0?(0,o.jsx)(z.z,{onClick:()=>{t0(e.id),n$()},variant:"link",leftIcon:(0,o.jsx)(v.J,{as:R.WY8}),iconSpacing:.5,fontSize:"sm",verticalAlign:"middle",display:"inline-flex",children:e.TeamMember.length+e.TeamInvitation.length+1}):(0,o.jsx)(z.z,{onClick:()=>{t0(e.id),nH()},variant:"link",leftIcon:(0,o.jsx)(v.J,{as:R.zy7}),verticalAlign:"middle",display:"inline-flex"})]})]}),e.internalDescription?(0,o.jsx)(j.x,{fontSize:"sm",color:"gray.500",fontWeight:"light",children:e.internalDescription}):(0,o.jsx)(j.x,{color:"gray.500",children:e.role.split("_").map(e=>(0,eE.Mp)(e.toLowerCase())).join(" ")})]})]})},..."SHARED"===ia?[{key:"owner",header:"Messages remaining",render:e=>(0,o.jsx)(j.x,{color:"gray.500",children:e.owner.messageQuota})}]:[],{key:"webpagesCount",header:"Pages crawled",render:e=>{var t,n,i,s,a,l,r,c,d,u,h,g,p,x;return(0,o.jsxs)(b.xu,{display:"flex",alignItems:"center",children:[(0,o.jsx)(eW.u,{label:"Last updated: ".concat((0,K.Z)(e.updatedAt,"MMMM d, yyyy")),placement:"top",children:(0,o.jsx)(eG.r,{onClick:()=>{nC(),t0(e.id)},color:"blue.500",children:e.webpagesCount})}),("MINE"===ia?(new Date((null==tq?void 0:null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.createdAt)||new Date)>new Date(P._l)?P.aP[e.owner.subscriptionType]+(null!==(h=null==tq?void 0:null===(s=tq.data)||void 0===s?void 0:null===(i=s.user)||void 0===i?void 0:i.extraPageCapacity)&&void 0!==h?h:0):P.Mj[e.owner.subscriptionType]+(null!==(g=null==tq?void 0:null===(l=tq.data)||void 0===l?void 0:null===(a=l.user)||void 0===a?void 0:a.extraPageCapacity)&&void 0!==g?g:0))<=e.webpagesCount:(new Date(e.owner.createdAt||new Date)>new Date(P._l)?P.aP[e.owner.subscriptionType]+(null!==(p=null==tq?void 0:null===(c=tq.data)||void 0===c?void 0:null===(r=c.user)||void 0===r?void 0:r.extraPageCapacity)&&void 0!==p?p:0):P.Mj[e.owner.subscriptionType]+(null!==(x=null==tq?void 0:null===(u=tq.data)||void 0===u?void 0:null===(d=u.user)||void 0===d?void 0:d.extraPageCapacity)&&void 0!==x?x:0))<=e.webpagesCount)&&(0,o.jsx)(eW.u,{label:"You have reached the maximum number of pages indexed for your current plan. Your chatbot will only have knowledge to answer from the indexed pages",children:(0,o.jsx)(m.k,{children:(0,o.jsx)(v.J,{color:"red",ml:2,as:R.BJv})})}),(0,o.jsx)(m.k,{flex:1}),(0,o.jsxs)(O.U,{children:[(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eA.d,{}),"aria-label":"Edit chatbot pages",onClick:()=>{nF(),t0(e.id)},isDisabled:"CREATING"===e.chatbotState||"REINDEXING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState||!e8(e,null==tq?void 0:tq.data)}),(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eM.n,{}),"aria-label":"Reindex chatbot",onClick:()=>{nD(),t0(e.id)},isDisabled:"CREATING"===e.chatbotState||"REINDEXING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState||!e8(e,null==tq?void 0:tq.data)})]})]})}},{key:"filesCount",header:"Files indexed",render:e=>(0,o.jsxs)(b.xu,{display:"flex",alignItems:"center",children:[(0,o.jsx)(eG.r,{onClick:()=>{nw(),t0(e.id)},color:"blue.500",children:e.filesCount}),(0,o.jsx)(m.k,{flex:1}),(0,o.jsxs)(O.U,{children:[(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eA.d,{}),"aria-label":"Add file to chatbot",onClick:()=>{t0(e.id),nU()},isDisabled:"CREATING"===e.chatbotState||"REINDEXING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState||!e8(e,null==tq?void 0:tq.data)}),(0,o.jsx)(eq.h,{size:"xs",icon:(0,o.jsx)(eM.n,{}),"aria-label":"Reindex google drive for chatbot",onClick:()=>{nR(),t0(e.id)},isDisabled:"CREATING"===e.chatbotState||"REINDEXING"===e.chatbotState||"ADDING"===e.chatbotState||"DELETING"===e.chatbotState||!e8(e,null==tq?void 0:tq.data)})]})]})},{key:"colorTheme",header:"Channels",render:e=>{var t,n,i,s,a,l,r,c;return(0,o.jsxs)(eU.M,{columns:4,spacing:3,maxW:"130px",minW:"100px",children:[(0,o.jsx)(v.J,{as:R.RsK,boxSize:"5",cursor:"pointer",color:(null===(t=e.chatbotEmbedPings)||void 0===t?void 0:t.length)?"blue.400":"gray.400",onClick:()=>{t0(e.id),oI()}}),(0,o.jsx)(v.J,{as:ee.xpo,boxSize:"5",cursor:"pointer",color:e.isWhatsAppConnected?"green.400":e.selectedPhoneNumber?"orange.400":"gray.400",onClick:()=>{t0(e.id),n7()}}),(0,o.jsx)(v.J,{as:ej.J,boxSize:"5",cursor:"pointer",color:(null===(n=e.DialpadChatbotConnection)||void 0===n?void 0:n.phoneNumber)?"purple.400":"gray.400",onClick:()=>{t0(e.id),oe()}}),(0,o.jsx)(v.J,{as:e6.P2y,boxSize:"5",cursor:"pointer",color:e.twilioPhoneNumber?"#F22F46":"gray.400",onClick:()=>{t0(e.id),oo()},title:"Twilio"}),(0,o.jsx)(v.J,{as:(null==e?void 0:e.slackConnection)?ev.u:ee.w5k,boxSize:"5",color:"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oz()}}),(0,o.jsx)(v.J,{as:ee.AGi,boxSize:"5",color:(null==e?void 0:e.telegramConnection)?"#229ED9":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oT()},title:"Telegram"}),(0,o.jsx)(v.J,{as:e7.O8v,boxSize:"5",color:(null==e?void 0:null===(i=e.microsoftTeamsConnections)||void 0===i?void 0:i.length)?"#5B5FC7":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oN()}}),(0,o.jsx)(v.J,{as:ee.sAh,boxSize:"5",color:e.chatbotFacebookMessengerConnection?"blue.500":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oW()}}),(0,o.jsx)(v.J,{as:ee.Zf_,boxSize:"5",color:e.chatbotInstagramConnections.length?"#e1306c":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oq()}}),(0,o.jsx)(v.J,{as:ee.j2d,boxSize:"6",pb:"4px",color:e.chatbotDiscordChannelConnections&&(null===(s=e.chatbotDiscordChannelConnections)||void 0===s?void 0:s.length)>0?"#7289da":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oJ()}}),(null==tq?void 0:null===(r=tq.data)||void 0===r?void 0:null===(l=r.user)||void 0===l?void 0:null===(a=l.email)||void 0===a?void 0:a.endsWith("@wonderchat.io"))&&(0,o.jsx)(v.J,{as:ee.SRX,boxSize:"5",color:(null===(c=e.chatbotNylasConnections)||void 0===c?void 0:c.length)>0?"purple.500":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),oY()}}),(0,o.jsx)(eO.q,{boxSize:"5",color:e.retellAgentId?"blue.400":"gray.400",cursor:"pointer",onClick:()=>{t0(e.id),ok()}})]})}},{key:"tags",header:"Tools",render:e=>(0,o.jsx)(m.k,{w:"full",textAlign:"center",flexDir:"row",gap:3,children:(0,o.jsx)(eG.r,{w:"full",color:"blue.500",onClick:()=>{tU.push("/agents/settings/".concat(e.id,"?tab=tools"))},children:e.totalActionsCount})})},{key:"id",header:"Actions",render:e=>{var t,n,i;return(0,o.jsxs)(eB.v,{children:[(0,o.jsxs)(m.k,{children:[(0,o.jsx)(z.z,{size:"sm",fontWeight:"medium",borderRightRadius:0,variant:"outline",isDisabled:!e8(e,null==tq?void 0:tq.data),onClick:()=>{tU.push("/agents/settings/".concat(e.id))},children:"Edit"}),(0,o.jsx)(eJ.j,{borderLeftRadius:0,size:"sm",as:z.z,verticalAlign:"middle",variant:"outline",border:"1px solid",borderColor:"border.strong",borderLeftWidth:0,boxShadow:"inset 0 -1px 0 0 rgba(10, 13, 18, 0.05), 0 1px 2px 0 rgba(10, 13, 18, 0.05)",children:(0,o.jsx)(v.J,{as:R.$Pu,mt:"2"})})]}),(0,o.jsxs)(eH.q,{children:[(0,o.jsxs)(eQ.s,{isDisabled:"ENABLED"!==e.chatbotState,onClick:()=>tU.push("/preview/".concat(e.id)),children:[(0,o.jsx)(v.J,{as:R.rDJ,mr:"2"}),"View Chatbot"]}),e.isFrozen&&(0,o.jsxs)(eQ.s,{onClick:()=>id(e),children:[(0,o.jsx)(v.J,{as:ee.l51,mr:"2"}),"Unfreeze Chatbot"]}),(0,o.jsxs)(eQ.s,{isDisabled:!e8(e,null==tq?void 0:tq.data),onClick:()=>{tU.push("/agents/settings/".concat(e.id))},children:[(0,o.jsx)(eA.d,{mr:"2"}),"Edit Chatbot"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{nm(),t0(e.id)},children:[(0,o.jsx)(v.J,{as:R.xqv,mr:"2"}),"Embed to website"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{oI(),t0(e.id)},children:[(0,o.jsx)(v.J,{as:R.RsK,mr:"2"}),"View embedded sites"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{t0(e.id),n$()},children:[(0,o.jsx)(v.J,{as:R.WY8,mr:"2"}),"Manage team"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{e&&iC.mutate({chatbotId:e.id,isPrivate:!e.isPrivate})},children:[e.isPrivate?(0,o.jsx)(ez.Q,{mr:"2"}):(0,o.jsx)(eI.m,{mr:"2"}),"Make chatbot ".concat(e.isPrivate?"public":"private")]}),!(null==tq?void 0:null===(t=tq.data)||void 0===t?void 0:t.workspace)&&(0,o.jsxs)(eQ.s,{onClick:()=>{tn(e)?nH():nV(),t0(e.id)},isDisabled:"SHARED"===ia,children:[(0,o.jsx)(v.J,{as:R.zy7,mr:"2"}),"Invite team member"]}),(0,o.jsxs)(eQ.s,{onClick:async()=>{var t,n,o,i,s,a;await navigator.clipboard.writeText("".concat(window.location.origin,"/preview/").concat(e.id)),null==nn||nn.capture(eS._X.bot_shared,(0,eS.D7)({event:eS._X.bot_shared,accountContext:{accountId:null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.id,email:null===(i=tq.data)||void 0===i?void 0:null===(o=i.user)||void 0===o?void 0:o.email,plan:null===(a=tq.data)||void 0===a?void 0:null===(s=a.user)||void 0===s?void 0:s.subscriptionType},properties:{share_type:"link",bot_id:e.id}})),tG({title:"Chatbot link copied to clipboard",description:"You can share this link with your users!",status:"success",duration:1500,isClosable:!0})},children:[(0,o.jsx)(v.J,{as:R.XKb,mr:"2"}),"Share link to chatbot"]}),(0,o.jsxs)(eQ.s,{onClick:async()=>{try{await navigator.clipboard.writeText(e.id),tG({status:"success",description:"Copied to clipboard!"})}catch(e){}},children:[(0,o.jsx)(v.J,{as:R.j4u,mr:"2"}),"Copy Chatbot ID"]}),("MINE"===ia||e8(e,null==tq?void 0:tq.data))&&(0,o.jsxs)(eQ.s,{isDisabled:e.isFrozen||"MINE"===ia&&ik&&!(null==tq?void 0:null===(i=tq.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.enableOverage),onClick:()=>{var t,n;"MINE"===ia&&ik&&(null==tq?void 0:null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.enableOverage)?(n1(),t0(e.id)):(t0(e.id),o2())},children:[(0,o.jsx)(eT.T,{mr:"2"}),"Duplicate chatbot"]}),"MINE"===ia&&(0,o.jsxs)(eQ.s,{isDisabled:e.isFrozen,onClick:()=>{t0(e.id),o0()},children:[(0,o.jsx)(v.J,{as:R.xqv,mr:"2"}),"Copy Settings"]}),"SHARED"===ia&&(0,o.jsxs)(eQ.s,{onClick:()=>{ij.mutate({chatbotId:e.id})},children:[(0,o.jsx)(v.J,{as:R.xqh,mr:"2"}),"Leave chatbot team"]}),(0,o.jsxs)(eQ.s,{onClick:()=>{nj(),t0(e.id)},color:"red.500",isDisabled:"SHARED"===ia,children:[(0,o.jsx)(eD.p,{mr:"2"}),"Delete chatbot"]})]})]})}}],extraRows:(0,o.jsx)(o.Fragment,{children:ni&&(null==ni?void 0:ni.length)>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e$.Tr,{children:(0,o.jsx)(eK.Td,{colSpan:7,px:0,py:2,children:(0,o.jsxs)(m.k,{align:"center",px:4,children:[(0,o.jsx)(j.x,{fontWeight:"medium",fontSize:"sm",children:"Pending Invitations"}),(0,o.jsx)(e0.C,{ml:2,w:"16px",h:"16px",alignItems:"center",justifyContent:"center",colorScheme:"yellow",variant:"solid",borderRadius:"full",p:"0",display:"flex",fontSize:"10px",children:null==ni?void 0:ni.length})]})})}),ni.map((e,t)=>(0,o.jsxs)(e$.Tr,{children:[(0,o.jsx)(eK.Td,{children:(0,o.jsxs)(m.k,{flexDir:"row",alignItems:"center",layerStyle:"regularImportant",children:[(0,o.jsx)(es.E,{borderRadius:"full",borderColor:"gray",alt:"Bot display picture",boxSize:"45px",src:e.chatbot.pictureUrl?e.chatbot.pictureUrl:P.rD,mr:"4"}),(0,o.jsxs)(m.k,{flexDir:"column",alignItems:"flex-start",children:[(0,o.jsx)(m.k,{alignItems:"center",children:(0,o.jsx)(eh(),{href:"/preview/".concat(e.chatbot.id),children:(0,o.jsx)(b.xu,{fontSize:"md",fontWeight:"semibold",color:"blue.500",_hover:{textDecoration:"underline"},children:e.chatbot.name})})}),(0,o.jsx)(j.x,{color:"gray.500",children:e.chatbot.role.split("_").map(e=>(0,eE.Mp)(e.toLowerCase())).join(" ")})]})]},e.id)}),(0,o.jsx)(eK.Td,{children:"-"}),(0,o.jsx)(eK.Td,{children:(0,o.jsx)(e0.C,{colorScheme:"yellow",children:"Pending"})}),(0,o.jsx)(eK.Td,{children:"-"}),(0,o.jsx)(eK.Td,{children:"-"}),(0,o.jsx)(eK.Td,{children:(0,o.jsxs)(m.k,{children:[(0,o.jsx)(z.z,{size:"sm",colorScheme:"green",onClick:()=>{na.mutate({invitationId:e.id})},children:"Accept"}),(0,o.jsx)(z.z,{size:"sm",colorScheme:"red",variant:"ghost",ml:2,onClick:()=>{nl.mutate({invitationId:e.id})},children:"Decline"})]})})]},t))]})})})}),(0,o.jsx)(b.xu,{display:{base:"block",lg:"none"},children:("MINE"===ia?o9:o8)?(0,o.jsx)(m.k,{justify:"center",py:8,children:(0,o.jsx)(I.$,{size:"lg"})}):(0,o.jsxs)(o.Fragment,{children:[ni&&(null==ni?void 0:ni.length)>0&&(0,o.jsxs)(C.g,{spacing:4,mb:6,children:[(0,o.jsxs)(m.k,{align:"center",gap:2,children:[(0,o.jsx)(j.x,{fontWeight:"medium",fontSize:"sm",children:"Pending Invitations"}),(0,o.jsx)(e0.C,{colorScheme:"yellow",variant:"solid",borderRadius:"full",fontSize:"10px",children:null==ni?void 0:ni.length})]}),ni.map(e=>(0,o.jsx)(eN.Z,{size:"sm",variant:"outline",w:"full",children:(0,o.jsx)(e_.e,{p:4,children:(0,o.jsxs)(eP.K,{spacing:3,children:[(0,o.jsxs)(m.k,{align:"center",gap:3,children:[(0,o.jsx)(es.E,{borderRadius:"full",borderColor:"gray",alt:"Bot display picture",boxSize:"40px",src:e.chatbot.pictureUrl||P.rD}),(0,o.jsxs)(b.xu,{flex:1,minW:0,children:[(0,o.jsx)(eh(),{href:"/preview/".concat(e.chatbot.id),children:(0,o.jsx)(j.x,{fontSize:"md",fontWeight:"semibold",color:"blue.500",_hover:{textDecoration:"underline"},noOfLines:1,children:e.chatbot.name})}),(0,o.jsx)(j.x,{color:"gray.500",fontSize:"sm",children:e.chatbot.role.split("_").map(e=>(0,eE.Mp)(e.toLowerCase())).join(" ")})]}),(0,o.jsx)(e0.C,{colorScheme:"yellow",children:"Pending"})]}),(0,o.jsxs)(m.k,{justify:"space-between",gap:2,children:[(0,o.jsx)(z.z,{size:"sm",colorScheme:"green",flex:1,onClick:()=>{na.mutate({invitationId:e.id})},child
1ren:"Accept"}),(0,o.jsx)(z.z,{size:"sm",colorScheme:"red",variant:"ghost",flex:1,onClick:()=>{nl.mutate({invitationId:e.id})},children:"Decline"})]})]})})},e.id))]}),il?(0,o.jsx)(Z,{onCreate:np}):(0,o.jsx)(eU.M,{columns:1,spacing:4,children:("MINE"===ia?null!=o3?o3:[]:null!=ie?ie:[]).map(e=>(0,o.jsx)(tt,{chatbot:e,chatbotDisplayType:ia,session:tq,onOpenDisableBot:n4,setEditingChatbotId:t0,updateChatbotStateMutation:iy,onOpenUrlList:nC,onOpenBotEditPages:nF,onOpenBotReindex:nD,onOpenFileList:nw,onOpenBotEditFiles:nU,onOpenGoogleDriveReindex:nR,onOpenEmbeddedSites:oI,onOpenWhatsappIntegration:n7,onOpenSlackConnection:oz,onOpenTelegramConnection:oT,onOpenTeamsConnection:oN,onOpenFacebookMessengerIntegration:oW,onOpenDiscordIntegration:oJ,onOpenInstagramIntegration:oq,onOpenEmailIntegration:oY,onOpenPhonecallIntegration:ok,onOpenDialpadIntegration:oe,onOpenTwilioIntegration:oo,router:tU,onOpenEmbed:nm,updateChatbotIsPrivateMutation:iC,onOpenInviteTeamMember:nH,onOpenTeamMemberLimitReached:nV,toast:tG,onOpenOverageBotMessage:n1,duplicateChatbotMutation:ib,leaveChatbotMutation:ij,onOpenDelete:nj,isBotLimitReached:ik,onOpenViewTeamMember:n$,onOpenCopySettings:o0,onOpenDuplicateChatbot:o2,onOpenFrozenChatbot:nh,onUnfreezeChatbot:id},e.id))})]})}),(0,o.jsx)(N.m,{isOpen:nd,onClose:nr,onSuccess:e=>{o6(),io(),nr(),t$(e),nA()}}),(0,o.jsx)(eb.A,{isOpen:nb,onClose:nx,chatbot:ir}),(0,o.jsxs)(h.u_,{isOpen:nf,onClose:nv,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{children:[(0,o.jsxs)(x.x,{children:["Are you sure you want to delete ",null==ir?void 0:ir.name,"?"]}),(0,o.jsx)(y.f,{layerStyle:"regularImportant",children:"This operation cannot be reversed, and you will lose your bot's training data along with all chatlogs associated with the bot"}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[(0,o.jsx)(z.z,{isLoading:iu.isLoading,onClick:nv,children:"Close"}),(0,o.jsxs)(z.z,{colorScheme:"red",onClick:()=>{(null==ir?void 0:ir.id)&&iu.mutate({chatbotId:null==ir?void 0:ir.id})},isLoading:iu.isLoading,children:[(0,o.jsx)(v.J,{as:R.BJv,mr:"2"}),"Confirm"]})]})})]})]}),(0,o.jsxs)(h.u_,{isOpen:ng,onClose:()=>{tY("info"),tZ([]),nu()},scrollBehavior:"inside",children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxW:"450px",children:[(0,o.jsx)(x.x,{children:(0,o.jsxs)(m.k,{alignItems:"center",gap:2,children:[(0,o.jsx)(v.J,{as:ee.l51,color:"blue.400"}),(0,o.jsx)(j.x,{children:"loading"===tQ?"Unfreezing Chatbot":"violation"===tQ?"Cannot Unfreeze Chatbot":"Frozen Chatbot"})]})}),(0,o.jsx)(y.f,{minH:"350px",display:"flex",flexDirection:"column",children:"loading"===tQ?(0,o.jsx)(m.k,{justify:"center",align:"center",flex:1,children:(0,o.jsxs)(C.g,{spacing:4,children:[(0,o.jsx)(I.$,{size:"lg",color:"blue.400"}),(0,o.jsx)(j.x,{children:"Checking if chatbot can be unfrozen..."})]})}):"violation"===tQ?(0,o.jsxs)(C.g,{alignItems:"flex-start",spacing:4,children:[(0,o.jsx)(j.x,{children:"This chatbot cannot be unfrozen right now because doing so would exceed your current plan's limits."}),(0,o.jsx)(e1.QI,{spacing:2,pl:2,children:tV.map((e,t)=>(0,o.jsx)(e1.HC,{children:e},t))}),(0,o.jsxs)(j.x,{children:["Modify your chatbot's usage based on the exceeded limits, or disable unused features. If you still need these features, consider"," ",(0,o.jsx)(eG.r,{as:eh(),href:"/subscription",color:"blue.500",fontWeight:"semibold",children:"upgrading your plan"}),"."]})]}):(0,o.jsxs)(C.g,{alignItems:"flex-start",spacing:4,children:[(0,o.jsx)(j.x,{children:"This chatbot has been frozen because your current plan doesn't support all the features or usage levels it requires. This usually happens after a plan downgrade."}),(0,o.jsx)(j.x,{children:"To unfreeze it:"}),(0,o.jsxs)(e1.QI,{spacing:2,pl:2,children:[(0,o.jsx)(e1.HC,{children:"Click Unfreeze Chatbot below to see which limits are being exceeded. Adjust your chatbot's usage accordingly (for example, remove pages or team members, or delete unused chatbots), then try unfreezing it again."}),(0,o.jsxs)(e1.HC,{children:["Alternatively,"," ",(0,o.jsx)(eG.r,{as:eh(),href:"/subscription",color:"blue.500",fontWeight:"semibold",children:"upgrade your plan"})," ","to get higher limits."]})]})]})}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[(0,o.jsx)(z.z,{variant:"ghost",onClick:()=>{tY("info"),tZ([]),nu()},children:"Close"}),"loading"!==tQ&&(0,o.jsx)(z.z,{colorScheme:"blue",onClick:()=>{ir&&(tY("loading"),ic.mutate({chatbotId:ir.id}))},children:"violation"===tQ?"Try Again":"Unfreeze Chatbot"})]})})]})]}),(0,o.jsx)(ex.Z,{isOpen:nS,onClose:ny,editingChatbot:ir}),(0,o.jsx)(et,{isOpen:nE,onClose:nk,editingChatbot:ir}),(0,o.jsxs)(h.u_,{isOpen:nK,onClose:nX,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{children:[(0,o.jsx)(x.x,{children:"Members of ".concat(null==ir?void 0:ir.name)}),(0,o.jsx)(y.f,{children:(0,o.jsx)(b.xu,{maxH:"60vh",overflowY:"auto",fontSize:"sm",children:(0,o.jsx)(eC.y,{data:[...(null==ir?void 0:ir.owner)?[{...null==ir?void 0:ir.owner,role:"OWNER",isInvited:!1}]:[],...null!==(tW=null==ir?void 0:null===(tm=ir.TeamMember)||void 0===tm?void 0:tm.map(e=>{let{user:t,role:n}=e;return{...t,role:n,isInvited:!1}}))&&void 0!==tW?tW:[],...null!==(tF=null==ir?void 0:ir.TeamInvitation.map(e=>{let{invitedEmail:t}=e;return{email:t,name:"",image:"",role:"MEMBER",isInvited:!0}}))&&void 0!==tF?tF:[]],columns:[{key:"name",header:"Name",render:e=>{var t,n;return(0,o.jsxs)(m.k,{flexDir:"row",alignItems:"center",layerStyle:"regularImportant",children:[(0,o.jsx)(es.E,{borderRadius:"full",borderColor:"gray",alt:"Bot display picture",boxSize:"30px",src:e.image?e.image:P.rD,mr:"4"}),(0,o.jsxs)(m.k,{flexDir:"column",children:[(0,o.jsx)(m.k,{flexDir:"row",children:"OWNER"===e.role?(0,o.jsx)(e0.C,{colorScheme:"blue",children:"Owner"}):e.isInvited?(0,o.jsx)(e0.C,{colorScheme:"orange",children:"Invited"}):(0,o.jsx)(o.Fragment,{children:(null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.email)===(null==ir?void 0:ir.owner.email)?(0,o.jsxs)(eB.v,{children:[(0,o.jsx)(eJ.j,{as:z.z,cursor:"pointer",size:"xs",variant:"outline",borderWidth:"1px",children:(0,o.jsxs)(m.k,{flexDir:"row",justifyContent:"center",alignItems:"center",children:[e.role,(0,o.jsx)(eR.v,{boxSize:"16px"})]})}),(0,o.jsx)(eH.q,{children:Object.keys(e5.TeamMemberRole).map(t=>(0,o.jsxs)(eQ.s,{isDisabled:t===e.role,onClick:()=>{tK&&e.email&&iS.mutate({chatbotId:tK,newRole:t,email:e.email})},children:[(0,eE.Mp)(t),t===e.role&&(0,o.jsx)(eL.n,{ml:"auto"})]},t))})]}):(0,o.jsx)(e0.C,{colorScheme:"ADMIN"===e.role?"orange":"green",children:(0,o.jsx)(m.k,{flexDir:"row",justifyContent:"center",alignItems:"center",children:e.role})})})}),(0,o.jsx)(j.x,{children:e.email})]})]})}},{key:"email",header:"Actions",render:e=>{var t,n;return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(eq.h,{isDisabled:(null===(n=tq.data)||void 0===n?void 0:null===(t=n.user)||void 0===t?void 0:t.email)!==(null==ir?void 0:ir.owner.email)||"OWNER"===e.role,size:"xs","aria-label":"Delete team member",icon:(0,o.jsx)(eD.p,{}),colorScheme:"red",onClick:()=>{ir&&e.email&&im.mutate({chatbotId:ir.id,userEmail:e.email})}})})}}]})})}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[!(null==tq?void 0:null===(tb=tq.data)||void 0===tb?void 0:tb.workspace)&&(null===(tj=tq.data)||void 0===tj?void 0:null===(tv=tj.user)||void 0===tv?void 0:tv.email)===(null==ir?void 0:ir.owner.email)&&(0,o.jsx)(z.z,{colorScheme:"blue",leftIcon:(0,o.jsx)(v.J,{as:R.zy7}),onClick:()=>{tn(ir)?(nX(),nH()):(nX(),nV())},children:"Invite team member"}),(0,o.jsx)(z.z,{onClick:nX,children:"Close"})]})})]})]}),(0,o.jsxs)(h.u_,{isOpen:nO,onClose:nI,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxW:"450px",children:[(0,o.jsxs)(y.f,{display:"flex",flexDir:"column",children:[(0,o.jsx)(es.E,{src:"bot-creating.jpeg",alt:"Bot Creating",mt:"78px"}),(0,o.jsxs)(b.xu,{textAlign:"center",alignSelf:"center",py:4,children:[(0,o.jsxs)(j.x,{layerStyle:"header",fontSize:"16px",mt:4,children:["We will email you at"," ",(0,o.jsx)(j.x,{as:"u",children:null==tq?void 0:null===(ty=tq.data)||void 0===ty?void 0:null===(tf=ty.user)||void 0===tf?void 0:tf.email})," when your Chatbot is ready!"]}),(0,o.jsx)(j.x,{layerStyle:"subText",mt:4,children:"More pages may take longer to load. Please be patient."})]}),(0,o.jsxs)(j.x,{layerStyle:"subText",textAlign:"center",fontSize:"14px",children:["See more"," ",(0,o.jsx)(z.z,{variant:"link",fontSize:"14px",colorScheme:"brand",onClick:()=>{null!==tX&&tU.push("/agents/settings/".concat(tX))},children:"advanced settings"})," ","for your Chatbot."]})]}),(0,o.jsx)(A.m,{children:(0,o.jsx)(O.U,{children:(0,o.jsx)(z.z,{colorScheme:"brand",onClick:nI,children:"Close"})})})]})]}),(0,o.jsx)(er.Q,{isOpen:nM,onClose:nz,chatbot:ir,dailyRecrawlEnabled:!!(null==ir?void 0:null===(tS=ir.owner)||void 0===tS?void 0:null===(tC=tS.EnabledFeatureFlags)||void 0===tC?void 0:tC.find(e=>"DAILY_RECRAWL"===e.featureName))||!!(null==nt?void 0:nt.find(e=>{let{featureName:t}=e;return"DAILY_RECRAWL"===t}))}),(0,o.jsx)(a.b,{isOpen:oA,onClose:oE,chatbot:ir}),(0,o.jsx)(ec.W,{isOpen:nL,onClose:nT,chatbot:ir,onOpen:nR,dailyRecrawlEnabled:!!(null==ir?void 0:null===(tw=ir.owner)||void 0===tw?void 0:null===(tk=tw.EnabledFeatureFlags)||void 0===tk?void 0:tk.find(e=>"DAILY_RECRAWL"===e.featureName))||!!(null==nt?void 0:nt.find(e=>{let{featureName:t}=e;return"DAILY_RECRAWL"===t}))}),(0,o.jsx)(ed.P,{isOpen:nP,onClose:nN,chatbot:ir,dailyRecrawlEnabled:!!(null==ir?void 0:null===(tI=ir.owner)||void 0===tI?void 0:null===(tE=tI.EnabledFeatureFlags)||void 0===tE?void 0:tE.find(e=>"DAILY_RECRAWL"===e.featureName))||!!(null==nt?void 0:nt.find(e=>{let{featureName:t}=e;return"DAILY_RECRAWL"===t}))}),(0,o.jsxs)(h.u_,{isOpen:n5,onClose:n0,children:[(0,o.jsx)(g.Z,{}),(0,o.jsxs)(p.h,{maxW:"450px",children:[(0,o.jsx)(x.x,{children:(0,o.jsx)(j.x,{layerStyle:"header",fontSize:"16px",mt:4,children:"You have reached the bot limit for your plan"})}),(0,o.jsx)(y.f,{display:"flex",flexDir:"column",fontSize:"14px",children:(0,o.jsxs)(C.g,{alignItems:"flex-start",children:[(0,o.jsxs)(j.x,{children:["Would you like to proceed and create an additional chatbot? Additional chatbots will be charged at a rate of"," ",(0,o.jsx)("strong",{children:"$".concat((null==tq?void 0:null===(tz=tq.data)||void 0===tz?void 0:null===(tO=tz.user)||void 0===tO?void 0:null===(tA=tO.email)||void 0===tA?void 0:tA.endsWith("@bauerundguse.de"))?"39.99":(null==tq?void 0:null===(tT=tq.data)||void 0===tT?void 0:null===(tM=tT.user)||void 0===tM?void 0:null===(tD=tM.email)||void 0===tD?void 0:tD.endsWith("supportninja.com"))?P.tr:"49.99"," per chatbot")}),", billed at the end of the month."]}),(0,o.jsx)(b.xu,{}),(0,o.jsx)(E.X,{isChecked:tJ,onChange:()=>tH(e=>!e),children:(0,o.jsx)(j.x,{fontSize:"14px",children:"Do not show this message again"})})]})}),(0,o.jsx)(A.m,{children:(0,o.jsxs)(O.U,{children:[(0,o.jsx)(z.z,{onClick:()=>{n0()},children:"Close"}),(0,o.jsx)(z.z,{colorScheme:"brand",onClick:()=>{localStorage.setItem("shouldNotShowOverageChatbotModal","1"),n0(),tK?o2():np()},children:"Confirm"})]})})]})]}),(0,o.jsx)(Y.$,{isOpen:nG,onClose:nW,onOpen:nF,chatbot:ir,isLoading:ip.isLoading||ix.isLoading,onSubmit:e=>{let{type:t,sessionCookie:n,saveSessionCookie:o,useJavascriptCrawler:i}=e;if(ir){if("ADD"===t)ip.mutate({chatbotId:ir.id,knowledgeBases:e.knowledgeBases,sessionCookie:n,saveSessionCookie:o,useJavascriptCrawler:i});else if("DELETE"===t){let t=e.pages.map(e=>e.trim()).filter(e=>!!e);ix.mutate({chatbotId:ir.id,urls:t})}}},tabIndex:t9,setTabIndex:t3}),(0,o.jsx)(Q.Z,{isOpen:nB,onClose:nq,onOpen:nU,chatbot:ir,tabIndex:t7,setTabIndex:t6,initialAddFileType:t1,isLoading:ig.isLoading||ih.isLoading,onSubmitDelete:e=>{if(!e||0===e.length){tG({title:"Please select some files to delete",status:"error"});return}ir&&ig.mutate({fileNames:e,chatbotId:null==ir?void 0:ir.id})},onSubmitAdd:e=>{ir&&ih.mutate({knowledgeBases:e,chatbotId:null==ir?void 0:ir.id})}}),ir&&(0,o.jsx)(eo.b,{chatbotMode:"fixed",fixedChatbot:ir,isOpen:nQ,onClose:nJ,onSuccess:()=>{o6(),io(),nJ(),tG({title:"Team member invited!",status:"success",duration:1500,isClosable:!0})}}),(0,o.jsx)(eg,{isOpen:nZ,onClose:nY,onOpen:nV,chatbot:ir}),(0,o.jsx)(F,{isOpen:n9,onClose:n2,onOpen:n4,chatbot:ir,isLoading:iy.isLoading,onSubmit:e=>{ir&&iy.mutate({chatbotId:ir.id,chatbotDisabledMessage:e,newState:"DISABLED"})}}),(0,o.jsx)(em.f,{isOpen:n6,onClose:n3,onOpen:n7,chatbot:ir}),(0,o.jsx)(_.y,{isOpen:ot,onClose:n8,onOpen:oe,chatbot:ir}),(0,o.jsx)(ep.U,{isOpen:oi,onClose:on,chatbot:ir}),(0,o.jsx)(el.f,{isOpen:ow,onClose:oS,onOpen:ok,chatbot:ir}),(0,o.jsx)(i.m,{isOpen:oD,onClose:oO,chatbot:ir}),(0,o.jsx)(s.P,{isOpen:oR,onClose:oM,chatbot:ir}),(0,o.jsx)(ey.H,{isOpen:o_,onClose:oL,initialChatbot:ir}),(0,o.jsx)(X.Q,{isOpen:oF,onClose:oP,chatbotId:tK||""}),(0,o.jsx)(en.A,{isOpen:oU,onClose:oG,chatbotId:tK||""}),(0,o.jsx)(G.M,{isOpen:oH,onClose:oB,chatbotId:tK||""}),(0,o.jsx)(V.J,{isOpen:oV,onClose:oQ,chatbotId:tK||""}),(0,o.jsx)(ea,{isOpen:o$,onClose:oZ,currentWorkspace:null===(tR=tq.data)||void 0===tR?void 0:tR.workspace,onMoveChatbot:e=>{var t,n;(null===(n=tq.data)||void 0===n?void 0:null===(t=n.workspace)||void 0===t?void 0:t.id)&&iv.mutate({workspaceId:tq.data.workspace.id,chatbotId:e})},isLoading:iv.isLoading}),(0,o.jsx)(L,{isOpen:o1,onClose:oK,targetChatbotId:tK||"",targetChatbotName:(null==ir?void 0:ir.name)||""}),(0,o.jsx)(H,{isOpen:o4,onClose:o5,chatbotId:tK||"",chatbotName:(null==ir?void 0:ir.name)||"",onSuccess:()=>{o6(),io()}})]})}var ti=(0,ef.Q)(to)},88435:function(e,t,n){"use strict";n.d(t,{Nj:function(){return l},an:function(){return c},Lt:function(){return d},iH:function(){return r},Ux:function(){return a},Mz:function(){return s}});let o=e=>void 0===e?"":e.replace(/^https?:\/\//,"");var i=n(34155);let s=(e,t)=>e?t:o(i.env.VERCEL_URL||"https://app.wonderchat.io"),a=()=>{var e;let t=window.location.host.match(/^([a-z0-9-]+)\.wonderchat\.io$/i),n=null==t?void 0:null===(e=t[1])||void 0===e?void 0:e.toLowerCase();return n&&"app"!==n?"®ion=".concat(n):""};function l(e,t){let{customHeaderCss:n,customContainerCss:o}=t,i=[{className:"widget-header",value:n},{className:"widget-container",value:o}].filter(e=>!!e.value);return 0===i.length?"":"WIDGET"===e?'\n data-custom-css="'.concat(i.map(e=>".".concat(e.className," ").concat(e.value)).join(" "),'"'):"WIDGET_ANTI_STRIP"===e?'\n wcs.setAttribute("data-custom-css", "'.concat(i.map(e=>".".concat(e.className," ").concat(e.value)).join(" "),'")'):"PAGE"===e?"customCss=".concat(encodeURIComponent(i.map(e=>".".concat(e.className," ").concat(e.value)).join(" "))):void 0}let r=e=>{var t;let{isWhitelabelled:n,chatbotId:s,dataAddress:a,widgetButtonSize:r,widgetSize:c,widgetEmbedDisplayType:d,urlsToIgnore:u,isWidgetMovableChecked:h,widgetOffsetBottom:g,widgetOffsetRight:p,widgetOffsetBottomMobile:x,widgetOffsetRightMobile:m,isCssCustomizationChecked:b,customHeaderCss:v,customContainerCss:j,passphrase:f,identityVerificationSecret:y,deviceVisibility:C,placement:S="right",isInitialOpen:k,initialOpenUrls:w,language:E,isSeoWidget:I,dataHidden:A}=e;return'<script\n src="'.concat(((null===(t=i.env.VERCEL_URL||"https://app.wonderchat.io")||void 0===t?void 0:t.startsWith("https"))?"https":"http")+"://".concat(n?a:o(i.env.VERCEL_URL||"https://app.wonderchat.io")),"/scripts/").concat(I?"wonderchat-seo":n?"chatbot":"wonderchat",'.js"\n data-name="').concat(I?"wonderchat-seo":n?"chatbot-widget-script":"wonderchat",'"\n data-address="').concat(n?a:o(i.env.VERCEL_URL||"https://app.wonderchat.io"),'"\n data-id="').concat(s,'"\n data-widget-size="').concat(c,'"\n data-widget-button-size="').concat(r,'"').concat(E?'\n data-language="'.concat(E,'"'):"").concat(u&&"HIDE_FOR_URLS"===d?'\n data-ignore-paths="'.concat(u.split("\n").join(","),'"'):"").concat(u&&"SHOW_FOR_URLS"===d?'\n data-show-paths="'.concat(u.split("\n").join(","),'"'):"").concat(h?'\n data-movable="true"':"").concat(g&&"0"!==g?'\n data-widget-offset-bottom="'.concat(g,'px"'):"").concat(p&&"0"!==p?"\n data-widget-offset-".concat("left"===S?"left":"right",'="').concat(p,'px"'):"").concat(m&&"0"!==m?"\n data-widget-offset-".concat("left"===S?"left":"right",'-mobile="').concat(m,'px"'):"").concat(x&&"0"!==x?'\n data-widget-offset-bottom-mobile="'.concat(x,'px"'):"").concat(b?l("WIDGET",{customContainerCss:j,customHeaderCss:v}):"").concat(f?'\n data-passphrase="'.concat(f,'"'):"").concat(y?'\n data-identity-t
1oken="REPLACE_WITH_SERVER_GENERATED_JWT"':"","\n ").concat(C&&"both"!==C?'\n data-device-visibility="'.concat(C,'"'):"").concat("right"!==S?'\n data-placement="'.concat(S,'"'):"").concat(k?'\n data-initial-open="true"':"").concat(k&&w?'\n data-initial-open-urls="'.concat(w.split("\n").join(","),'"'):"").concat(A?'\n data-hidden="true"':""," defer\n ></script>")},c=e=>{var t;let{isWhitelabelled:n,chatbotId:o,dataAddress:a,widgetButtonSize:l,widgetSize:r,widgetEmbedDisplayType:c,urlsToIgnore:d,isWidgetMovableChecked:u,widgetOffsetBottom:h,widgetOffsetRight:g,widgetOffsetBottomMobile:p,widgetOffsetRightMobile:x,isCssCustomizationChecked:m,customHeaderCss:b,customContainerCss:v,passphrase:j,identityVerificationSecret:f,deviceVisibility:y,placement:C="right",isInitialOpen:S,initialOpenUrls:k,language:w,isSeoWidget:E,dataHidden:I}=e,A=s(n,a),O=(null===(t=i.env.VERCEL_URL||"https://app.wonderchat.io")||void 0===t?void 0:t.startsWith("https"))?"https":"http",z="".concat(O,"://").concat(A,"/scripts/").concat(E?"wonderchat-seo":n?"chatbot":"wonderchat",".js"),D={id:o,address:A};if(r&&(D.widgetSize=r),l&&(D.widgetButtonSize=l),w&&(D.language=w),d&&"HIDE_FOR_URLS"===c&&(D.ignorePaths=d.split("\n").join(",")),d&&"SHOW_FOR_URLS"===c&&(D.showPaths=d.split("\n").join(",")),u&&(D.movable="true"),h&&"0"!==h&&(D.widgetOffsetBottom="".concat(h,"px")),g&&"0"!==g&&(D["left"===C?"widgetOffsetLeft":"widgetOffsetRight"]="".concat(g,"px")),p&&"0"!==p&&(D.widgetOffsetBottomMobile="".concat(p,"px")),x&&"0"!==x&&(D["left"===C?"widgetOffsetLeftMobile":"widgetOffsetRightMobile"]="".concat(x,"px")),m){let e=[{className:"widget-header",value:b},{className:"widget-container",value:v}].filter(e=>!!e.value).map(e=>".".concat(e.className," ").concat(e.value)).join(" ");e&&(D.customCss=e)}j&&(D.passphrase=j),f&&(D.identityToken="REPLACE_WITH_SERVER_GENERATED_JWT"),y&&"both"!==y&&(D.deviceVisibility=y),"right"!==C&&(D.placement=C),S&&(D.initialOpen="true"),S&&k&&(D.initialOpenUrls=k.split("\n").join(",")),I&&(D.hidden="true");let M=Object.entries(D).map(e=>{let[t,n]=e;return" ".concat(t,": ").concat(JSON.stringify(n))}).join(",\n");return"<script>\n(function () {\n window.wonderchatSettings = {\n".concat(M,'\n };\n var s = document.createElement("script");\n s.src = ').concat(JSON.stringify(z),";\n s.defer = true;\n document.body.appendChild(s);\n})();\n</script>")},d=e=>{var t;let{isWhitelabelled:n,chatbotId:s,dataAddress:a,searchText:l,aiAnswerText:r,questionPrefixText:c,followUpQuestionText:d,enableKeywordSearch:u,showSuggestedQuestions:h,searchbarDisplayMode:g,showResetButton:p,showEmailHandoverButton:x,collectLeadInfo:m}=e;return'<script src="'.concat(((null===(t=i.env.VERCEL_URL||"https://app.wonderchat.io")||void 0===t?void 0:t.startsWith("https"))?"https":"http")+"://".concat(n?a:o(i.env.VERCEL_URL||"https://app.wonderchat.io")),'/scripts/wonderchat-searchbar.js"\n chatbotId="').concat(s,'"').concat(l?'\nsearchText="'.concat(l,'"'):"").concat(r?'\nuseAiToAnswerYourQuestionText="'.concat(r,'"'):"").concat(c?'\ncanYouTellMeAboutText="'.concat(c,'"'):"").concat(d?'\naskAFollowUpQuestionText="'.concat(d,'"'):"").concat(u?'\nenableKeywordSearch="'.concat(u,'"'):"").concat(h?'\nshowSuggestedQuestions="true"':"").concat("FLOATING"===g?'\nsearchbarDisplayMode="FLOATING"':"").concat(p?'\nshowResetButton="true"':"").concat(x?'\nshowEmailHandoverButton="true"':"").concat(m?'\ncollectLeadInfo="true"':"","\n >\n </script>")}},89081:function(e,t,n){"use strict";n.d(t,{z:function(){return l}});var o=n(26729),i=n(95591);function s(e,t){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var a=new TextDecoder,l=function(e){function t(){var t;return(t=e.call(this)||this).room=void 0,t.connected=!1,t.isAgentTalking=!1,t.analyzerComponent=void 0,t.captureAudioFrame=void 0,t}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e);var n=t.prototype;return n.startCall=function(e){try{var t=this,n=function(n,o){try{var s=(t.room=new i.du({audioCaptureDefaults:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,deviceId:e.captureDeviceId,sampleRate:e.sampleRate},audioOutput:{deviceId:e.playbackDeviceId}}),t.handleRoomEvents(),t.handleAudioEvents(e),t.handleDataEvents(),Promise.resolve(t.room.connect("wss://retell-ai-4ihahnq7.livekit.cloud",e.accessToken)).then(function(){console.log("connected to room",t.room.name),t.room.localParticipant.setMicrophoneEnabled(!0),t.connected=!0,t.emit("call_started")}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,function(e){t.emit("error","Error starting call"),console.error("Error starting call",e),t.stopCall()});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},n.startAudioPlayback=function(){try{return Promise.resolve(this.room.startAudio()).then(function(){})}catch(e){return Promise.reject(e)}},n.stopCall=function(){var e;
1this.connected&&(this.connected=!1,this.emit("call_ended"),null==(e=this.room)||e.disconnect()),this.isAgentTalking=!1,delete this.room,this.analyzerComponent&&(this.analyzerComponent.cleanup(),delete this.analyzerComponent),this.captureAudioFrame&&(window.cancelAnimationFrame(this.captureAudioFrame),delete this.captureAudioFrame)},n.mute=function(){this.connected&&this.room.localParticipant.setMicrophoneEnabled(!1)},n.unmute=function(){this.connected&&this.room.localParticipant.setMicrophoneEnabled(!0)},n.captureAudioSamples=function(){var e=this;if(this.connected&&this.analyzerComponent){var t=new Float32Array(this.analyzerComponent.analyser.fftSize);this.analyzerComponent.analyser.getFloatTimeDomainData(t),this.emit("audio",t),this.captureAudioFrame=window.requestAnimationFrame(function(){return e.captureAudioSamples()})}},n.handleRoomEvents=function(){var e=this;this.room.on(i.TQ.ParticipantDisconnected,function(t){"server"===(null==t?void 0:t.identity)&&e.stopCall()}),this.room.on(i.TQ.Disconnected,function(){e.connected&&e.stopCall()})},n.handleAudioEvents=function(e){var t=this;this.room.on(i.TQ.TrackSubscribed,function(n,o,s){n.kind===i.fQ.Kind.Audio&&("agent_audio"===o.trackName&&n instanceof i.rl&&e.emitRawAudioSamples&&(t.analyzerComponent=(0,i.OE)(n),t.captureAudioFrame=window.requestAnimationFrame(function(){return t.captureAudioSamples()})),n.attach())})},n.handleDataEvents=function(){var e=this;this.room.on(i.TQ.DataReceived,function(t,n,o,i){try{if("server"!==(null==n?void 0:n.identity))return;var s=a.decode(t),l=JSON.parse(s);"update"===l.event_type?e.emit("update",l):"metadata"===l.event_type?e.emit("metadata",l):"agent_start_talking"===l.event_type?(e.isAgentTalking=!0,e.emit("agent_start_talking")):"agent_stop_talking"===l.event_type&&(e.isAgentTalking=!1,e.emit("agent_stop_talking"))}catch(e){console.error("Error decoding data received",e)}})},t}(o)},73469:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var o=n(67294).useLayoutEffect},2989:function(e,t,n){"use strict";n.d(t,{Q:function(){return o}});var o=(0,n(24027).I)({d:"M19.5,9.5h-.75V6.75A6.751,6.751,0,0,0,5.533,4.811a1.25,1.25,0,1,0,2.395.717A4.251,4.251,0,0,1,16.25,6.75V9a.5.5,0,0,1-.5.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5Z",displayName:"UnlockIcon"})},77640:function(e,t,n){"use strict";n.d(t,{g:function(){return o}});var o=(0,n(24027).I)({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"})},5106:function(e,t,n){"use strict";n.d(t,{r:function(){return o}});var o=(0,n(24027).I)({displayName:"CheckCircleIcon",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})},19754:function(e,t,n){"use strict";n.d(t,{n:function(){return s}});var o=n(24027),i=n(85893),s=(0,o.I)({viewBox:"0 0 14 14",path:(0,i.jsx)("g",{fill:"currentColor",children:(0,i.jsx)("polygon",{points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})})})},47880:function(e,t,n){"use strict";n.d(t,{m:function(){return o}});var o=(0,n(24027).I)({d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5ZM7.75,6.75a4.25,4.25,0,0,1,8.5,0V9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5Z",displayName:"LockIcon"})},47710:function(e,t,n){"use strict";n.d(t,{E:function(){return r},U:function(){return c}});var o=n(25432),i=n(16554),s=n(2169),a=n(67294),l=n(85893),r=(0,i.G)(function(e,t){let{spacing:n="0.5rem",spacingX:i,spacingY:r,children:d,justify:u,direction:h,align:g,className:p,shouldWrapChildren:x,...m}=e,b=(0,a.useMemo)(()=>x?a.Children.map(d,(e,t)=>(0,l.jsx)(c,{children:e},t)):d,[d,x]);return(0,l.jsx)(s.m.div,{ref:t,className:(0,o.cx)("chakra-wrap",p),...m,children:(0,l.jsx)(s.m.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:u,alignItems:g,flexDirection:h,listStyleType:"none",gap:n,columnGap:i,rowGap:r,padding:"0"},children:b})})});r.displayName="Wrap";var c=(0,i.G)(function(e,t){let{className:n,...i}=e;return(0,l.jsx)(s.m.li,{ref:t,__css:{display:"flex",alignItems:"flex-start"}
1,className:(0,o.cx)("chakra-wrap__listitem",n),...i})});c.displayName="WrapItem"},79078:function(e,t,n){"use strict";n.d(t,{r:function(){return a}});var o=n(16554),i=n(2169),s=n(85893),a=(0,o.G)(function(e,t){let{templateAreas:n,gap:o,rowGap:a,columnGap:l,column:r,row:c,autoFlow:d,autoRows:u,templateRows:h,autoColumns:g,templateColumns:p,...x}=e;return(0,s.jsx)(i.m.div,{ref:t,__css:{display:"grid",gridTemplateAreas:n,gridGap:o,gridRowGap:a,gridColumnGap:l,gridAutoColumns:g,gridColumn:r,gridRow:c,gridAutoFlow:d,gridAutoRows:u,gridTemplateRows:h,gridTemplateColumns:p},...x})});a.displayName="Grid"},10429:function(e,t,n){"use strict";n.d(t,{U:function(){return h}});var o=n(52094),i=n(25432),s=n(51526),a=n(97340),l=n(67294),r=n(85893),c=e=>null!=e&&parseInt(e.toString(),10)>0,d={exit:{height:{duration:.2,ease:o.Lj.ease},opacity:{duration:.3,ease:o.Lj.ease}},enter:{height:{duration:.3,ease:o.Lj.ease},opacity:{duration:.4,ease:o.Lj.ease}}},u={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:i,delay:s})=>{var a;return{...e&&{opacity:c(t)?1:0},height:t,transitionEnd:null==i?void 0:i.exit,transition:null!=(a=null==n?void 0:n.exit)?a:o.p$.exit(d.exit,s)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:i,delay:s})=>{var a;return{...e&&{opacity:1},height:t,transitionEnd:null==i?void 0:i.enter,transition:null!=(a=null==n?void 0:n.enter)?a:o.p$.enter(d.enter,s)}}},h=(0,l.forwardRef)((e,t)=>{let{in:n,unmountOnExit:o,animateOpacity:c=!0,startingHeight:d=0,endingHeight:h="auto",style:g,className:p,transition:x,transitionEnd:m,...b}=e,[v,j]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=setTimeout(()=>{j(!0)});return()=>clearTimeout(e)},[]),(0,i.ZK)({condition:Number(d)>0&&!!o,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});let f=parseFloat(d.toString())>0,y={startingHeight:d,endingHeight:h,animateOpacity:c,transition:v?x:{enter:{duration:0}},transitionEnd:{enter:null==m?void 0:m.enter,exit:o?null==m?void 0:m.exit:{...null==m?void 0:m.exit,display:f?"block":"none"}}},C=!o||n,S=n||o?"enter":"exit";return(0,r.jsx)(s.M,{initial:!1,custom:y,children:C&&(0,r.jsx)(a.E.div,{ref:t,...b,className:(0,i.cx)("chakra-collapse",p),style:{overflow:"hidden",display:"block",...g},custom:y,variants:u,initial:!!o&&"exit",animate:S,exit:"exit"})})});h.displayName="Collapse"}},function(e){e.O(0,[2432,6152,5937,5445,260,5970,9570,2013,3415,1827,2260,2832,512,9562,6057,5145,2553,8237,8764,2066,4138,2975,722,6186,4790,8100,9157,717,1471,7620,5389,4971,2052,2888,9774,179],function(){return e(e.s=68038)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.