mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-01 06:20:17 +00:00
1 line
80 KiB
JavaScript
1 line
80 KiB
JavaScript
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[5780],{90486: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(5488),d=i(14870);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),{},{channel:a.XtJ})}));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),{},{channel:a.XtJ})}));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),{},{channel:a.XtJ})}));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),{},{channel:a.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},92634: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(5488),d=i(14870);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),{},{channel:a.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},72054: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(5025),p=i(82812),f=i(33232),m=i(18751),h=i(68100),w=i(34599),q=i(90297),S=i(32394),b=i(11137),F=i(47783),U=i(14870),y=i(49616),k=i(5780),x=i(44194),C=i(16698),M=i(87663),j=i(5488),T=i(94956),R=i(40629),A=i(97180),P=i(90486),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),I=(0,A.M)(),K=I.config,L=I.updateConfig,V=(0,w.u)((function(e){return e.currentOrg})),W=(0,x.useState)(),_=v()(W,2),N=_[0],X=_[1],D=(0,x.useState)(),O=v()(D,2),E=O[0],Q=O[1],$=(0,x.useState)(),B=v()($,2),G=B[0],J=B[1],z=(0,h.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),H=z.currentRobot,Y=z.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.ACv,chatSid:H.uid}:n===j.Njn?{chatType:j._0X,chatSid:te.uid}:n===j.aZD?{chatType:j.I$6,chatSid:oe.uid}:{chatType:j.ACv,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,P.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}},Q(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&&(J(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"),X(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}},X(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),J(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,A,P,Z,I,K,L,V,W,_,N,X,D,O,E;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}})))||[]})}),Y(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"})),P=r()(r()({},M.data),{},{serviceSettings:r()(r()({},M.data.serviceSettings),{},{faqs:(null===(A=M.data.serviceSettings.faqs)||void 0===A?void 0:A.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer}})))||[]})}),ie(P)):(g.yw.destroy(),g.yw.error(M.message)),e.next=33;break;case 24:if(n!==j.aZD){e.next=33;break}return N=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===(I=H.serviceSettings)||void 0===I||null===(I=I.quickFaqs)||void 0===I?void 0:I.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}))}),X=r()(r()({},oe),{},{serviceSettings:N,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===(_=oe.messageLeaveSettings)||void 0===_||null===(_=_.worktimes)||void 0===_?void 0:_.map((function(e){return e.uid}))}),agentUids:oe.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",X),e.next=30,(0,R.W5)(X);case 30:D=e.sent,console.log("updateWorkGroup response:",D),200===D.code?(g.yw.destroy(),g.yw.success(a.formatMessage({id:"update.success"})),E=r()(r()({},D.data),{},{serviceSettings:r()(r()({},D.data.serviceSettings),{},{faqs:(null===(O=D.data.serviceSettings.faqs)||void 0===O?void 0:O.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer}})))||[]})}),se(E)):(g.yw.destroy(),g.yw.error(D.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==E||null===(t=E.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),J(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==N||null===(i=N.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"})}})]})})}},94146: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(5025),v=i(82812),g=i(33232),p=i(18751),f=i(68100),m=i(34599),h=i(90297),w=i(32394),q=i(11137),S=i(47783),b=i(14870),F=i(49616),U=i(5780),y=i(44194),k=i(16698),x=i(87663),C=i(5488),M=i(94956),j=i(40629),T=i(97180),R=i(90486),A=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)(),P=((0,b.useNavigate)(),(0,p.Z)().translateString),Z=(0,T.M)(),I=Z.config,K=Z.updateConfig,L=(0,m.u)((function(e){return e.currentOrg})),V=(0,y.useState)(),W=d()(V,2),_=W[0],N=W[1],X=(0,y.useState)(),D=d()(X,2),O=D[0],E=D[1],Q=(0,y.useState)(),$=d()(Q,2),B=$[0],G=$[1],J=(0,f.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),z=J.currentRobot,H=J.setCurrentRobot,Y=(0,k.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),ee=Y.currentAgent,te=Y.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.ACv,chatSid:z.uid}:n===C.Njn?{chatType:C._0X,chatSid:ee.uid}:n===C.aZD?{chatType:C.I$6,chatSid:ne.uid}:{chatType:C.ACv,chatSid:""}}),[n,z,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?(E(i),n===C._X4&&null!=z&&null!==(o=z.serviceSettings)&&void 0!==o&&o.quickFaqKbUid?v=z.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"),N(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?(N(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&&z)u.setFieldsValue({showQuickFaqs:null==z||null===(t=z.serviceSettings)||void 0===t?void 0:t.showQuickFaqs,quickFaqKbUid:null==z||null===(i=z.serviceSettings)||void 0===i?void 0:i.quickFaqKbUid,quickFaqUids:null==z||null===(s=z.serviceSettings)||void 0===s||null===(s=s.quickFaqs)||void 0===s?void 0:s.map((function(e){return e.uid}))}),e=null==z||null===(r=z.serviceSettings)||void 0===r?void 0:r.quickFaqKbUid,K(o()(o()({},I),{},{chatConfig:o()(o()({},I.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()({},I),{},{chatConfig:o()(o()({},I.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()({},I),{},{chatConfig:o()(o()({},I.chatConfig),{},{org:null==L?void 0:L.uid,t:re,sid:ue})}))}e&&e!==B&&(console.log("快捷回复知识库ID变化,更新FAQ列表:",e),G(e),ae(e))}),[z,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,A,P,Z,I;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()({},z),{},{serviceSettings:o()(o()({},z.serviceSettings),{},{showQuickFaqs:t.showQuickFaqs,quickFaqKbUid:t.quickFaqKbUid,quickFaqUids:t.quickFaqUids,welcomeFaqUids:null==z||null===(i=z.serviceSettings)||void 0===i||null===(i=i.welcomeFaqs)||void 0===i?void 0:i.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})),guessFaqUids:null==z||null===(u=z.serviceSettings)||void 0===u||null===(u=u.guessFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})),hotFaqUids:null==z||null===(l=z.serviceSettings)||void 0===l||null===(l=l.hotFaqs)||void 0===l?void 0:l.map((function(e){return e.uid})),shortcutFaqUids:null==z||null===(d=z.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===(A=ne.robotSettings)||void 0===A||null===(A=A.robot)||void 0===A?void 0:A.uid}),messageLeaveSettings:o()(o()({},ne.messageLeaveSettings),{},{worktimeUids:null==ne||null===(P=ne.messageLeaveSettings)||void 0===P||null===(P=P.worktimes)||void 0===P?void 0:P.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:I=e.sent,console.log("updateWorkGroup response:",I),200===I.code?(c.yw.destroy(),c.yw.success(a.formatMessage({id:"update.success"})),oe(I.data)):(c.yw.destroy(),c.yw.error(I.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,A.jsx)("div",{children:(0,A.jsxs)(w.A,{form:u,layout:"vertical",onFinish:de,submitter:{render:function(e,t){return(0,A.jsxs)(F.Z,{children:[t,(0,A.jsx)(U.ZP,{color:"danger",variant:"outlined",icon:(0,A.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,A.jsx)(q.Z,{label:a.formatMessage({id:"faq.show.quick.buttons"}),name:"showQuickFaqs",fieldProps:{onChange:ce}}),(0,A.jsx)(S.Z,{name:"quickFaqKbUid",width:"md",label:a.formatMessage({id:"quick.kbase.select",defaultMessage:"选择输入框上方的快捷按钮知识库"}),options:null==O||null===(t=O.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),u.setFieldValue("quickFaqUids",[]),ae(e)},allowClear:!0,placeholder:(0,A.jsx)(b.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),(0,A.jsx)(S.Z,{name:"quickFaqUids",width:"md",label:a.formatMessage({id:"menu.kbase.quickbutton"}),options:null==_||null===(i=_.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,A.jsx)(b.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}})]})})}},74790:function(e,t,i){i(90819),i(73193),i(89933),i(45332),i(94956),i(33232),i(40629),i(16698),i(68100),i(87663),i(5488),i(14870),i(44194),i(31549)},50027:function(e,t,i){i(90819),i(73193),i(89933),i(45332),i(94956),i(33232),i(40629),i(16698),i(68100),i(87663),i(5488),i(14870),i(44194),i(31549)},59956: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(5025),v=i(94956),g=i(33232),p=i(40629),f=i(16698),m=i(68100),h=i(87663),w=i(5488),q=i(32394),S=i(11137),b=i(14870),F=i(44194),U=i(97180),y=i(49616),k=i(5780),x=i(90297),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,A=(0,f.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),P=A.currentAgent,Z=A.setCurrentAgent,I=(0,h.$)((function(e){return{currentWorkgroup:e.currentWorkgroup,setCurrentWorkgroup:e.setCurrentWorkgroup}})),K=I.currentWorkgroup,L=I.setCurrentWorkgroup,V=(0,F.useMemo)((function(){return t===w._X4?{chatType:w.ACv,chatSid:T.uid}:t===w.Njn?{chatType:w._0X,chatSid:P.uid}:t===w.aZD?{chatType:w.I$6,chatSid:K.uid}:{chatType:w.ACv,chatSid:""}}),[t,T,P,K]),W=V.chatType,_=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:_})}));else if(t===w.Njn){var d,c,v,g,p,f;s.setFieldsValue({autoPopup:null==P||null===(d=P.serviceSettings)||void 0===d?void 0:d.autoPopup,showInvite:null==P||null===(c=P.inviteSettings)||void 0===c?void 0:c.show,inviteText:null==P||null===(v=P.inviteSettings)||void 0===v?void 0:v.text}),M(l()(l()({},a),{},{autoPopup:null==P||null===(g=P.serviceSettings)||void 0===g?void 0:g.autoPopup,inviteConfig:{show:null==P||null===(p=P.inviteSettings)||void 0===p?void 0:p.show,text:null==P||null===(f=P.inviteSettings)||void 0===f?void 0:f.text},chatConfig:l()(l()({},a.chatConfig),{},{t:W,sid:_})}))}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:_})}))}}),[T,P,K,W,_]);var N=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,A,I,V,W,_,N,X,D,O;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()({},P),{},{serviceSettings:l()(l()({},null==P?void 0:P.serviceSettings),{},{autoPopup:n.autoPopup,welcomeFaqUids:null==P||null===(q=P.serviceSettings)||void 0===q||null===(q=q.faqs)||void 0===q?void 0:q.map((function(e){return e.uid})),faqUids:null==P||null===(S=P.serviceSettings)||void 0===S||null===(S=S.faqs)||void 0===S?void 0:S.map((function(e){return e.uid})),quickFaqUids:null==P||null===(b=P.serviceSettings)||void 0===b||null===(b=b.quickFaqs)||void 0===b?void 0:b.map((function(e){return e.uid})),guessFaqUids:null==P||null===(F=P.serviceSettings)||void 0===F||null===(F=F.guessFaqs)||void 0===F?void 0:F.map((function(e){return e.uid})),hotFaqUids:null==P||null===(U=P.serviceSettings)||void 0===U||null===(U=U.hotFaqs)||void 0===U?void 0:U.map((function(e){return e.uid})),shortcutFaqUids:null==P||null===(y=P.serviceSettings)||void 0===y||null===(y=y.shortcutFaqs)||void 0===y?void 0:y.map((function(e){return e.uid}))}),robotSettings:l()(l()({},P.robotSettings),{},{robotUid:null==P||null===(k=P.robotSettings)||void 0===k||null===(k=k.robot)||void 0===k?void 0:k.uid}),messageLeaveSettings:l()(l()({},P.messageLeaveSettings),{},{worktimeUids:null==P||null===(x=P.messageLeaveSettings)||void 0===x||null===(x=x.worktimes)||void 0===x?void 0:x.map((function(e){return e.uid}))}),autoReplySettings:l()({},P.autoReplySettings),inviteSettings:l()(l()({},P.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 D=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===(A=K.serviceSettings)||void 0===A||null===(A=A.faqs)||void 0===A?void 0:A.map((function(e){return e.uid})),quickFaqUids:null===(I=K.serviceSettings)||void 0===I||null===(I=I.quickFaqs)||void 0===I?void 0:I.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===(_=K.serviceSettings)||void 0===_||null===(_=_.shortcutFaqs)||void 0===_?void 0:_.map((function(e){return e.uid}))}),robotSettings:l()(l()({},K.robotSettings),{},{robotUid:null==K||null===(N=K.robotSettings)||void 0===N||null===(N=N.robot)||void 0===N?void 0:N.uid}),messageLeaveSettings:l()(l()({},K.messageLeaveSettings),{},{worktimeUids:null==K||null===(X=K.messageLeaveSettings)||void 0===X||null===(X=X.worktimes)||void 0===X?void 0:X.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:",D),e.next=26,(0,p.W5)(D);case 26:O=e.sent,console.log("updateWorkGroup response:",O),200===O.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),L(O.data)):(c.yw.destroy(),c.yw.error(O.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),X=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,N(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:N,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:X}}),!1]})})}},39120:function(e,t,i){i(31549)},10826: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(5025),v=i(94956),g=i(40629),p=i(16698),f=i(87663),m=i(5488),h=(i(33363),i(32394)),w=i(11137),q=i(14870),S=i(44194),b=(i(12624),i(68100)),F=i(33232),U=i(18751),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,A=T.setCurrentRobot,P=(0,p.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),Z=P.currentAgent,I=P.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,P,K,W,_,N,X,D,O;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"})),A(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"})),I(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 D=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===(P=L.serviceSettings)||void 0===P||null===(P=P.faqs)||void 0===P?void 0:P.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===(_=L.serviceSettings)||void 0===_||null===(_=_.shortcutFaqs)||void 0===_?void 0:_.map((function(e){return e.uid}))}),robotSettings:r()(r()({},L.robotSettings),{},{robotUid:null==L||null===(N=L.robotSettings)||void 0===N||null===(N=N.robot)||void 0===N?void 0:N.uid}),messageLeaveSettings:r()(r()({},L.messageLeaveSettings),{},{worktimeUids:null==L||null===(X=L.messageLeaveSettings)||void 0===X||null===(X=X.worktimes)||void 0===X?void 0:X.map((function(e){return e.uid}))}),agentUids:L.agents.map((function(e){return e.uid}))}),console.log("workgroupObject:",D),e.next=26,(0,g.W5)(D);case 26:O=e.sent,console.log("updateWorkGroup response:",O),200===O.code?(c.yw.destroy(),c.yw.success(i.formatMessage({id:"update.success"})),V(O.data)):(c.yw.destroy(),c.yw.error(O.message));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_=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:_}}),!1]})})}},3642: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(5025),v=i(94956),g=i(33232),p=i(40629),f=i(16698),m=i(68100),h=i(87663),w=i(5488),q=i(32394),S=i(11137),b=i(16331),F=i(14870),U=i(44194),y=i(49616),k=i(5780),x=i(97180),C=i(90297),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,A=T.setCurrentRobot,P=(0,f.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),Z=P.currentAgent,I=P.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.ACv,chatSid:R.uid}:t===w.Njn?{chatType:w._0X,chatSid:Z.uid}:t===w.aZD?{chatType:w.I$6,chatSid:L.uid}:{chatType:w.ACv,chatSid:""}}),[t,R,Z,L]),_=W.chatType,N=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:_,sid:N}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:_,sid:N}),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:_,sid:N}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:_,sid:N}),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:_,sid:N}),window:l()(l()({},a.window),{},{width:680})}):l()(l()({},a),{},{chatConfig:l()(l()({},a.chatConfig),{},{t:_,sid:N}),window:l()(l()({},a.window),{},{width:380})}))}}),[R,Z,L,_,N]);var X=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,P,K,W,_,N,X,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()({},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"})),A(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"})),I(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()({},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===(P=L.serviceSettings)||void 0===P||null===(P=P.quickFaqs)||void 0===P?void 0:P.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===(_=L.serviceSettings)||void 0===_||null===(_=_.shortcutFaqs)||void 0===_?void 0:_.map((function(e){return e.uid}))}),robotSettings:l()(l()({},L.robotSettings),{},{robotUid:null==L||null===(N=L.robotSettings)||void 0===N||null===(N=N.robot)||void 0===N?void 0:N.uid}),messageLeaveSettings:l()(l()({},L.messageLeaveSettings),{},{worktimeUids:null==L||null===(X=L.messageLeaveSettings)||void 0===X||null===(X=X.worktimes)||void 0===X?void 0:X.map((function(e){return e.uid}))}),agentUids:null==L||null===(D=L.agents)||void 0===D?void 0:D.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"})),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)}}(),D=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,X(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:X,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:D}}),(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地址"})}]})]})})}},1155: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(5025),v=i(94956),g=i(33232),p=i(40629),f=i(18751),m=i(16698),h=i(68100),w=i(87663),q=i(5488),S=i(32394),b=i(29591),F=i(47783),U=i(59606),y=i(14870),k=i(44194),x=i(12624),C=i(33363),M=i(34599),j=i(82812),T=i(90486),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)(),A=(0,f.Z)().translateString,P=(0,k.useState)(!1),Z=d()(P,2),I=Z[0],K=Z[1],L=(0,M.u)((function(e){return e.currentOrg})),V=(0,k.useState)(),W=d()(V,2),_=W[0],N=W[1],X=(0,k.useState)(),D=d()(X,2),O=D[0],E=D[1],Q=(0,k.useState)(),$=d()(Q,2),B=$[0],G=$[1],J=(0,h.V)((function(e){return{currentRobot:e.currentRobot,setCurrentRobot:e.setCurrentRobot}})),z=J.currentRobot,H=J.setCurrentRobot,Y=(0,m.E)((function(e){return{currentAgent:e.currentAgent,setCurrentAgent:e.setCurrentAgent}})),ee=Y.currentAgent,te=Y.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?(E(i),n===q._X4&&null!=z&&null!==(o=z.serviceSettings)&&void 0!==o&&o.welcomeKbUid?(G(z.serviceSettings.welcomeKbUid),u.setFieldValue("welcomeKbUid",z.serviceSettings.welcomeKbUid),xe(z.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?N(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(A(null==e?void 0:e.welcomeTip)),me(A(null==e?void 0:e.topTip)),Se(A(null==e?void 0:e.agentCloseTip)),ye(A(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(A(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(A(null==ne||null===(o=ne.messageLeaveSettings)||void 0===o?void 0:o.messageLeaveTip))}};(0,k.useEffect)((function(){n===q._X4?null!=z&&z.serviceSettings&&(console.log("初始化机器人设置:",z.serviceSettings),Ce(z.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))}),[z,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,A,P,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()({},z),{},{serviceSettings:o()(o()({},z.serviceSettings),{},{topTip:fe,showTopTip:I,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=z.serviceSettings)||void 0===i||null===(i=i.quickFaqs)||void 0===i?void 0:i.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})))||[],guessFaqUids:(null==z||null===(u=z.serviceSettings)||void 0===u||null===(u=u.guessFaqs)||void 0===u?void 0:u.map((function(e){return e.uid})))||[],hotFaqUids:(null==z||null===(l=z.serviceSettings)||void 0===l||null===(l=l.hotFaqs)||void 0===l?void 0:l.map((function(e){return e.uid})))||[],shortcutFaqUids:(null==z||null===(d=z.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:I,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:I,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===(A=ne.messageLeaveSettings)||void 0===A||null===(A=A.worktimes)||void 0===A?void 0:A.map((function(e){return e.uid}))}),robotSettings:o()(o()({},ne.robotSettings),{},{robotUid:null===(P=ne.robotSettings)||void 0===P||null===(P=P.robot)||void 0===P?void 0:P.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(A(null==z||null===(i=z.serviceSettings)||void 0===i?void 0:i.topTip));else if(n===q.Njn){var o;me(A(null==ee||null===(o=ee.serviceSettings)||void 0===o?void 0:o.topTip))}else if(n===q.aZD){var s;me(A(null==ne||null===(s=ne.serviceSettings)||void 0===s?void 0:s.topTip))}}}}),I&&(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==O||null===(t=O.data)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.map((function(e){return{label:A(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==_||null===(i=_.data)||void 0===i||null===(i=i.content)||void 0===i?void 0:i.map((function(e){return{label:A(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})]})}},67072: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(5025),p=i(94956),f=i(33232),m=i(40629),h=i(16698),w=i(68100),q=i(87663),S=i(5488),b=i(32394),F=i(11137),U=i(16331),y=i(59606),k=i(14870),x=i(44194),C=i(85817),M=i(67307),j=i(27904),T=i(20903),R=i(67206),A=i(27259),P=(i(88344),i(49616),i(5780),i(79401)),Z=i(82373),I=i(68349),K=(i(59304),i(54881),i(31549)),L=(C.Z.Text,M.Z.Panel,j.Z.Option),V="no_response",W="keyword_match",_="visit_count",N="page_stay",X="time_range",D=[{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),O=v()(M,2),E=O[0],Q=O[1],$=(0,x.useState)(null),B=v()($,2),G=(B[0],B[1],T.Z.useForm()),J=v()(G,1)[0],z=(0,x.useState)(null),H=v()(z,2),Y=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.ACv,chatSid:te.uid}:t===S.Njn?{chatType:S._0X,chatSid:oe.uid}:t===S.aZD?{chatType:S.I$6,chatSid:ue.uid}:{chatType:S.ACv,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,A,P,Z,I,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===(A=ue.inviteSettings)||void 0===A?void 0:A.show,inviteText:null==ue||null===(P=ue.inviteSettings)||void 0===P?void 0:P.text,enableProactiveTrigger:null==ue||null===(Z=ue.serviceSettings)||void 0===Z?void 0:Z.enableProactiveTrigger,noResponseTimeout:(null==ue||null===(I=ue.serviceSettings)||void 0===I?void 0:I.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,A,P,Z,I,K,L,V,W,_;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===(A=ue.serviceSettings)||void 0===A||null===(A=A.faqs)||void 0===A?void 0:A.map((function(e){return e.uid})),quickFaqUids:null===(P=ue.serviceSettings)||void 0===P||null===(P=P.quickFaqs)||void 0===P?void 0:P.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===(I=ue.serviceSettings)||void 0===I||null===(I=I.hotFaqs)||void 0===I?void 0:I.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:_=e.sent,console.log("updateWorkGroup response:",_),200===_.code?(g.yw.destroy(),g.yw.success(i.formatMessage({id:"update.success"})),le(_.data)):(g.yw.destroy(),g.yw.error(_.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)(P.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)(I.Z,{title:null!==Y?"编辑触发条件":"添加触发条件",open:E,onOk:function(){J.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===N?e.timeout:void 0,keywords:e.type===W?t:void 0,threshold:e.type===_?e.threshold:void 0,start:e.type===X?e.start:void 0,end:e.type===X?e.end:void 0};if(null!==Y){var n=o()(c);n[Y]=i,C(n)}else C([].concat(o()(c),[i]));Q(!1),J.resetFields()}))},onCancel:function(){return Q(!1)},width:600,children:(0,K.jsxs)(T.Z,{form:J,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:D.map((function(e){return(0,K.jsx)(L,{value:e.value,children:e.label},e.value)}))})}),function(){switch(J.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)(A.Z,{placeholder:"例如: 价格, 费用, 多少钱"})});case _:return(0,K.jsx)(T.Z.Item,{name:"threshold",label:"访问次数阈值",rules:[{required:!0,message:"请输入访问次数"}],children:(0,K.jsx)(R.Z,{min:1})});case N:return(0,K.jsx)(T.Z.Item,{name:"timeout",label:"页面停留时间(秒)",rules:[{required:!0,message:"请输入停留时间"}],children:(0,K.jsx)(R.Z,{min:1})});case X:return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T.Z.Item,{name:"start",label:"开始时间",rules:[{required:!0,message:"请输入开始时间"}],children:(0,K.jsx)(A.Z,{placeholder:"格式: HH:mm, 例如: 09:00"})}),(0,K.jsx)(T.Z.Item,{name:"end",label:"结束时间",rules:[{required:!0,message:"请输入结束时间"}],children:(0,K.jsx)(A.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)(A.Z.TextArea,{rows:3,placeholder:"触发条件满足后发送给用户的消息"})})]})})]})}},29787:function(e,t,i){i.d(t,{Z:function(){return l}});i(44194);var n=i(37963),o=i(14870),s=i(31549),r=function(e){e.type,(0,o.useIntl)();return(0,s.jsx)(s.Fragment,{})},u=i(11362),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})]})}}}]); |