mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-15 11:47:54 +00:00
1 line
81 KiB
JavaScript
1 line
81 KiB
JavaScript
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[8139],{70575:function(e,t,i){i.d(t,{AP:function(){return c},_J:function(){return h},t5:function(){return f},v_:function(){return g}});var n=i(90819),o=i.n(n),s=i(73193),r=i.n(s),u=i(89933),l=i.n(u),a=i(18232),d=i(43906);function c(e){return v.apply(this,arguments)}function v(){return(v=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/kbase/query/org",{method:"GET",params:r()(r()({},t),{},{client:a.bVn})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){return p.apply(this,arguments)}function p(){return(p=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/kbase/create",{method:"POST",data:r()(r()({},t),{},{client:a.bVn})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(e){return m.apply(this,arguments)}function m(){return(m=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/kbase/update",{method:"POST",data:r()(r()({},t),{},{client:a.bVn})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e){return w.apply(this,arguments)}function w(){return(w=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/kbase/delete",{method:"POST",data:r()(r()({},t),{},{client:a.bVn})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},16491:function(e,t,i){i.d(t,{Wq:function(){return c}});var n=i(90819),o=i.n(n),s=i(73193),r=i.n(s),u=i(89933),l=i.n(u),a=i(18232),d=i(43906);function c(e){return v.apply(this,arguments)}function v(){return(v=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/queue/query/org",{method:"GET",params:r()(r()({},t),{},{client:a.bVn})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},9846:function(e,t,i){var n=i(76711),o=i.n(n),s=i(73193),r=i.n(s),u=i(90819),l=i.n(u),a=i(89933),d=i.n(a),c=i(45332),v=i.n(c),g=i(55567),p=i(39124),f=i(43829),m=i(28619),h=i(22607),w=i(9942),q=i(5321),S=i(48792),b=i(65511),F=i(7956),U=i(43906),y=i(99898),k=i(34353),x=i(44194),C=i(36914),M=i(17817),j=i(18232),T=i(66942),R=i(88192),P=i(85640),I=i(70575),Z=i(31549);t.Z=function(e){var t,i,n=e.type,s=S.A.useForm(),u=v()(s,1)[0],a=(0,U.useIntl)(),c=((0,U.useNavigate)(),(0,m.Z)().translateString),A=(0,P.M)(),K=A.config,L=A.updateConfig,V=(0,w.u)((function(e){return e.currentOrg})),W=(0,x.useState)(),N=v()(W,2),D=N[0],_=N[1],O=(0,x.useState)(),E=v()(O,2),Q=E[0],X=E[1],$=(0,x.useState)(),B=v()($,2),G=B[0],z=B[1],Y=(0,h.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),H=Y.currentRobot,J=Y.setCurrentRobot,ee=(0,C.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),te=ee.currentAgent,ie=ee.setCurrentAgent,ne=(0,M.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),oe=ne.currentWorkgroup,se=ne.setCurrentWorkgroup,re=(0,x.useMemo)((function(){return n===j._X4?{chatType:j.xtN,chatSid:H.uid}:n===j.Njn?{chatType:j.scI,chatSid:te.uid}:n===j.aZD?{chatType:j.vPY,chatSid:oe.uid}:{chatType:j.xtN,chatSid:""}}),[n,H,te,oe]),ue=re.chatType,le=re.chatSid,ae=function(){var e=d()(l()().mark((function e(){var t,i,o,s,r,d,c,v;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:j.QPQ,orgUid:null==V?void 0:V.uid},e.prev=2,e.next=5,(0,I.AP)(t);case 5:i=e.sent,console.log("getKbases response:",t,i),g.yw.destroy(),200===i.code?(c={code:i.code,message:i.message,data:{content:i.data.content.map((function(e){return{uid:e.uid,name:e.name,type:e.type,orgUid:e.orgUid}})),totalElements:i.data.totalElements,totalPages:i.data.totalPages,number:i.data.number}},X(c),n===j._X4&&null!=H&&null!==(o=H.serviceSettings)&&void 0!==o&&o.faqKbUid?v=H.serviceSettings.faqKbUid:n===j.Njn&&null!=te&&null!==(s=te.serviceSettings)&&void 0!==s&&s.faqKbUid?v=te.serviceSettings.faqKbUid:n===j.aZD&&null!=oe&&null!==(r=oe.serviceSettings)&&void 0!==r&&r.faqKbUid?v=oe.serviceSettings.faqKbUid:(null===(d=c.data)||void 0===d||null===(d=d.content)||void 0===d?void 0:d.length)>0&&(v=c.data.content[0].uid),v&&(z(v),u.setFieldValue("faqKbUid",v),de(v))):g.yw.error(i.message),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),g.yw.destroy(),console.error("获取知识库失败:",e.t0),g.yw.error("获取知识库失败");case 16:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(){return e.apply(this,arguments)}}(),de=function(){var e=d()(l()().mark((function e(t){var i,n,o,s,r,d;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||G){e.next=4;break}return console.log("没有选择知识库,无法获取FAQ"),_(void 0),e.abrupt("return");case 4:return g.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),i={pageNumber:0,pageSize:100,orgUid:null==V?void 0:V.uid,kbUid:t||G},e.prev=6,e.next=9,(0,p.pf)(i);case 9:n=e.sent,console.log("getFaqs response:",i,n),g.yw.destroy(),200===n.code?(o={code:n.code,message:n.message,data:{content:n.data.content.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer,kbUid:e.kbUid,orgUid:e.orgUid}})),totalElements:n.data.totalElements,totalPages:n.data.totalPages,number:n.data.number}},_(o),t||G,(s=u.getFieldValue("faqUids")||[]).length>0&&(r=o.data.content.map((function(e){return e.uid})),(d=s.filter((function(e){return r.includes(e)}))).length!==s.length&&u.setFieldValue("faqUids",d))):g.yw.error(n.message),e.next=20;break;case 15:e.prev=15,e.t0=e.catch(6),g.yw.destroy(),console.error("获取FAQ失败:",e.t0),g.yw.error("获取FAQ失败");case 20:case"end":return e.stop()}}),e,null,[[6,15]])})));return function(t){return e.apply(this,arguments)}}();(0,x.useEffect)((function(){null!=V&&V.uid&&ae()}),[null==V?void 0:V.uid,n]),(0,x.useEffect)((function(){var e;if(n===j._X4&&H){var t,i,o,s={showFaqs:null==H||null===(t=H.serviceSettings)||void 0===t?void 0:t.showFaqs,faqKbUid:null==H||null===(i=H.serviceSettings)||void 0===i?void 0:i.faqKbUid,faqUids:(null==H||null===(o=H.serviceSettings)||void 0===o||null===(o=o.faqs)||void 0===o?void 0:o.map((function(e){return e.uid})))||[]};u.setFieldsValue({showFaqs:s.showFaqs,faqKbUid:s.faqKbUid,faqUids:s.faqUids}),e=s.faqKbUid,L(s.showFaqs?r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:680}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}):r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:380}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}))}else if(n===j.Njn&&te){var l,a,d,c={showFaqs:null==te||null===(l=te.serviceSettings)||void 0===l?void 0:l.showFaqs,faqKbUid:null==te||null===(a=te.serviceSettings)||void 0===a?void 0:a.faqKbUid,faqUids:(null==te||null===(d=te.serviceSettings)||void 0===d||null===(d=d.faqs)||void 0===d?void 0:d.map((function(e){return e.uid})))||[]};u.setFieldsValue({showFaqs:c.showFaqs,faqKbUid:c.faqKbUid,faqUids:c.faqUids}),e=c.faqKbUid,L(c.showFaqs?r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:680}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}):r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:380}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}))}else if(n===j.aZD&&oe){var v,g,p,f={showFaqs:null==oe||null===(v=oe.serviceSettings)||void 0===v?void 0:v.showFaqs,faqKbUid:null==oe||null===(g=oe.serviceSettings)||void 0===g?void 0:g.faqKbUid,faqUids:(null==oe||null===(p=oe.serviceSettings)||void 0===p||null===(p=p.faqs)||void 0===p?void 0:p.map((function(e){return e.uid})))||[]};u.setFieldsValue({showFaqs:f.showFaqs,faqKbUid:f.faqKbUid,faqUids:f.faqUids}),e=f.faqKbUid,L(f.showFaqs?r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:680}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}):r()(r()({},K),{},{window:r()(r()({},K.window),{},{width:380}),chatConfig:r()(r()({},K.chatConfig),{},{org:null==V?void 0:V.uid,t:ue,sid:le})}))}e&&e!==G&&(console.log("知识库ID变化,更新FAQ列表:",e),z(e),de(e))}),[H,te,oe,n,ue,le,null==V?void 0:V.uid]);var ce=function(){var e=d()(l()().mark((function e(t){var i,s,u,d,c,v,p,m,h,w,q,S,b,F,U,y,k,x,C,M,P,I,Z,A,K,L,V,W,N,D,_,O,E,Q;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("onFinish",t),e.prev=1,n!==j._X4){e.next=13;break}return v=r()(r()({},H.serviceSettings),{},{showFaqs:t.showFaqs,faqKbUid:t.faqKbUid,faqUids:Array.isArray(t.faqUids)?o()(t.faqUids):[],welcomeFaqUids:null==H||null===(i=H.serviceSettings)||void 0===i||null===(i=i.welcomeFaqs)||void 0===i?void 0:i.map((function(e){return e.uid})),quickFaqUids:null==H||null===(s=H.serviceSettings)||void 0===s||null===(s=s.quickFaqs)||void 0===s?void 0:s.map((function(e){return e.uid})),guessFaqUids:null==H||null===(u=H.serviceSettings)||void 0===u||null===(u=u.guessFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})),hotFaqUids:null==H||null===(d=H.serviceSettings)||void 0===d||null===(d=d.hotFaqs)||void 0===d?void 0:d.map((function(e){return e.uid})),shortcutFaqUids:null==H||null===(c=H.serviceSettings)||void 0===c||null===(c=c.shortcutFaqs)||void 0===c?void 0:c.map((function(e){return e.uid}))}),p=r()(r()({},H),{},{serviceSettings:v}),console.log("robotObject:",p),e.next=8,(0,f.$l)(p);case 8:m=e.sent,console.log("updateRobot response:",m),200===m.code?(g.yw.destroy(),g.yw.success(a.formatMessage({id:"update.success"})),w=r()(r()({},m.data),{},{serviceSettings:r()(r()({},m.data.serviceSettings),{},{faqs:(null===(h=m.data.serviceSettings.faqs)||void 0===h?void 0:h.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer}})))||[]})}),J(w)):(g.yw.destroy(),g.yw.error(m.message)),e.next=33;break;case 13:if(n!==j.Njn){e.next=24;break}return x=r()(r()({},null==te?void 0:te.serviceSettings),{},{showFaqs:t.showFaqs,faqKbUid:t.faqKbUid,faqUids:Array.isArray(t.faqUids)?o()(t.faqUids):[],welcomeFaqUids:null==H||null===(q=H.serviceSettings)||void 0===q||null===(q=q.welcomeFaqs)||void 0===q?void 0:q.map((function(e){return e.uid})),quickFaqUids:null==H||null===(S=H.serviceSettings)||void 0===S||null===(S=S.quickFaqs)||void 0===S?void 0:S.map((function(e){return e.uid})),guessFaqUids:null==te||null===(b=te.serviceSettings)||void 0===b||null===(b=b.guessFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),hotFaqUids:null==H||null===(F=H.serviceSettings)||void 0===F||null===(F=F.hotFaqs)||void 0===F?void 0:F.map((function(e){return e.uid})),shortcutFaqUids:null==H||null===(U=H.serviceSettings)||void 0===U||null===(U=U.shortcutFaqs)||void 0===U?void 0:U.map((function(e){return e.uid}))}),C=r()(r()({},te),{},{serviceSettings:x,messageLeaveSettings:r()(r()({},te.messageLeaveSettings),{},{worktimeUids:null==te||null===(y=te.messageLeaveSettings)||void 0===y||null===(y=y.worktimes)||void 0===y?void 0:y.map((function(e){return e.uid}))}),robotSettings:r()(r()({},te.robotSettings),{},{robotUid:null==te||null===(k=te.robotSettings)||void 0===k||null===(k=k.robot)||void 0===k?void 0:k.uid}),autoReplySettings:r()({},te.autoReplySettings)}),console.log("agentObject:",C),e.next=19,(0,T.sE)(C);case 19:M=e.sent,console.log("updateAgent response:",M),200===M.code?(g.yw.destroy(),g.yw.success(a.formatMessage({id:"update.success"})),I=r()(r()({},M.data),{},{serviceSettings:r()(r()({},M.data.serviceSettings),{},{faqs:(null===(P=M.data.serviceSettings.faqs)||void 0===P?void 0:P.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer}})))||[]})}),ie(I)):(g.yw.destroy(),g.yw.error(M.message)),e.next=33;break;case 24:if(n!==j.aZD){e.next=33;break}return D=r()(r()({},oe.serviceSettings),{},{showFaqs:t.showFaqs,faqKbUid:t.faqKbUid,faqUids:Array.isArray(t.faqUids)?o()(t.faqUids):[],welcomeFaqUids:null==H||null===(Z=H.serviceSettings)||void 0===Z||null===(Z=Z.welcomeFaqs)||void 0===Z?void 0:Z.map((function(e){return e.uid})),quickFaqUids:null==H||null===(A=H.serviceSettings)||void 0===A||null===(A=A.quickFaqs)||void 0===A?void 0:A.map((function(e){return e.uid})),guessFaqUids:null==oe||null===(K=oe.serviceSettings)||void 0===K||null===(K=K.guessFaqs)||void 0===K?void 0:K.map((function(e){return e.uid})),hotFaqUids:null==H||null===(L=H.serviceSettings)||void 0===L||null===(L=L.hotFaqs)||void 0===L?void 0:L.map((function(e){return e.uid})),shortcutFaqUids:null==H||null===(V=H.serviceSettings)||void 0===V||null===(V=V.shortcutFaqs)||void 0===V?void 0:V.map((function(e){return e.uid}))}),_=r()(r()({},oe),{},{serviceSettings:D,robotSettings:r()(r()({},oe.robotSettings),{},{robotUid:null==oe||null===(W=oe.robotSettings)||void 0===W||null===(W=W.robot)||void 0===W?void 0:W.uid}),messageLeaveSettings:r()(r()({},oe.messageLeaveSettings),{},{worktimeUids:null==oe||null===(N=oe.messageLeaveSettings)||void 0===N||null===(N=N.worktimes)||void 0===N?void 0:N.map((function(e){return e.uid}))}),agentUids:oe.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",_),e.next=30,(0,R.W5)(_);case 30:O=e.sent,console.log("updateWorkGroup response:",O),200===O.code?(g.yw.destroy(),g.yw.success(a.formatMessage({id:"update.success"})),Q=r()(r()({},O.data),{},{serviceSettings:r()(r()({},O.data.serviceSettings),{},{faqs:(null===(E=O.data.serviceSettings.faqs)||void 0===E?void 0:E.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer}})))||[]})}),se(Q)):(g.yw.destroy(),g.yw.error(O.message));case 33:e.next=40;break;case 35:e.prev=35,e.t0=e.catch(1),g.yw.destroy(),console.error("提交失败:",e.t0),g.yw.error("提交失败");case 40:case"end":return e.stop()}}),e,null,[[1,35]])})));return function(t){return e.apply(this,arguments)}}(),ve=function(){var e=d()(l()().mark((function e(t){var i;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabFaqs handleChange",t),u.setFieldValue("showFaqs",t),e.prev=2,e.next=5,u.validateFields();case 5:i=e.sent,ce(i),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("验证失败:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return(0,Z.jsx)("div",{children:(0,Z.jsxs)(S.A,{form:u,layout:"vertical",onFinish:ce,submitter:{render:function(e,t){return(0,Z.jsxs)(y.Z,{children:[t,(0,Z.jsx)(k.ZP,{color:"danger",variant:"outlined",icon:(0,Z.jsx)(q.Z,{}),onClick:function(){var e;null===(e=window.bytedesk)||void 0===e||e.showChat()},children:a.formatMessage({id:"preview",defaultMessage:"Preview"})})]})}},children:[(0,Z.jsx)(b.Z,{label:a.formatMessage({id:"faq.show.faqs"}),name:"showFaqs",fieldProps:{onChange:ve}}),(0,Z.jsx)(F.Z,{name:"faqKbUid",width:"md",label:a.formatMessage({id:"faq.kbase.select",defaultMessage:"选择侧边栏常见问题知识库"}),options:null==Q||null===(t=Q.data)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.map((function(e){return{label:c(e.name),value:e.uid}})),fieldProps:{onChange:function(e){console.log("selected kbase:",e),z(e),u.setFieldValue("faqUids",[]),de(e)},allowClear:!0,placeholder:(0,Z.jsx)(U.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),(0,Z.jsx)(F.Z,{name:"faqUids",width:"md",label:a.formatMessage({id:"menu.kbase.faq"}),options:null==D||null===(i=D.data)||void 0===i||null===(i=i.content)||void 0===i?void 0:i.map((function(e){return{label:c(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:(0,Z.jsx)(U.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}})]})})}},15408:function(e,t,i){var n=i(73193),o=i.n(n),s=i(90819),r=i.n(s),u=i(89933),l=i.n(u),a=i(45332),d=i.n(a),c=i(55567),v=i(39124),g=i(43829),p=i(28619),f=i(22607),m=i(9942),h=i(5321),w=i(48792),q=i(65511),S=i(7956),b=i(43906),F=i(99898),U=i(34353),y=i(44194),k=i(36914),x=i(17817),C=i(18232),M=i(66942),j=i(88192),T=i(85640),R=i(70575),P=i(31549);t.Z=function(e){var t,i,n=e.type,s=w.A.useForm(),u=d()(s,1)[0],a=(0,b.useIntl)(),I=((0,b.useNavigate)(),(0,p.Z)().translateString),Z=(0,T.M)(),A=Z.config,K=Z.updateConfig,L=(0,m.u)((function(e){return e.currentOrg})),V=(0,y.useState)(),W=d()(V,2),N=W[0],D=W[1],_=(0,y.useState)(),O=d()(_,2),E=O[0],Q=O[1],X=(0,y.useState)(),$=d()(X,2),B=$[0],G=$[1],z=(0,f.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),Y=z.currentRobot,H=z.setCurrentRobot,J=(0,k.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),ee=J.currentAgent,te=J.setCurrentAgent,ie=(0,x.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),ne=ie.currentWorkgroup,oe=ie.setCurrentWorkgroup,se=(0,y.useMemo)((function(){return n===C._X4?{chatType:C.xtN,chatSid:Y.uid}:n===C.Njn?{chatType:C.scI,chatSid:ee.uid}:n===C.aZD?{chatType:C.vPY,chatSid:ne.uid}:{chatType:C.xtN,chatSid:""}}),[n,Y,ee,ne]),re=se.chatType,ue=se.chatSid,le=function(){var e=l()(r()().mark((function e(){var t,i,o,s,l,d,v;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:C.QPQ,orgUid:null==L?void 0:L.uid},e.next=4,(0,R.AP)(t);case 4:i=e.sent,console.log("getKbases response:",t,i),c.yw.destroy(),200===i.code?(Q(i),n===C._X4&&null!=Y&&null!==(o=Y.serviceSettings)&&void 0!==o&&o.quickFaqKbUid?v=Y.serviceSettings.quickFaqKbUid:n===C.Njn&&null!=ee&&null!==(s=ee.serviceSettings)&&void 0!==s&&s.quickFaqKbUid?v=ee.serviceSettings.quickFaqKbUid:n===C.aZD&&null!=ne&&null!==(l=ne.serviceSettings)&&void 0!==l&&l.quickFaqKbUid?v=ne.serviceSettings.quickFaqKbUid:(null===(d=i.data)||void 0===d||null===(d=d.content)||void 0===d?void 0:d.length)>0&&(v=i.data.content[0].uid),v&&(G(v),u.setFieldValue("quickFaqKbUid",v),ae(v))):c.yw.error(i.message);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=l()(r()().mark((function e(t){var i,n,o,s,l;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||B){e.next=4;break}return console.log("没有选择知识库,无法获取FAQ"),D(void 0),e.abrupt("return");case 4:return c.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),i={pageNumber:0,pageSize:50,orgUid:null==L?void 0:L.uid,kbUid:t||B},e.next=8,(0,v.pf)(i);case 8:n=e.sent,console.log("getFaqs response:",i,n),c.yw.destroy(),200===n.code?(D(n),t||B,(o=u.getFieldValue("quickFaqUids")||[]).length>0&&(s=n.data.content.map((function(e){return e.uid})),(l=o.filter((function(e){return s.includes(e)}))).length!==o.length&&u.setFieldValue("quickFaqUids",l))):c.yw.error(n.message);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,y.useEffect)((function(){null!=L&&L.uid&&le()}),[L]),(0,y.useEffect)((function(){var e,t,i,s,r;if(n===C._X4&&Y)u.setFieldsValue({showQuickFaqs:null==Y||null===(t=Y.serviceSettings)||void 0===t?void 0:t.showQuickFaqs,quickFaqKbUid:null==Y||null===(i=Y.serviceSettings)||void 0===i?void 0:i.quickFaqKbUid,quickFaqUids:null==Y||null===(s=Y.serviceSettings)||void 0===s||null===(s=s.quickFaqs)||void 0===s?void 0:s.map((function(e){return e.uid}))}),e=null==Y||null===(r=Y.serviceSettings)||void 0===r?void 0:r.quickFaqKbUid,K(o()(o()({},A),{},{chatConfig:o()(o()({},A.chatConfig),{},{org:null==L?void 0:L.uid,t:re,sid:ue})}));else if(n===C.Njn&&ee){var l,a,d,c;u.setFieldsValue({showQuickFaqs:null==ee||null===(l=ee.serviceSettings)||void 0===l?void 0:l.showQuickFaqs,quickFaqKbUid:null==ee||null===(a=ee.serviceSettings)||void 0===a?void 0:a.quickFaqKbUid,quickFaqUids:null==ee||null===(d=ee.serviceSettings)||void 0===d||null===(d=d.quickFaqs)||void 0===d?void 0:d.map((function(e){return e.uid}))}),e=null==ee||null===(c=ee.serviceSettings)||void 0===c?void 0:c.quickFaqKbUid,K(o()(o()({},A),{},{chatConfig:o()(o()({},A.chatConfig),{},{org:null==L?void 0:L.uid,t:re,sid:ue})}))}else if(n===C.aZD&&ne){var v,g,p,f;u.setFieldsValue({showQuickFaqs:null==ne||null===(v=ne.serviceSettings)||void 0===v?void 0:v.showQuickFaqs,quickFaqKbUid:null==ne||null===(g=ne.serviceSettings)||void 0===g?void 0:g.quickFaqKbUid,quickFaqUids:null==ne||null===(p=ne.serviceSettings)||void 0===p||null===(p=p.quickFaqs)||void 0===p?void 0:p.map((function(e){return e.uid}))}),e=null==ne||null===(f=ne.serviceSettings)||void 0===f?void 0:f.quickFaqKbUid,K(o()(o()({},A),{},{chatConfig:o()(o()({},A.chatConfig),{},{org:null==L?void 0:L.uid,t:re,sid:ue})}))}e&&e!==B&&(console.log("快捷回复知识库ID变化,更新FAQ列表:",e),G(e),ae(e))}),[Y,ee,ne,n,re,ue,null==L?void 0:L.uid]);var de=function(){var e=l()(r()().mark((function e(t){var i,s,u,l,d,v,p,f,m,h,w,q,S,b,F,U,y,k,x,T,R,P,I,Z,A;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("onFinish",t),n!==C._X4){e.next=11;break}return v=o()(o()({},Y),{},{serviceSettings:o()(o()({},Y.serviceSettings),{},{showQuickFaqs:t.showQuickFaqs,quickFaqKbUid:t.quickFaqKbUid,quickFaqUids:t.quickFaqUids,welcomeFaqUids:null==Y||null===(i=Y.serviceSettings)||void 0===i||null===(i=i.welcomeFaqs)||void 0===i?void 0:i.map((function(e){return e.uid})),faqUids:null==Y||null===(s=Y.serviceSettings)||void 0===s||null===(s=s.faqs)||void 0===s?void 0:s.map((function(e){return e.uid})),guessFaqUids:null==Y||null===(u=Y.serviceSettings)||void 0===u||null===(u=u.guessFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})),hotFaqUids:null==Y||null===(l=Y.serviceSettings)||void 0===l||null===(l=l.hotFaqs)||void 0===l?void 0:l.map((function(e){return e.uid})),shortcutFaqUids:null==Y||null===(d=Y.serviceSettings)||void 0===d||null===(d=d.shortcutFaqs)||void 0===d?void 0:d.map((function(e){return e.uid}))})}),console.log("robotObject:",v),e.next=6,(0,g.$l)(v);case 6:p=e.sent,console.log("updateRobot response:",p),200===p.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),H(p.data)):(c.yw.destroy(),c.yw.error(p.message)),e.next=29;break;case 11:if(n!==C.Njn){e.next=21;break}return F=o()(o()({},ee),{},{serviceSettings:o()(o()({},null==ee?void 0:ee.serviceSettings),{},{showQuickFaqs:t.showQuickFaqs,quickFaqKbUid:t.quickFaqKbUid,quickFaqUids:t.quickFaqUids,welcomeFaqUids:null==ee||null===(f=ee.serviceSettings)||void 0===f||null===(f=f.welcomeFaqs)||void 0===f?void 0:f.map((function(e){return e.uid})),faqUids:null==ee||null===(m=ee.serviceSettings)||void 0===m||null===(m=m.faqs)||void 0===m?void 0:m.map((function(e){return e.uid})),guessFaqUids:null==ee||null===(h=ee.serviceSettings)||void 0===h||null===(h=h.guessFaqs)||void 0===h?void 0:h.map((function(e){return e.uid})),hotFaqUids:null==ee||null===(w=ee.serviceSettings)||void 0===w||null===(w=w.hotFaqs)||void 0===w?void 0:w.map((function(e){return e.uid})),shortcutFaqUids:null==ee||null===(q=ee.serviceSettings)||void 0===q||null===(q=q.shortcutFaqs)||void 0===q?void 0:q.map((function(e){return e.uid}))}),robotSettings:o()(o()({},ee.robotSettings),{},{robotUid:null==ee||null===(S=ee.robotSettings)||void 0===S||null===(S=S.robot)||void 0===S?void 0:S.uid}),messageLeaveSettings:o()(o()({},ee.messageLeaveSettings),{},{worktimeUids:null==ee||null===(b=ee.messageLeaveSettings)||void 0===b||null===(b=b.worktimes)||void 0===b?void 0:b.map((function(e){return e.uid}))}),autoReplySettings:o()({},ee.autoReplySettings)}),console.log("agentObject:",F),e.next=16,(0,M.sE)(F);case 16:U=e.sent,console.log("updateAgent response:",U),200===U.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),te(U.data)):(c.yw.destroy(),c.yw.error(U.message)),e.next=29;break;case 21:if(n!==C.aZD){e.next=29;break}return Z=o()(o()({},ne),{},{serviceSettings:o()(o()({},ne.serviceSettings),{},{showQuickFaqs:t.showQuickFaqs,quickFaqKbUid:t.quickFaqKbUid,quickFaqUids:t.quickFaqUids,welcomeFaqUids:null==ne||null===(y=ne.serviceSettings)||void 0===y||null===(y=y.welcomeFaqs)||void 0===y?void 0:y.map((function(e){return e.uid})),faqUids:null===(k=ne.serviceSettings)||void 0===k||null===(k=k.faqs)||void 0===k?void 0:k.map((function(e){return e.uid})),guessFaqUids:null==ne||null===(x=ne.serviceSettings)||void 0===x||null===(x=x.guessFaqs)||void 0===x?void 0:x.map((function(e){return e.uid})),hotFaqUids:null==ne||null===(T=ne.serviceSettings)||void 0===T||null===(T=T.hotFaqs)||void 0===T?void 0:T.map((function(e){return e.uid})),shortcutFaqUids:null==ne||null===(R=ne.serviceSettings)||void 0===R||null===(R=R.shortcutFaqs)||void 0===R?void 0:R.map((function(e){return e.uid}))}),robotSettings:o()(o()({},ne.robotSettings),{},{robotUid:null==ne||null===(P=ne.robotSettings)||void 0===P||null===(P=P.robot)||void 0===P?void 0:P.uid}),messageLeaveSettings:o()(o()({},ne.messageLeaveSettings),{},{worktimeUids:null==ne||null===(I=ne.messageLeaveSettings)||void 0===I||null===(I=I.worktimes)||void 0===I?void 0:I.map((function(e){return e.uid}))}),agentUids:ne.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",Z),e.next=26,(0,j.W5)(Z);case 26:A=e.sent,console.log("updateWorkGroup response:",A),200===A.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),oe(A.data)):(c.yw.destroy(),c.yw.error(A.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ce=function(){var e=l()(r()().mark((function e(t){var i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabFaqs handleChange",t),u.setFieldValue("showQuickFaqs",t),e.prev=2,e.next=5,u.validateFields();case 5:i=e.sent,de(i),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("验证失败:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return(0,P.jsx)("div",{children:(0,P.jsxs)(w.A,{form:u,layout:"vertical",onFinish:de,submitter:{render:function(e,t){return(0,P.jsxs)(F.Z,{children:[t,(0,P.jsx)(U.ZP,{color:"danger",variant:"outlined",icon:(0,P.jsx)(h.Z,{}),onClick:function(){var e;null===(e=window.bytedesk)||void 0===e||e.showChat()},children:a.formatMessage({id:"preview",defaultMessage:"Preview"})})]})}},children:[(0,P.jsx)(q.Z,{label:a.formatMessage({id:"faq.show.quick.buttons"}),name:"showQuickFaqs",fieldProps:{onChange:ce}}),(0,P.jsx)(S.Z,{name:"quickFaqKbUid",width:"md",label:a.formatMessage({id:"quick.kbase.select",defaultMessage:"选择输入框上方的快捷按钮知识库"}),options:null==E||null===(t=E.data)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.map((function(e){return{label:I(e.name),value:e.uid}})),fieldProps:{onChange:function(e){console.log("selected kbase:",e),G(e),u.setFieldValue("quickFaqUids",[]),ae(e)},allowClear:!0,placeholder:(0,P.jsx)(b.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),(0,P.jsx)(S.Z,{name:"quickFaqUids",width:"md",label:a.formatMessage({id:"menu.kbase.quickbutton"}),options:null==N||null===(i=N.data)||void 0===i||null===(i=i.content)||void 0===i?void 0:i.map((function(e){return{label:I(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:(0,P.jsx)(b.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}})]})})}},16845:function(e,t,i){i(90819),i(73193),i(89933),i(45332),i(66942),i(43829),i(88192),i(36914),i(22607),i(17817),i(18232),i(43906),i(44194),i(31549)},60876:function(e,t,i){i(90819),i(73193),i(89933),i(45332),i(66942),i(43829),i(88192),i(36914),i(22607),i(17817),i(18232),i(43906),i(44194),i(31549)},70336:function(e,t,i){var n=i(90819),o=i.n(n),s=i(89933),r=i.n(s),u=i(73193),l=i.n(u),a=i(45332),d=i.n(a),c=i(55567),v=i(66942),g=i(43829),p=i(88192),f=i(36914),m=i(22607),h=i(17817),w=i(18232),q=i(48792),S=i(65511),b=i(43906),F=i(44194),U=i(85640),y=i(99898),k=i(34353),x=i(5321),C=i(31549);t.Z=function(e){var t=e.type,i=(0,b.useIntl)(),n=q.A.useForm(),s=d()(n,1)[0],u=(0,U.M)(),a=u.config,M=u.updateConfig,j=(0,m.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),T=j.currentRobot,R=j.setCurrentRobot,P=(0,f.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),I=P.currentAgent,Z=P.setCurrentAgent,A=(0,h.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),K=A.currentWorkgroup,L=A.setCurrentWorkgroup,V=(0,F.useMemo)((function(){return t===w._X4?{chatType:w.xtN,chatSid:T.uid}:t===w.Njn?{chatType:w.scI,chatSid:I.uid}:t===w.aZD?{chatType:w.vPY,chatSid:K.uid}:{chatType:w.xtN,chatSid:""}}),[t,T,I,K]),W=V.chatType,N=V.chatSid;(0,F.useEffect)((function(){var e,i,n,o,r,u;if(t===w._X4)s.setFieldsValue({autoPopup:null==T||null===(e=T.serviceSettings)||void 0===e?void 0:e.autoPopup,showInvite:null==T||null===(i=T.inviteSettings)||void 0===i?void 0:i.show,inviteText:null==T||null===(n=T.inviteSettings)||void 0===n?void 0:n.text}),M(l()(l()({},a),{},{autoPopup:null==T||null===(o=T.serviceSettings)||void 0===o?void 0:o.autoPopup,inviteConfig:{show:null==T||null===(r=T.inviteSettings)||void 0===r?void 0:r.show,text:null==T||null===(u=T.inviteSettings)||void 0===u?void 0:u.text},chatConfig:l()(l()({},a.chatConfig),{},{t:W,sid:N})}));else if(t===w.Njn){var d,c,v,g,p,f;s.setFieldsValue({autoPopup:null==I||null===(d=I.serviceSettings)||void 0===d?void 0:d.autoPopup,showInvite:null==I||null===(c=I.inviteSettings)||void 0===c?void 0:c.show,inviteText:null==I||null===(v=I.inviteSettings)||void 0===v?void 0:v.text}),M(l()(l()({},a),{},{autoPopup:null==I||null===(g=I.serviceSettings)||void 0===g?void 0:g.autoPopup,inviteConfig:{show:null==I||null===(p=I.inviteSettings)||void 0===p?void 0:p.show,text:null==I||null===(f=I.inviteSettings)||void 0===f?void 0:f.text},chatConfig:l()(l()({},a.chatConfig),{},{t:W,sid:N})}))}else if(t===w.aZD){var m,h,q,S,b,F;s.setFieldsValue({autoPopup:null==K||null===(m=K.serviceSettings)||void 0===m?void 0:m.autoPopup,showInvite:null==K||null===(h=K.inviteSettings)||void 0===h?void 0:h.show,inviteText:null==K||null===(q=K.inviteSettings)||void 0===q?void 0:q.text}),M(l()(l()({},a),{},{autoPopup:null==K||null===(S=K.serviceSettings)||void 0===S?void 0:S.autoPopup,inviteConfig:{show:null==K||null===(b=K.inviteSettings)||void 0===b?void 0:b.show,text:null==K||null===(F=K.inviteSettings)||void 0===F?void 0:F.text},chatConfig:l()(l()({},a.chatConfig),{},{t:W,sid:N})}))}}),[T,I,K,W,N]);var D=function(){var e=r()(o()().mark((function e(n){var s,r,u,a,d,f,m,h,q,S,b,F,U,y,k,x,C,M,j,P,A,V,W,N,D,_,O,E;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("onFinish:",n),t!==w._X4){e.next=11;break}return m=l()(l()({},T),{},{serviceSettings:l()(l()({},T.serviceSettings),{},{autoPopup:n.autoPopup,welcomeFaqUids:null==T||null===(s=T.serviceSettings)||void 0===s||null===(s=s.faqs)||void 0===s?void 0:s.map((function(e){return e.uid})),faqUids:null==T||null===(r=T.serviceSettings)||void 0===r||null===(r=r.faqs)||void 0===r?void 0:r.map((function(e){return e.uid})),quickFaqUids:null==T||null===(u=T.serviceSettings)||void 0===u||null===(u=u.quickFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})),guessFaqUids:null==T||null===(a=T.serviceSettings)||void 0===a||null===(a=a.guessFaqs)||void 0===a?void 0:a.map((function(e){return e.uid})),hotFaqUids:null==T||null===(d=T.serviceSettings)||void 0===d||null===(d=d.hotFaqs)||void 0===d?void 0:d.map((function(e){return e.uid})),shortcutFaqUids:null==T||null===(f=T.serviceSettings)||void 0===f||null===(f=f.shortcutFaqs)||void 0===f?void 0:f.map((function(e){return e.uid}))}),inviteSettings:l()(l()({},T.inviteSettings),{},{show:n.showInvite,text:n.inviteText})}),console.log("robotObject:",m),e.next=6,(0,g.$l)(m);case 6:h=e.sent,console.log("updateRobot response:",h),200===h.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),R(h.data)):(c.yw.destroy(),c.yw.error(h.message)),e.next=29;break;case 11:if(t!==w.Njn){e.next=21;break}return C=l()(l()({},I),{},{serviceSettings:l()(l()({},null==I?void 0:I.serviceSettings),{},{autoPopup:n.autoPopup,welcomeFaqUids:null==I||null===(q=I.serviceSettings)||void 0===q||null===(q=q.faqs)||void 0===q?void 0:q.map((function(e){return e.uid})),faqUids:null==I||null===(S=I.serviceSettings)||void 0===S||null===(S=S.faqs)||void 0===S?void 0:S.map((function(e){return e.uid})),quickFaqUids:null==I||null===(b=I.serviceSettings)||void 0===b||null===(b=b.quickFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),guessFaqUids:null==I||null===(F=I.serviceSettings)||void 0===F||null===(F=F.guessFaqs)||void 0===F?void 0:F.map((function(e){return e.uid})),hotFaqUids:null==I||null===(U=I.serviceSettings)||void 0===U||null===(U=U.hotFaqs)||void 0===U?void 0:U.map((function(e){return e.uid})),shortcutFaqUids:null==I||null===(y=I.serviceSettings)||void 0===y||null===(y=y.shortcutFaqs)||void 0===y?void 0:y.map((function(e){return e.uid}))}),robotSettings:l()(l()({},I.robotSettings),{},{robotUid:null==I||null===(k=I.robotSettings)||void 0===k||null===(k=k.robot)||void 0===k?void 0:k.uid}),messageLeaveSettings:l()(l()({},I.messageLeaveSettings),{},{worktimeUids:null==I||null===(x=I.messageLeaveSettings)||void 0===x||null===(x=x.worktimes)||void 0===x?void 0:x.map((function(e){return e.uid}))}),autoReplySettings:l()({},I.autoReplySettings),inviteSettings:l()(l()({},I.inviteSettings),{},{show:n.showInvite,text:n.inviteText})}),console.log("agentObject:",C),e.next=16,(0,v.sE)(C);case 16:M=e.sent,console.log("updateAgent response:",M),200===M.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),Z(M.data)):(c.yw.destroy(),c.yw.error(M.message)),e.next=29;break;case 21:if(t!==w.aZD){e.next=29;break}return O=l()(l()({},K),{},{serviceSettings:l()(l()({},K.serviceSettings),{},{autoPopup:n.autoPopup,welcomeFaqUids:null==K||null===(j=K.serviceSettings)||void 0===j||null===(j=j.faqs)||void 0===j?void 0:j.map((function(e){return e.uid})),faqUids:null==K||null===(P=K.serviceSettings)||void 0===P||null===(P=P.faqs)||void 0===P?void 0:P.map((function(e){return e.uid})),quickFaqUids:null===(A=K.serviceSettings)||void 0===A||null===(A=A.quickFaqs)||void 0===A?void 0:A.map((function(e){return e.uid})),guessFaqUids:null==K||null===(V=K.serviceSettings)||void 0===V||null===(V=V.guessFaqs)||void 0===V?void 0:V.map((function(e){return e.uid})),hotFaqUids:null==K||null===(W=K.serviceSettings)||void 0===W||null===(W=W.hotFaqs)||void 0===W?void 0:W.map((function(e){return e.uid})),shortcutFaqUids:null==K||null===(N=K.serviceSettings)||void 0===N||null===(N=N.shortcutFaqs)||void 0===N?void 0:N.map((function(e){return e.uid}))}),robotSettings:l()(l()({},K.robotSettings),{},{robotUid:null==K||null===(D=K.robotSettings)||void 0===D||null===(D=D.robot)||void 0===D?void 0:D.uid}),messageLeaveSettings:l()(l()({},K.messageLeaveSettings),{},{worktimeUids:null==K||null===(_=K.messageLeaveSettings)||void 0===_||null===(_=_.worktimes)||void 0===_?void 0:_.map((function(e){return e.uid}))}),inviteSettings:l()(l()({},K.inviteSettings),{},{show:n.showInvite,text:n.inviteText}),agentUids:K.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",O),e.next=26,(0,p.W5)(O);case 26:E=e.sent,console.log("updateWorkGroup response:",E),200===E.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),L(E.data)):(c.yw.destroy(),c.yw.error(E.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_=function(){var e=r()(o()().mark((function e(t){var i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("handleAutoPopChange",t),s.setFieldValue("autoPopup",t),e.prev=2,e.next=5,s.validateFields();case 5:i=e.sent,D(i),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("验证失败:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return(0,C.jsx)("div",{children:(0,C.jsxs)(q.A,{form:s,onFinish:D,submitter:{render:function(e,t){var n=s.getFieldValue("autoPopup");return(0,C.jsxs)(y.Z,{children:[t,n&&(0,C.jsx)(k.ZP,{color:"danger",variant:"outlined",icon:(0,C.jsx)(x.Z,{}),onClick:function(){var e;null===(e=window.bytedesk)||void 0===e||e.showInviteDialog()},children:i.formatMessage({id:"preview",defaultMessage:"Preview"})})]})}},children:[(0,C.jsx)(S.Z,{width:"md",name:"autoPopup",label:i.formatMessage({id:"autoPopup",defaultMessage:"Auto Popup"}),fieldProps:{onChange:_}}),!1]})})}},36076:function(e,t,i){i(31549)},40899:function(e,t,i){var n=i(90819),o=i.n(n),s=i(73193),r=i.n(s),u=i(89933),l=i.n(u),a=i(45332),d=i.n(a),c=i(55567),v=i(66942),g=i(88192),p=i(36914),f=i(17817),m=i(18232),h=(i(54305),i(48792)),w=i(65511),q=i(43906),S=i(44194),b=(i(39883),i(22607)),F=i(43829),U=i(28619),y=i(31549);t.Z=function(e){var t=e.type,i=(0,q.useIntl)(),n=h.A.useForm(),s=d()(n,1)[0],u=(0,U.Z)().translateString,a=(0,S.useState)(!1),k=d()(a,2),x=(k[0],k[1],(0,S.useState)("")),C=d()(x,2),M=C[0],j=C[1],T=(0,b.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),R=T.currentRobot,P=T.setCurrentRobot,I=(0,p.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),Z=I.currentAgent,A=I.setCurrentAgent,K=(0,f.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),L=K.currentWorkgroup,V=K.setCurrentWorkgroup;(0,S.useEffect)((function(){var e,i,n;if(t===m.Njn)s.setFieldValue("showRateBtn",null==Z||null===(e=Z.serviceSettings)||void 0===e?void 0:e.showRateBtn),s.setFieldValue("autoInviteRate",null==Z||null===(i=Z.serviceSettings)||void 0===i?void 0:i.autoInviteRate),j(u(null==Z||null===(n=Z.serviceSettings)||void 0===n?void 0:n.inviteRateTip));else if(t===m.aZD){var o,r,l;s.setFieldValue("showRateBtn",null==L||null===(o=L.serviceSettings)||void 0===o?void 0:o.showRateBtn),s.setFieldValue("autoInviteRate",null==L||null===(r=L.serviceSettings)||void 0===r?void 0:r.autoInviteRate),j(u(null==L||null===(l=L.serviceSettings)||void 0===l?void 0:l.inviteRateTip))}else if(t===m._X4){var a,d,c;s.setFieldValue("showRateBtn",null==R||null===(a=R.serviceSettings)||void 0===a?void 0:a.showRateBtn),s.setFieldValue("autoInviteRate",null==R||null===(d=R.serviceSettings)||void 0===d?void 0:d.autoInviteRate),j(u(null==R||null===(c=R.serviceSettings)||void 0===c?void 0:c.inviteRateTip))}}),[R,Z,L]);var W=function(){var e=l()(o()().mark((function e(n){var s,u,l,a,d,p,f,h,w,q,S,b,U,y,k,x,C,j,T,I,K,W,N,D,_,O,E;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("onFinish:",n),t!==m._X4){e.next=11;break}return p=r()(r()({},R),{},{serviceSettings:r()(r()({},R.serviceSettings),{},{showRateBtn:n.showRateBtn,autoInviteRate:n.autoInviteRate,inviteRateTip:M,rateMsgCount:n.rateMsgCount,welcomeFaqUids:null==n?void 0:n.welcomeFaqUids,quickFaqUids:null===(s=Z.serviceSettings)||void 0===s||null===(s=s.quickFaqs)||void 0===s?void 0:s.map((function(e){return e.uid})),faqUids:null==R||null===(u=R.serviceSettings)||void 0===u||null===(u=u.faqs)||void 0===u?void 0:u.map((function(e){return e.uid})),guessFaqUids:null==R||null===(l=R.serviceSettings)||void 0===l||null===(l=l.guessFaqs)||void 0===l?void 0:l.map((function(e){return e.uid})),hotFaqUids:null==R||null===(a=R.serviceSettings)||void 0===a||null===(a=a.hotFaqs)||void 0===a?void 0:a.map((function(e){return e.uid})),shortcutFaqUids:null==R||null===(d=R.serviceSettings)||void 0===d||null===(d=d.shortcutFaqs)||void 0===d?void 0:d.map((function(e){return e.uid}))})}),console.log("robotObject:",p),e.next=6,(0,F.$l)(p);case 6:f=e.sent,console.log("updateRobot response:",f),200===f.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),P(f.data)):(c.yw.destroy(),c.yw.error(f.message)),e.next=29;break;case 11:if(t!==m.Njn){e.next=21;break}return x=r()(r()({},Z),{},{serviceSettings:r()(r()({},null==Z?void 0:Z.serviceSettings),{},{showRateBtn:n.showRateBtn,autoInviteRate:n.autoInviteRate,inviteRateTip:M,rateMsgCount:n.rateMsgCount,welcomeFaqUids:null==Z||null===(h=Z.serviceSettings)||void 0===h||null===(h=h.welcomeFaqs)||void 0===h?void 0:h.map((function(e){return e.uid})),quickFaqUids:null==Z||null===(w=Z.serviceSettings)||void 0===w||null===(w=w.quickFaqs)||void 0===w?void 0:w.map((function(e){return e.uid})),faqUids:null==Z||null===(q=Z.serviceSettings)||void 0===q||null===(q=q.faqs)||void 0===q?void 0:q.map((function(e){return e.uid})),guessFaqUids:null==Z||null===(S=Z.serviceSettings)||void 0===S||null===(S=S.guessFaqs)||void 0===S?void 0:S.map((function(e){return e.uid})),hotFaqUids:null==Z||null===(b=Z.serviceSettings)||void 0===b||null===(b=b.hotFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),shortcutFaqUids:null==Z||null===(U=Z.serviceSettings)||void 0===U||null===(U=U.shortcutFaqs)||void 0===U?void 0:U.map((function(e){return e.uid}))}),robotSettings:r()(r()({},Z.robotSettings),{},{robotUid:null==Z||null===(y=Z.robotSettings)||void 0===y||null===(y=y.robot)||void 0===y?void 0:y.uid}),messageLeaveSettings:r()(r()({},Z.messageLeaveSettings),{},{worktimeUids:null==Z||null===(k=Z.messageLeaveSettings)||void 0===k||null===(k=k.worktimes)||void 0===k?void 0:k.map((function(e){return e.uid}))}),autoReplySettings:r()({},Z.autoReplySettings)}),console.log("agentObject:",x),e.next=16,(0,v.sE)(x);case 16:C=e.sent,console.log("updateAgent response:",C),200===C.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),A(C.data)):(c.yw.destroy(),c.yw.error(C.message)),e.next=29;break;case 21:if(t!==m.aZD){e.next=29;break}return O=r()(r()({},L),{},{serviceSettings:r()(r()({},L.serviceSettings),{},{showRateBtn:n.showRateBtn,autoInviteRate:n.autoInviteRate,inviteRateTip:M,rateMsgCount:n.rateMsgCount,welcomeFaqUids:null==L||null===(j=L.serviceSettings)||void 0===j||null===(j=j.welcomeFaqs)||void 0===j?void 0:j.map((function(e){return e.uid})),quickFaqUids:null===(T=L.serviceSettings)||void 0===T||null===(T=T.quickFaqs)||void 0===T?void 0:T.map((function(e){return e.uid})),faqUids:null==L||null===(I=L.serviceSettings)||void 0===I||null===(I=I.faqs)||void 0===I?void 0:I.map((function(e){return e.uid})),guessFaqUids:null==L||null===(K=L.serviceSettings)||void 0===K||null===(K=K.guessFaqs)||void 0===K?void 0:K.map((function(e){return e.uid})),hotFaqUids:null===(W=L.serviceSettings)||void 0===W||null===(W=W.hotFaqs)||void 0===W?void 0:W.map((function(e){return e.uid})),shortcutFaqUids:null==L||null===(N=L.serviceSettings)||void 0===N||null===(N=N.shortcutFaqs)||void 0===N?void 0:N.map((function(e){return e.uid}))}),robotSettings:r()(r()({},L.robotSettings),{},{robotUid:null==L||null===(D=L.robotSettings)||void 0===D||null===(D=D.robot)||void 0===D?void 0:D.uid}),messageLeaveSettings:r()(r()({},L.messageLeaveSettings),{},{worktimeUids:null==L||null===(_=L.messageLeaveSettings)||void 0===_||null===(_=_.worktimes)||void 0===_?void 0:_.map((function(e){return e.uid}))}),agentUids:L.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",O),e.next=26,(0,g.W5)(O);case 26:E=e.sent,console.log("updateWorkGroup response:",E),200===E.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),V(E.data)):(c.yw.destroy(),c.yw.error(E.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),N=function(){var e=l()(o()().mark((function e(t){var i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabFaqs handleChange",t),s.setFieldValue("autoInviteRate",t),e.prev=2,e.next=5,s.validateFields();case 5:i=e.sent,W(i),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("验证失败:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(h.A,{form:s,onFinish:W,style:{marginLeft:"20px"},children:[(0,y.jsx)(w.Z,{width:"md",name:"autoInviteRate",label:i.formatMessage({id:"rate.auto.invite.rate"}),tooltip:i.formatMessage({id:"rate.auto.invite.rate.tooltip"}),fieldProps:{onChange:N}}),!1]})})}},17661:function(e,t,i){var n=i(90819),o=i.n(n),s=i(89933),r=i.n(s),u=i(73193),l=i.n(u),a=i(45332),d=i.n(a),c=i(55567),v=i(66942),g=i(43829),p=i(88192),f=i(36914),m=i(22607),h=i(17817),w=i(18232),q=i(48792),S=i(65511),b=i(44517),F=i(43906),U=i(44194),y=i(99898),k=i(34353),x=i(85640),C=i(5321),M=i(31549);t.Z=function(e){var t=e.type,i=(0,F.useIntl)(),n=q.A.useForm(),s=d()(n,1)[0],u=(0,x.M)(),a=u.config,j=u.updateConfig,T=(0,m.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),R=T.currentRobot,P=T.setCurrentRobot,I=(0,f.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),Z=I.currentAgent,A=I.setCurrentAgent,K=(0,h.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),L=K.currentWorkgroup,V=K.setCurrentWorkgroup,W=(0,U.useMemo)((function(){return t===w._X4?{chatType:w.xtN,chatSid:R.uid}:t===w.Njn?{chatType:w.scI,chatSid:Z.uid}:t===w.aZD?{chatType:w.vPY,chatSid:L.uid}:{chatType:w.xtN,chatSid:""}}),[t,R,Z,L]),N=W.chatType,D=W.chatSid;(0,U.useEffect)((function(){if(t===w._X4){var e,i,n=null==R||null===(e=R.serviceSettings)||void 0===e?void 0:e.showRightIframe;s.setFieldsValue({showRightIframe:n,rightIframeUrl:null==R||null===(i=R.serviceSettings)||void 0===i?void 0:i.rightIframeUrl}),j(n?l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:380})}))}else if(t===w.Njn){var o,r,u=null==Z||null===(o=Z.serviceSettings)||void 0===o?void 0:o.showRightIframe;s.setFieldsValue({showRightIframe:u,rightIframeUrl:null==Z||null===(r=Z.serviceSettings)||void 0===r?void 0:r.rightIframeUrl}),j(u?l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:380})}))}else if(t===w.aZD){var d,c,v=null==L||null===(d=L.serviceSettings)||void 0===d?void 0:d.showRightIframe;s.setFieldsValue({showRightIframe:v,rightIframeUrl:null==L||null===(c=L.serviceSettings)||void 0===c?void 0:c.rightIframeUrl}),j(v?l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:N,sid:D}),window:l()(l()({},a.window),{},{width:380})}))}}),[R,Z,L,N,D]);var _=function(){var e=r()(o()().mark((function e(n){var s,r,u,a,d,f,m,h,q,S,b,F,U,y,k,x,C,M,j,T,I,K,W,N,D,_,O,E,Q;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("onFinish:",n),t!==w._X4){e.next=11;break}return m=l()(l()({},R),{},{serviceSettings:l()(l()({},R.serviceSettings),{},{showRightIframe:n.showRightIframe,rightIframeUrl:n.rightIframeUrl,welcomeFaqUids:null==R||null===(s=R.serviceSettings)||void 0===s||null===(s=s.welcomeFaqs)||void 0===s?void 0:s.map((function(e){return e.uid})),faqUids:null==R||null===(r=R.serviceSettings)||void 0===r||null===(r=r.faqs)||void 0===r?void 0:r.map((function(e){return e.uid})),quickFaqUids:null==R||null===(u=R.serviceSettings)||void 0===u||null===(u=u.quickFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})),guessFaqUids:null==R||null===(a=R.serviceSettings)||void 0===a||null===(a=a.guessFaqs)||void 0===a?void 0:a.map((function(e){return e.uid})),hotFaqUids:null==R||null===(d=R.serviceSettings)||void 0===d||null===(d=d.hotFaqs)||void 0===d?void 0:d.map((function(e){return e.uid})),shortcutFaqUids:null==R||null===(f=R.serviceSettings)||void 0===f||null===(f=f.shortcutFaqs)||void 0===f?void 0:f.map((function(e){return e.uid}))})}),console.log("robotObject:",m),e.next=6,(0,g.$l)(m);case 6:h=e.sent,console.log("updateRobot response:",h),200===h.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),P(h.data)):(c.yw.destroy(),c.yw.error(h.message)),e.next=29;break;case 11:if(t!==w.Njn){e.next=21;break}return C=l()(l()({},Z),{},{serviceSettings:l()(l()({},null==Z?void 0:Z.serviceSettings),{},{showRightIframe:n.showRightIframe,rightIframeUrl:n.rightIframeUrl,welcomeFaqUids:null==Z||null===(q=Z.serviceSettings)||void 0===q||null===(q=q.welcomeFaqs)||void 0===q?void 0:q.map((function(e){return e.uid})),faqUids:null==Z||null===(S=Z.serviceSettings)||void 0===S||null===(S=S.faqs)||void 0===S?void 0:S.map((function(e){return e.uid})),quickFaqUids:null==Z||null===(b=Z.serviceSettings)||void 0===b||null===(b=b.quickFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),guessFaqUids:null==Z||null===(F=Z.serviceSettings)||void 0===F||null===(F=F.guessFaqs)||void 0===F?void 0:F.map((function(e){return e.uid})),hotFaqUids:null==Z||null===(U=Z.serviceSettings)||void 0===U||null===(U=U.hotFaqs)||void 0===U?void 0:U.map((function(e){return e.uid})),shortcutFaqUids:null==Z||null===(y=Z.serviceSettings)||void 0===y||null===(y=y.shortcutFaqs)||void 0===y?void 0:y.map((function(e){return e.uid}))}),robotSettings:l()(l()({},Z.robotSettings),{},{robotUid:null==Z||null===(k=Z.robotSettings)||void 0===k||null===(k=k.robot)||void 0===k?void 0:k.uid}),messageLeaveSettings:l()(l()({},Z.messageLeaveSettings),{},{worktimeUids:null==Z||null===(x=Z.messageLeaveSettings)||void 0===x||null===(x=x.worktimes)||void 0===x?void 0:x.map((function(e){return e.uid}))}),autoReplySettings:l()({},Z.autoReplySettings)}),console.log("agentObject:",C),e.next=16,(0,v.sE)(C);case 16:M=e.sent,console.log("updateAgent response:",M),200===M.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),A(M.data)):(c.yw.destroy(),c.yw.error(M.message)),e.next=29;break;case 21:if(t!==w.aZD){e.next=29;break}return E=l()(l()({},L),{},{serviceSettings:l()(l()({},L.serviceSettings),{},{showRightIframe:n.showRightIframe,rightIframeUrl:n.rightIframeUrl,welcomeFaqUids:null==L||null===(j=L.serviceSettings)||void 0===j||null===(j=j.welcomeFaqs)||void 0===j?void 0:j.map((function(e){return e.uid})),faqUids:null==L||null===(T=L.serviceSettings)||void 0===T||null===(T=T.faqs)||void 0===T?void 0:T.map((function(e){return e.uid})),quickFaqUids:null==L||null===(I=L.serviceSettings)||void 0===I||null===(I=I.quickFaqs)||void 0===I?void 0:I.map((function(e){return e.uid})),guessFaqUids:null==L||null===(K=L.serviceSettings)||void 0===K||null===(K=K.guessFaqs)||void 0===K?void 0:K.map((function(e){return e.uid})),hotFaqUids:null==L||null===(W=L.serviceSettings)||void 0===W||null===(W=W.hotFaqs)||void 0===W?void 0:W.map((function(e){return e.uid})),shortcutFaqUids:null==L||null===(N=L.serviceSettings)||void 0===N||null===(N=N.shortcutFaqs)||void 0===N?void 0:N.map((function(e){return e.uid}))}),robotSettings:l()(l()({},L.robotSettings),{},{robotUid:null==L||null===(D=L.robotSettings)||void 0===D||null===(D=D.robot)||void 0===D?void 0:D.uid}),messageLeaveSettings:l()(l()({},L.messageLeaveSettings),{},{worktimeUids:null==L||null===(_=L.messageLeaveSettings)||void 0===_||null===(_=_.worktimes)||void 0===_?void 0:_.map((function(e){return e.uid}))}),agentUids:null==L||null===(O=L.agents)||void 0===O?void 0:O.map((function(e){return e.uid}))}),console.log("workgroupObject:",E),e.next=26,(0,p.W5)(E);case 26:Q=e.sent,console.log("updateWorkGroup response:",Q),200===Q.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),V(Q.data)):(c.yw.destroy(),c.yw.error(Q.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),O=function(){var e=r()(o()().mark((function e(t){var i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabFaqs handleChange",t),s.setFieldValue("showRightIframe",t),e.prev=2,e.next=5,s.validateFields();case 5:i=e.sent,_(i),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.log("验证失败:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return(0,M.jsx)("div",{children:(0,M.jsxs)(q.A,{form:s,onFinish:_,submitter:{render:function(e,t){return(0,M.jsxs)(y.Z,{children:[t,(0,M.jsx)(k.ZP,{color:"danger",variant:"outlined",icon:(0,M.jsx)(C.Z,{}),onClick:function(){var e;null===(e=window.bytedesk)||void 0===e||e.showChat()},children:i.formatMessage({id:"preview",defaultMessage:"Preview"})})]})}},children:[(0,M.jsx)(S.Z,{width:"md",name:"showRightIframe",label:i.formatMessage({id:"showRightIframe"}),fieldProps:{onChange:O}}),(0,M.jsx)(b.Z,{width:"md",name:"rightIframeUrl",label:i.formatMessage({id:"rightIframeUrl"}),placeholder:i.formatMessage({id:"rightIframeUrl.placeholder",defaultMessage:"请输入有效的URL地址"}),rules:[{pattern:/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w.-]*)*\/?$/,message:i.formatMessage({id:"rightIframeUrl.invalid",defaultMessage:"请输入有效的URL地址"})}]})]})})}},14998:function(e,t,i){var n=i(73193),o=i.n(n),s=i(90819),r=i.n(s),u=i(89933),l=i.n(u),a=i(45332),d=i.n(a),c=i(55567),v=i(66942),g=i(43829),p=i(88192),f=i(28619),m=i(36914),h=i(22607),w=i(17817),q=i(18232),S=i(48792),b=i(99174),F=i(7956),U=i(98976),y=i(43906),k=i(44194),x=i(39883),C=i(54305),M=i(9942),j=i(39124),T=i(70575),R=i(31549);t.Z=function(e){var t,i,n=e.type,s=S.A.useForm(),u=d()(s,1)[0],a=(0,y.useIntl)(),P=(0,f.Z)().translateString,I=(0,k.useState)(!1),Z=d()(I,2),A=Z[0],K=Z[1],L=(0,M.u)((function(e){return e.currentOrg})),V=(0,k.useState)(),W=d()(V,2),N=W[0],D=W[1],_=(0,k.useState)(),O=d()(_,2),E=O[0],Q=O[1],X=(0,k.useState)(),$=d()(X,2),B=$[0],G=$[1],z=(0,h.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),Y=z.currentRobot,H=z.setCurrentRobot,J=(0,m.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),ee=J.currentAgent,te=J.setCurrentAgent,ie=(0,w.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),ne=ie.currentWorkgroup,oe=ie.setCurrentWorkgroup,se=(0,k.useState)(""),re=d()(se,2),ue=re[0],le=re[1],ae=(0,k.useState)(""),de=d()(ae,2),ce=de[0],ve=de[1],ge=(0,k.useState)(""),pe=d()(ge,2),fe=pe[0],me=pe[1],he=(0,k.useState)(""),we=d()(he,2),qe=we[0],Se=we[1],be=(0,k.useState)(""),Fe=d()(be,2),Ue=Fe[0],ye=Fe[1],ke=function(){var e=l()(r()().mark((function e(){var t,i,o,s,l,d;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:q.QPQ,orgUid:null==L?void 0:L.uid},e.next=4,(0,T.AP)(t);case 4:i=e.sent,console.log("getKbases response:",t,i),c.yw.destroy(),200===i.code?(Q(i),n===q._X4&&null!=Y&&null!==(o=Y.serviceSettings)&&void 0!==o&&o.welcomeKbUid?(G(Y.serviceSettings.welcomeKbUid),u.setFieldValue("welcomeKbUid",Y.serviceSettings.welcomeKbUid),xe(Y.serviceSettings.welcomeKbUid)):n===q.Njn&&null!=ee&&null!==(s=ee.serviceSettings)&&void 0!==s&&s.welcomeKbUid?(G(ee.serviceSettings.welcomeKbUid),u.setFieldValue("welcomeKbUid",ee.serviceSettings.welcomeKbUid),xe(ee.serviceSettings.welcomeKbUid)):n===q.aZD&&null!=ne&&null!==(l=ne.serviceSettings)&&void 0!==l&&l.welcomeKbUid?(G(ne.serviceSettings.welcomeKbUid),u.setFieldValue("welcomeKbUid",ne.serviceSettings.welcomeKbUid),xe(ne.serviceSettings.welcomeKbUid)):(null===(d=i.data)||void 0===d||null===(d=d.content)||void 0===d?void 0:d.length)>0&&(G(i.data.content[0].uid),u.setFieldValue("welcomeKbUid",i.data.content[0].uid),xe(i.data.content[0].uid))):c.yw.error(i.message);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xe=function(){var e=l()(r()().mark((function e(t){var i,n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(a.formatMessage({id:"loading",defaultMessage:"Loading"})),i={pageNumber:0,pageSize:50,orgUid:null==L?void 0:L.uid,kbUid:t||B},e.next=4,(0,j.pf)(i);case 4:n=e.sent,console.log("getFaqs response:",i,n),c.yw.destroy(),200===n.code?D(n):c.yw.error(n.message);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,k.useEffect)((function(){ke()}),[]);var Ce=function(e){if(console.log("setFormValues:",e),le(P(null==e?void 0:e.welcomeTip)),me(P(null==e?void 0:e.topTip)),Se(P(null==e?void 0:e.agentCloseTip)),ye(P(null==e?void 0:e.autoCloseTip)),K(null==e?void 0:e.showTopTip),u.setFieldValue("showTopTip",null==e?void 0:e.showTopTip),u.setFieldValue("autoCloseMin",null==e?void 0:e.autoCloseMin),u.setFieldValue("showLogo",null==e?void 0:e.showLogo),null!=e&&e.welcomeKbUid&&(u.setFieldValue("welcomeKbUid",null==e?void 0:e.welcomeKbUid),xe(null==e?void 0:e.welcomeKbUid)),null!=e&&e.welcomeFaqs&&(null==e?void 0:e.welcomeFaqs.length)>0){var t=e.welcomeFaqs.map((function(e){return e.uid}));console.log("从welcomeFaqs提取uid初始化:",t),u.setFieldValue("welcomeFaqUids",t)}else console.log("设置welcomeFaqUids为空数组"),u.setFieldValue("welcomeFaqUids",[]);if(n===q._X4);else if(n===q.Njn){var i;ve(P(null==ee||null===(i=ee.messageLeaveSettings)||void 0===i?void 0:i.messageLeaveTip)),u.setFieldValue("maxThreadCount",null==ee?void 0:ee.maxThreadCount),u.setFieldValue("timeoutRemindTime",null==ee?void 0:ee.timeoutRemindTime)}else if(n===q.aZD){var o;ve(P(null==ne||null===(o=ne.messageLeaveSettings)||void 0===o?void 0:o.messageLeaveTip))}};(0,k.useEffect)((function(){n===q._X4?null!=Y&&Y.serviceSettings&&(console.log("初始化机器人设置:",Y.serviceSettings),Ce(Y.serviceSettings)):n===q.Njn?null!=ee&&ee.serviceSettings&&(console.log("初始化客服设置:",ee.serviceSettings),Ce(ee.serviceSettings),u.setFieldValue("maxThreadCount",null==ee?void 0:ee.maxThreadCount)):n===q.aZD&&null!=ne&&ne.serviceSettings&&(console.log("初始化工作组设置:",ne.serviceSettings),Ce(ne.serviceSettings))}),[Y,ee,ne]);var Me=function(){var e=l()(r()().mark((function e(t){var i,s,u,l,d,f,m,h,w,S,b,F,U,y,k,x,C,M,j,T,R,P,I,Z,K;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("表单提交的值:",t),c.yw.loading(a.formatMessage({id:"updating"})),n!==q._X4){e.next=12;break}return f=o()(o()({},Y),{},{serviceSettings:o()(o()({},Y.serviceSettings),{},{topTip:fe,showTopTip:A,welcomeTip:ue,autoCloseTip:Ue,autoCloseMin:(null==t?void 0:t.autoCloseMin)||25,showLogo:(null==t?void 0:t.showLogo)||!0,welcomeKbUid:null==t?void 0:t.welcomeKbUid,welcomeFaqUids:(null==t?void 0:t.welcomeFaqUids)||[],quickFaqUids:(null===(i=Y.serviceSettings)||void 0===i||null===(i=i.quickFaqs)||void 0===i?void 0:i.map((function(e){return e.uid})))||[],faqUids:(null==Y||null===(s=Y.serviceSettings)||void 0===s||null===(s=s.faqs)||void 0===s?void 0:s.map((function(e){return e.uid})))||[],guessFaqUids:(null==Y||null===(u=Y.serviceSettings)||void 0===u||null===(u=u.guessFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})))||[],hotFaqUids:(null==Y||null===(l=Y.serviceSettings)||void 0===l||null===(l=l.hotFaqs)||void 0===l?void 0:l.map((function(e){return e.uid})))||[],shortcutFaqUids:(null==Y||null===(d=Y.serviceSettings)||void 0===d||null===(d=d.shortcutFaqs)||void 0===d?void 0:d.map((function(e){return e.uid})))||[]})}),console.log("提交的机器人对象:",f),e.next=7,(0,g.$l)(f);case 7:m=e.sent,console.log("updateRobot response:",m),200===m.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),H(m.data)):(c.yw.destroy(),c.yw.error(m.message)),e.next=30;break;case 12:if(n!==q.Njn){e.next=22;break}return k=o()(o()({},ee),{},{serviceSettings:o()(o()({},ee.serviceSettings),{},{topTip:fe,showTopTip:A,welcomeTip:ue,agentCloseTip:qe,autoCloseTip:Ue,autoCloseMin:(null==t?void 0:t.autoCloseMin)||25,showLogo:(null==t?void 0:t.showLogo)||!0,welcomeKbUid:null==t?void 0:t.welcomeKbUid,welcomeFaqUids:null==t?void 0:t.welcomeFaqUids,quickFaqUids:null===(h=ee.serviceSettings)||void 0===h||null===(h=h.quickFaqs)||void 0===h?void 0:h.map((function(e){return e.uid})),faqUids:null===(w=ee.serviceSettings)||void 0===w||null===(w=w.faqs)||void 0===w?void 0:w.map((function(e){return e.uid})),guessFaqUids:null==ee||null===(S=ee.serviceSettings)||void 0===S||null===(S=S.guessFaqs)||void 0===S?void 0:S.map((function(e){return e.uid})),hotFaqUids:null==ee||null===(b=ee.serviceSettings)||void 0===b||null===(b=b.hotFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),shortcutFaqUids:null==ee||null===(F=ee.serviceSettings)||void 0===F||null===(F=F.shortcutFaqs)||void 0===F?void 0:F.map((function(e){return e.uid}))}),messageLeaveSettings:o()(o()({},ee.messageLeaveSettings),{},{messageLeaveTip:ce,worktimeUids:null===(U=ee.messageLeaveSettings)||void 0===U||null===(U=U.worktimes)||void 0===U?void 0:U.map((function(e){return e.uid}))}),robotSettings:o()(o()({},ee.robotSettings),{},{robotUid:null===(y=ee.robotSettings)||void 0===y||null===(y=y.robot)||void 0===y?void 0:y.uid}),maxThreadCount:(null==t?void 0:t.maxThreadCount)||10,timeoutRemindTime:(null==t?void 0:t.timeoutRemindTime)||5}),console.log("agentObject:",k),e.next=17,(0,v.sE)(k);case 17:x=e.sent,console.log("updateAgent response:",x),200===x.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),te(x.data)):(c.yw.destroy(),c.yw.error(x.message)),e.next=30;break;case 22:if(n!==q.aZD){e.next=30;break}return Z=o()(o()({},ne),{},{serviceSettings:o()(o()({},ne.serviceSettings),{},{topTip:fe,showTopTip:A,welcomeTip:ue,agentCloseTip:qe,autoCloseTip:Ue,autoCloseMin:(null==t?void 0:t.autoCloseMin)||25,showLogo:(null==t?void 0:t.showLogo)||!0,welcomeKbUid:null==t?void 0:t.welcomeKbUid,welcomeFaqUids:null==t?void 0:t.welcomeFaqUids,quickFaqUids:null===(C=ne.serviceSettings)||void 0===C||null===(C=C.quickFaqs)||void 0===C?void 0:C.map((function(e){return e.uid})),faqUids:null===(M=ne.serviceSettings)||void 0===M||null===(M=M.faqs)||void 0===M?void 0:M.map((function(e){return e.uid})),guessFaqUids:null==ne||null===(j=ne.serviceSettings)||void 0===j||null===(j=j.guessFaqs)||void 0===j?void 0:j.map((function(e){return e.uid})),hotFaqUids:null==ne||null===(T=ne.serviceSettings)||void 0===T||null===(T=T.hotFaqs)||void 0===T?void 0:T.map((function(e){return e.uid})),shortcutFaqUids:null==ne||null===(R=ne.serviceSettings)||void 0===R||null===(R=R.shortcutFaqs)||void 0===R?void 0:R.map((function(e){return e.uid}))}),messageLeaveSettings:o()(o()({},ne.messageLeaveSettings),{},{messageLeaveTip:ce,worktimeUids:null===(P=ne.messageLeaveSettings)||void 0===P||null===(P=P.worktimes)||void 0===P?void 0:P.map((function(e){return e.uid}))}),robotSettings:o()(o()({},ne.robotSettings),{},{robotUid:null===(I=ne.robotSettings)||void 0===I||null===(I=I.robot)||void 0===I?void 0:I.uid}),agentUids:ne.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",Z),e.next=27,(0,p.W5)(Z);case 27:K=e.sent,console.log("updateWorkGroup response:",K),200===K.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),oe(K.data)):(c.yw.destroy(),c.yw.error(K.message));case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,R.jsxs)(S.A,{form:u,onFinish:Me,style:{marginLeft:"20px"},children:[(0,R.jsx)(b.Z,{name:"showTopTip",width:"md",label:a.formatMessage({id:"agent.settings.show.top.tip"}),fieldProps:{onChange:function(e){var t,i;if(console.log("checked = ".concat(e.target.checked,", showTopTip:").concat(null==ee||null===(t=ee.serviceSettings)||void 0===t?void 0:t.showTopTip)),K(e.target.checked),e.target.checked)if(n===q._X4)me(P(null==Y||null===(i=Y.serviceSettings)||void 0===i?void 0:i.topTip));else if(n===q.Njn){var o;me(P(null==ee||null===(o=ee.serviceSettings)||void 0===o?void 0:o.topTip))}else if(n===q.aZD){var s;me(P(null==ne||null===(s=ne.serviceSettings)||void 0===s?void 0:s.topTip))}}}}),A&&(0,R.jsx)(S.A.Item,{name:"topTip",label:a.formatMessage({id:"agent.settings.top.tip"}),rules:[{required:!0,message:a.formatMessage({id:"agent.settings.top.tip.required"})}],children:(0,R.jsx)(x.Z,{placeholder:a.formatMessage({id:"agent.settings.top.tip.placeholder"}),value:fe,toolbarKeys:(0,C.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){me(e)}})}),(0,R.jsx)(S.A.Item,{name:"welcomeTip",label:a.formatMessage({id:"agent.settings.welcome.tip"}),tooltip:a.formatMessage({id:"agent.settings.welcome.tip"}),rules:[{required:!0,message:a.formatMessage({id:"agent.settings.welcome.tip.required"})}],children:(0,R.jsx)(x.Z,{placeholder:a.formatMessage({id:"agent.settings.welcome.tip.placeholder"}),value:ue,toolbarKeys:(0,C.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){le(e)}})}),(0,R.jsx)(F.Z,{name:"welcomeKbUid",width:"md",label:a.formatMessage({id:"menu.kbase.select",defaultMessage:"选择欢迎语常见问题知识库"}),options:null==E||null===(t=E.data)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.map((function(e){return{label:P(e.name),value:e.uid}})),fieldProps:{onChange:function(e){console.log("selected kbase:",e),G(e),xe(e)},allowClear:!0,placeholder:(0,R.jsx)(y.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),(0,R.jsx)(F.Z,{name:"welcomeFaqUids",width:"md",label:a.formatMessage({id:"menu.kbase.faq.welcome"}),options:null==N||null===(i=N.data)||void 0===i||null===(i=i.content)||void 0===i?void 0:i.map((function(e){return{label:P(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:(0,R.jsx)(y.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),n!==q._X4&&(0,R.jsx)(S.A.Item,{name:"messageLeaveTip",label:a.formatMessage({id:"agent.settings.leave.msg"}),rules:[{required:!0,message:a.formatMessage({id:"agent.settings.leave.msg.required"})}],children:(0,R.jsx)(x.Z,{placeholder:a.formatMessage({id:"agent.settings.leave.msg.placeholder"}),value:ce,toolbarKeys:(0,C.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){ve(e)}})}),n!==q._X4&&(0,R.jsx)(S.A.Item,{name:"agentCloseTip",label:a.formatMessage({id:"agent.settings.agent.close.tip"}),tooltip:a.formatMessage({id:"agent.settings.agent.close.tip.tooltip"}),rules:[{required:!0,message:a.formatMessage({id:"agent.settings.agent.close.tip.required"})}],children:(0,R.jsx)(x.Z,{placeholder:a.formatMessage({id:"agent.settings.agent.close.tip.placeholder"}),value:qe,toolbarKeys:(0,C.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){Se(e)}})}),(0,R.jsx)(S.A.Item,{name:"autoCloseTip",label:a.formatMessage({id:"agent.settings.auto.close.tip"}),tooltip:a.formatMessage({id:"agent.settings.auto.close.tip.tooltip"}),rules:[{required:!0,message:a.formatMessage({id:"agent.settings.auto.close.tip.required"})}],children:(0,R.jsx)(x.Z,{placeholder:a.formatMessage({id:"agent.settings.auto.close.tip.placeholder"}),value:Ue,toolbarKeys:(0,C.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){ye(e)}})}),n===q.Njn&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("p",{children:a.formatMessage({id:"agent.settings.max.thread.tip1"})}),(0,R.jsx)("p",{children:a.formatMessage({id:"agent.settings.max.thread.tip2"})}),(0,R.jsx)("p",{children:a.formatMessage({id:"agent.settings.max.thread.tip3"})}),(0,R.jsx)(U.Z,{width:"md",name:"maxThreadCount",label:a.formatMessage({id:"agent.settings.max.thread"}),min:0}),(0,R.jsx)(U.Z,{width:"md",name:"timeoutRemindTime",label:a.formatMessage({id:"agent.settings.timeout.remind",defaultMessage:"超时提醒时间"}),tooltip:a.formatMessage({id:"agent.settings.timeout.remind.tooltip",defaultMessage:"超过设定时间未回复客户将收到提醒"}),min:1,fieldProps:{addonAfter:a.formatMessage({id:"time.minute",defaultMessage:"分钟"})}})]}),(0,R.jsx)(U.Z,{width:"md",name:"autoCloseMin",label:a.formatMessage({id:"agent.settings.auto.close.time"}),tooltip:a.formatMessage({id:"agent.settings.auto.close.time.tooltip"}),min:1}),(0,R.jsx)(b.Z,{name:"showLogo",width:"md",label:a.formatMessage({id:"agent.settings.show.logo"}),tooltip:a.formatMessage({id:"agent.settings.show.logo.tooltip"}),fieldProps:{onChange:function(e){console.log("onShowLogoChange = ".concat(e.target.checked))}},disabled:!0})]})}},41335:function(e,t,i){var n=i(76711),o=i.n(n),s=i(90819),r=i.n(s),u=i(73193),l=i.n(u),a=i(89933),d=i.n(a),c=i(45332),v=i.n(c),g=i(55567),p=i(66942),f=i(43829),m=i(88192),h=i(36914),w=i(22607),q=i(17817),S=i(18232),b=i(48792),F=i(65511),U=i(44517),y=i(98976),k=i(43906),x=i(44194),C=i(68060),M=i(77259),j=i(97868),T=i(88638),R=i(55194),P=i(54985),I=(i(41313),i(99898),i(34353),i(64827)),Z=i(1867),A=i(39686),K=(i(59304),i(54881),i(31549)),L=(C.Z.Text,M.Z.Panel,j.Z.Option),V="no_response",W="keyword_match",N="visit_count",D="page_stay",_="time_range",O=[{label:"无响应触发",value:V}];t.Z=function(e){var t=e.type,i=(0,k.useIntl)(),n=b.A.useForm(),s=v()(n,1)[0],u=(0,x.useState)([]),a=v()(u,2),c=a[0],C=a[1],M=(0,x.useState)(!1),E=v()(M,2),Q=E[0],X=E[1],$=(0,x.useState)(null),B=v()($,2),G=(B[0],B[1],T.Z.useForm()),z=v()(G,1)[0],Y=(0,x.useState)(null),H=v()(Y,2),J=H[0],ee=(H[1],(0,w.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}}))),te=ee.currentRobot,ie=ee.setCurrentRobot,ne=(0,h.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),oe=ne.currentAgent,se=ne.setCurrentAgent,re=(0,q.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),ue=re.currentWorkgroup,le=re.setCurrentWorkgroup,ae=(0,x.useMemo)((function(){return t===S._X4?{chatType:S.xtN,chatSid:te.uid}:t===S.Njn?{chatType:S.scI,chatSid:oe.uid}:t===S.aZD?{chatType:S.vPY,chatSid:ue.uid}:{chatType:S.xtN,chatSid:""}}),[t,te,oe,ue]),de=ae.chatType,ce=ae.chatSid;(0,x.useEffect)((function(){if(t===S._X4){var e,i,n,o,r,u,l,a,d,c,v,g=null!=te&&null!==(e=te.serviceSettings)&&void 0!==e&&e.triggerConditions&&(null===(i=JSON.parse(null==te||null===(n=te.serviceSettings)||void 0===n?void 0:n.triggerConditions))||void 0===i?void 0:i.conditions)||[];s.setFieldsValue({autoPopup:null==te||null===(o=te.serviceSettings)||void 0===o?void 0:o.autoPopup,showInvite:null==te||null===(r=te.inviteSettings)||void 0===r?void 0:r.show,inviteText:null==te||null===(u=te.inviteSettings)||void 0===u?void 0:u.text,enableProactiveTrigger:null==te||null===(l=te.serviceSettings)||void 0===l?void 0:l.enableProactiveTrigger,noResponseTimeout:(null==te||null===(a=te.serviceSettings)||void 0===a?void 0:a.noResponseTimeout)||300,proactiveMessage:null==te||null===(d=te.serviceSettings)||void 0===d?void 0:d.proactiveMessage,maxProactiveCount:(null==te||null===(c=te.serviceSettings)||void 0===c?void 0:c.maxProactiveCount)||3,proactiveInterval:(null==te||null===(v=te.serviceSettings)||void 0===v?void 0:v.proactiveInterval)||600}),C(g)}else if(t===S.Njn){var p,f,m,h,w,q,b,F,U,y,k,x=null!=oe&&null!==(p=oe.serviceSettings)&&void 0!==p&&p.triggerConditions&&(null===(f=JSON.parse(null==oe||null===(m=oe.serviceSettings)||void 0===m?void 0:m.triggerConditions))||void 0===f?void 0:f.conditions)||[];s.setFieldsValue({autoPopup:null==oe||null===(h=oe.serviceSettings)||void 0===h?void 0:h.autoPopup,showInvite:null==oe||null===(w=oe.inviteSettings)||void 0===w?void 0:w.show,inviteText:null==oe||null===(q=oe.inviteSettings)||void 0===q?void 0:q.text,enableProactiveTrigger:null==oe||null===(b=oe.serviceSettings)||void 0===b?void 0:b.enableProactiveTrigger,noResponseTimeout:(null==oe||null===(F=oe.serviceSettings)||void 0===F?void 0:F.noResponseTimeout)||300,proactiveMessage:null==oe||null===(U=oe.serviceSettings)||void 0===U?void 0:U.proactiveMessage,maxProactiveCount:(null==oe||null===(y=oe.serviceSettings)||void 0===y?void 0:y.maxProactiveCount)||3,proactiveInterval:(null==oe||null===(k=oe.serviceSettings)||void 0===k?void 0:k.proactiveInterval)||600}),C(x)}else if(t===S.aZD){var M,j,T,R,P,I,Z,A,K,L,V,W=null!=ue&&null!==(M=ue.serviceSettings)&&void 0!==M&&M.triggerConditions&&(null===(j=JSON.parse(null==ue||null===(T=ue.serviceSettings)||void 0===T?void 0:T.triggerConditions))||void 0===j?void 0:j.conditions)||[];s.setFieldsValue({autoPopup:null==ue||null===(R=ue.serviceSettings)||void 0===R?void 0:R.autoPopup,showInvite:null==ue||null===(P=ue.inviteSettings)||void 0===P?void 0:P.show,inviteText:null==ue||null===(I=ue.inviteSettings)||void 0===I?void 0:I.text,enableProactiveTrigger:null==ue||null===(Z=ue.serviceSettings)||void 0===Z?void 0:Z.enableProactiveTrigger,noResponseTimeout:(null==ue||null===(A=ue.serviceSettings)||void 0===A?void 0:A.noResponseTimeout)||300,proactiveMessage:null==ue||null===(K=ue.serviceSettings)||void 0===K?void 0:K.proactiveMessage,maxProactiveCount:(null==ue||null===(L=ue.serviceSettings)||void 0===L?void 0:L.maxProactiveCount)||3,proactiveInterval:(null==ue||null===(V=ue.serviceSettings)||void 0===V?void 0:V.proactiveInterval)||600}),C(W)}}),[te,oe,ue,de,ce]);var ve=function(){var e=d()(r()().mark((function e(n){var o,s,u,a,d,v,h,w,q,b,F,U,y,k,x,C,M,j,T,R,P,I,Z,A,K,L,V,W,N;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("handlePreFormSubmit:",n),o=JSON.stringify({conditions:c}),t!==S._X4){e.next=12;break}return w=l()(l()({},te),{},{serviceSettings:l()(l()({},te.serviceSettings),{},{autoPopup:n.autoPopup,enableProactiveTrigger:n.enableProactiveTrigger,noResponseTimeout:n.noResponseTimeout,proactiveMessage:n.proactiveMessage,maxProactiveCount:n.maxProactiveCount,proactiveInterval:n.proactiveInterval,triggerConditions:o,welcomeFaqUids:null==te||null===(s=te.serviceSettings)||void 0===s||null===(s=s.welcomeFaqs)||void 0===s?void 0:s.map((function(e){return e.uid})),faqUids:null==te||null===(u=te.serviceSettings)||void 0===u||null===(u=u.faqs)||void 0===u?void 0:u.map((function(e){return e.uid})),quickFaqUids:null==te||null===(a=te.serviceSettings)||void 0===a||null===(a=a.quickFaqs)||void 0===a?void 0:a.map((function(e){return e.uid})),guessFaqUids:null==te||null===(d=te.serviceSettings)||void 0===d||null===(d=d.guessFaqs)||void 0===d?void 0:d.map((function(e){return e.uid})),hotFaqUids:null==te||null===(v=te.serviceSettings)||void 0===v||null===(v=v.hotFaqs)||void 0===v?void 0:v.map((function(e){return e.uid})),shortcutFaqUids:null==te||null===(h=te.serviceSettings)||void 0===h||null===(h=h.shortcutFaqs)||void 0===h?void 0:h.map((function(e){return e.uid}))}),inviteSettings:l()(l()({},te.inviteSettings),{},{show:n.showInvite,text:n.inviteText})}),console.log("robotObject:",w),e.next=7,(0,f.$l)(w);case 7:q=e.sent,console.log("updateRobot response:",q),200===q.code?(g.yw.destroy(),g.yw.success(i.formatMessage({id:"update.success"})),ie(q.data)):(g.yw.destroy(),g.yw.error(q.message)),e.next=30;break;case 12:if(t!==S.Njn){e.next=22;break}return j=l()(l()({},oe),{},{serviceSettings:l()(l()({},null==oe?void 0:oe.serviceSettings),{},{autoPopup:n.autoPopup,enableProactiveTrigger:n.enableProactiveTrigger,noResponseTimeout:n.noResponseTimeout,proactiveMessage:n.proactiveMessage,maxProactiveCount:n.maxProactiveCount,proactiveInterval:n.proactiveInterval,triggerConditions:o,welcomeFaqUids:null==oe||null===(b=oe.serviceSettings)||void 0===b||null===(b=b.welcomeFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),faqUids:null==oe||null===(F=oe.serviceSettings)||void 0===F||null===(F=F.faqs)||void 0===F?void 0:F.map((function(e){return e.uid})),quickFaqUids:null==oe||null===(U=oe.serviceSettings)||void 0===U||null===(U=U.quickFaqs)||void 0===U?void 0:U.map((function(e){return e.uid})),guessFaqUids:null==oe||null===(y=oe.serviceSettings)||void 0===y||null===(y=y.guessFaqs)||void 0===y?void 0:y.map((function(e){return e.uid})),hotFaqUids:null==oe||null===(k=oe.serviceSettings)||void 0===k||null===(k=k.hotFaqs)||void 0===k?void 0:k.map((function(e){return e.uid})),shortcutFaqUids:null==oe||null===(x=oe.serviceSettings)||void 0===x||null===(x=x.shortcutFaqs)||void 0===x?void 0:x.map((function(e){return e.uid}))}),robotSettings:l()(l()({},oe.robotSettings),{},{robotUid:null==oe||null===(C=oe.robotSettings)||void 0===C||null===(C=C.robot)||void 0===C?void 0:C.uid}),messageLeaveSettings:l()(l()({},oe.messageLeaveSettings),{},{worktimeUids:null==oe||null===(M=oe.messageLeaveSettings)||void 0===M||null===(M=M.worktimes)||void 0===M?void 0:M.map((function(e){return e.uid}))}),autoReplySettings:l()({},oe.autoReplySettings),inviteSettings:l()(l()({},oe.inviteSettings),{},{show:n.showInvite,text:n.inviteText})}),console.log("agentObject:",j),e.next=17,(0,p.sE)(j);case 17:T=e.sent,console.log("updateAgent response:",T),200===T.code?(g.yw.destroy(),g.yw.success(i.formatMessage({id:"update.success"})),se(T.data)):(g.yw.destroy(),g.yw.error(T.message)),e.next=30;break;case 22:if(t!==S.aZD){e.next=30;break}return W=l()(l()({},ue),{},{serviceSettings:l()(l()({},ue.serviceSettings),{},{autoPopup:n.autoPopup,enableProactiveTrigger:n.enableProactiveTrigger,noResponseTimeout:n.noResponseTimeout,proactiveMessage:n.proactiveMessage,maxProactiveCount:n.maxProactiveCount,proactiveInterval:n.proactiveInterval,triggerConditions:o,welcomeFaqUids:null==ue||null===(R=ue.serviceSettings)||void 0===R||null===(R=R.welcomeFaqs)||void 0===R?void 0:R.map((function(e){return e.uid})),faqUids:null==ue||null===(P=ue.serviceSettings)||void 0===P||null===(P=P.faqs)||void 0===P?void 0:P.map((function(e){return e.uid})),quickFaqUids:null===(I=ue.serviceSettings)||void 0===I||null===(I=I.quickFaqs)||void 0===I?void 0:I.map((function(e){return e.uid})),guessFaqUids:null==ue||null===(Z=ue.serviceSettings)||void 0===Z||null===(Z=Z.guessFaqs)||void 0===Z?void 0:Z.map((function(e){return e.uid})),hotFaqUids:null==ue||null===(A=ue.serviceSettings)||void 0===A||null===(A=A.hotFaqs)||void 0===A?void 0:A.map((function(e){return e.uid})),shortcutFaqUids:null==ue||null===(K=ue.serviceSettings)||void 0===K||null===(K=K.shortcutFaqs)||void 0===K?void 0:K.map((function(e){return e.uid}))}),robotSettings:l()(l()({},ue.robotSettings),{},{robotUid:null==ue||null===(L=ue.robotSettings)||void 0===L||null===(L=L.robot)||void 0===L?void 0:L.uid}),messageLeaveSettings:l()(l()({},ue.messageLeaveSettings),{},{worktimeUids:null==ue||null===(V=ue.messageLeaveSettings)||void 0===V||null===(V=V.worktimes)||void 0===V?void 0:V.map((function(e){return e.uid}))}),inviteSettings:l()(l()({},ue.inviteSettings),{},{show:n.showInvite,text:n.inviteText}),agentUids:ue.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",W),e.next=27,(0,m.W5)(W);case 27:N=e.sent,console.log("updateWorkGroup response:",N),200===N.code?(g.yw.destroy(),g.yw.success(i.formatMessage({id:"update.success"})),le(N.data)):(g.yw.destroy(),g.yw.error(N.message));case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,K.jsxs)("div",{children:[(0,K.jsxs)(b.A,{form:s,onFinish:ve,children:[(0,K.jsxs)(I.Z,{title:"主动触发设置",children:[(0,K.jsx)(F.Z,{width:"md",name:"enableProactiveTrigger",label:"启用主动触发"}),(0,K.jsx)(b.A.Group,{children:(0,K.jsx)(U.Z,{width:"md",name:"proactiveMessage",label:"主动发送的消息内容",placeholder:"例如:您好,看起来您有一段时间没有互动了。请问还需要帮助吗?"})}),(0,K.jsx)(b.A.Group,{children:(0,K.jsx)(y.Z,{width:"xs",name:"noResponseTimeout",label:"无响应超时时间(秒)",min:1,fieldProps:{addonAfter:"秒"}})})]}),(0,K.jsx)(Z.Z,{})]}),(0,K.jsx)(A.Z,{title:null!==J?"编辑触发条件":"添加触发条件",open:Q,onOk:function(){z.validateFields().then((function(e){var t=e.keywords;t&&"string"==typeof t&&(t=t.split(",").map((function(e){return e.trim()})).filter((function(e){return e})));var i={type:e.type,message:e.message,timeout:e.type===V||e.type===D?e.timeout:void 0,keywords:e.type===W?t:void 0,threshold:e.type===N?e.threshold:void 0,start:e.type===_?e.start:void 0,end:e.type===_?e.end:void 0};if(null!==J){var n=o()(c);n[J]=i,C(n)}else C([].concat(o()(c),[i]));X(!1),z.resetFields()}))},onCancel:function(){return X(!1)},width:600,children:(0,K.jsxs)(T.Z,{form:z,layout:"vertical",initialValues:{type:V,timeout:300,message:"您好,需要帮助吗?"},children:[(0,K.jsx)(T.Z.Item,{name:"type",label:"触发类型",rules:[{required:!0,message:"请选择触发类型"}],children:(0,K.jsx)(j.Z,{children:O.map((function(e){return(0,K.jsx)(L,{value:e.value,children:e.label},e.value)}))})}),function(){switch(z.getFieldValue("type")){case V:return(0,K.jsx)(T.Z.Item,{name:"timeout",label:"无响应超时时间(秒)",rules:[{required:!0,message:"请输入超时时间"}],children:(0,K.jsx)(R.Z,{min:1})});case W:return(0,K.jsx)(T.Z.Item,{name:"keywords",label:"关键词列表(逗号分隔)",rules:[{required:!0,message:"请输入关键词"}],children:(0,K.jsx)(P.Z,{placeholder:"例如: 价格, 费用, 多少钱"})});case N:return(0,K.jsx)(T.Z.Item,{name:"threshold",label:"访问次数阈值",rules:[{required:!0,message:"请输入访问次数"}],children:(0,K.jsx)(R.Z,{min:1})});case D:return(0,K.jsx)(T.Z.Item,{name:"timeout",label:"页面停留时间(秒)",rules:[{required:!0,message:"请输入停留时间"}],children:(0,K.jsx)(R.Z,{min:1})});case _:return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T.Z.Item,{name:"start",label:"开始时间",rules:[{required:!0,message:"请输入开始时间"}],children:(0,K.jsx)(P.Z,{placeholder:"格式: HH:mm, 例如: 09:00"})}),(0,K.jsx)(T.Z.Item,{name:"end",label:"结束时间",rules:[{required:!0,message:"请输入结束时间"}],children:(0,K.jsx)(P.Z,{placeholder:"格式: HH:mm, 例如: 18:00"})})]});default:return null}}(),(0,K.jsx)(T.Z.Item,{name:"message",label:"触发消息",rules:[{required:!0,message:"请输入触发后发送的消息"}],children:(0,K.jsx)(P.Z.TextArea,{rows:3,placeholder:"触发条件满足后发送给用户的消息"})})]})})]})}},19713:function(e,t,i){i.d(t,{Z:function(){return l}});i(44194);var n=i(75002),o=i(43906),s=i(31549),r=function(e){e.type,(0,o.useIntl)();return(0,s.jsx)(s.Fragment,{})},u=i(24052),l=function(e){var t=e.type,i=[{key:"web",label:"Web",children:(0,s.jsx)(u.Z,{type:t})}];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r,{type:t}),(0,s.jsx)(n.Z,{tabPosition:"left",items:i})]})}},71208:function(e,t,i){i.d(t,{G:function(){return v}});var n=i(73193),o=i.n(n),s=(i(44194),i(50220)),r=i(18232),u=i(28977),l=i.n(u),a=i(55567),d=i(81343),c=i(31549),v=function(e){var t=e.children,i=e.onSuccess,n=e.onError,u={file:null,fileName:"test.png",fileType:"image/png",isAvatar:"true",kbType:r.IrL,categoryUid:"",kbUid:"",client:r.bVn},v={name:"file",accept:"image/*",action:(0,d.M$)(),headers:{Authorization:"Bearer "+localStorage.getItem(r.LA8)},data:u,showUploadList:!1,beforeUpload:function(e){console.log("beforeUpload",e);var t=l()(new Date).format("YYYYMMDDHHmmss")+"_"+e.name;return u.file=e,u.fileName=t,u.fileType=e.type,console.log("beforeUpload",u),!0},onChange:function(e){if("uploading"!==e.file.status&&console.log("not uploading:",e.file),"done"===e.file.status)if(console.log("response: ",e.file.response),200===e.file.response.code){var t=e.file.response.data.fileUrl;i(t),a.yw.success("".concat(e.file.name," 上传成功"))}else n(e.file),a.yw.error("".concat(e.file.name," 上传失败"));else"error"===e.file.status&&(a.yw.error("".concat(e.file.name," 上传失败")),n(e.file))}};return(0,c.jsx)(s.Z,o()(o()({},v),{},{children:t}))}}}]); |