webpackJsonp([18],{2144:function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var o=t.location.query.id;return(0,i.default)({},t,{hookId:o,hook:e.entities.integrations.outgoingHooks[o],updateOutgoingHookRequest:e.requests.integrations.createOutgoingHook})}function a(e){return{actions:(0,d.bindActionCreators)({updateOutgoingHook:l.updateOutgoingHook,getOutgoingHook:l.getOutgoingHook},e)}}Object.defineProperty(t,"__esModule",{value:!0});var u=o(19),i=r(u),s=o(29),d=o(20),l=o(743),f=o(2386),g=r(f);t.default=(0,s.connect)(n,a)(g.default)},2386:function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=o(76),a=r(n),u=o(77),i=r(u),s=o(6),d=r(s),l=o(4),f=r(l),g=o(5),c=r(g),p=o(7),k=r(p),h=o(8),m=r(h),_=o(2),b=r(_),w=o(1),H=r(w),v=o(17),M=o(41),O=o(312),E=r(O),y=o(2107),q=r(y),x=o(237),C=r(x),R={id:"integrations.edit",defaultMessage:"Edit"},j={id:"update_outgoing_webhook.update",defaultMessage:"Update"},S=function(e){function t(e){var o=this;(0,f.default)(this,t);var r=(0,k.default)(this,(t.__proto__||(0,d.default)(t)).call(this,e));return r.editOutgoingHook=function(){var e=(0,i.default)(a.default.mark(function e(t){var n,u;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.newHook=t,r.props.hook.id&&(t.id=r.props.hook.id),r.props.hook.token&&(t.token=r.props.hook.token),n=r.props.hook.trigger_words.length===t.trigger_words.length&&r.props.hook.trigger_words.every(function(e,o){return e===t.trigger_words[o]}),u=r.props.hook.callback_urls.length===t.callback_urls.length&&r.props.hook.callback_urls.every(function(e,o){return e===t.callback_urls[o]}),r.props.hook.content_type===t.content_type&&n&&u){e.next=9;break}r.handleConfirmModal(),e.next=11;break;case 9:return e.next=11,r.submitHook();case 11:case"end":return e.stop()}},e,o)}));return function(t){return e.apply(this,arguments)}}(),r.handleConfirmModal=function(){r.setState({showConfirmModal:!0})},r.confirmModalDismissed=function(){r.setState({showConfirmModal:!1})},r.submitHook=(0,i.default)(a.default.mark(function e(){var t,n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.setState({serverError:""}),e.next=3,r.props.actions.updateOutgoingHook(r.newHook);case 3:if(t=e.sent,!(n=t.data)){e.next=8;break}return M.browserHistory.push("/"+r.props.team.name+"/integrations/outgoing_webhooks"),e.abrupt("return");case 8:r.setState({showConfirmModal:!1}),r.props.updateOutgoingHookRequest.error&&r.setState({serverError:r.props.updateOutgoingHookRequest.error.message});case 10:case"end":return e.stop()}},e,o)})),r.renderExtra=function(){var e=H.default.createElement(v.FormattedMessage,{id:"update_outgoing_webhook.update",defaultMessage:"Update"}),t=H.default.createElement(v.FormattedMessage,{id:"update_outgoing_webhook.confirm",defaultMessage:"Edit Outgoing Webhook"}),o=H.default.createElement(v.FormattedMessage,{id:"update_outgoing_webhook.question",defaultMessage:"Your changes may break the existing outgoing webhook. Are you sure you would like to update it?"});return H.default.createElement(E.default,{title:t,message:o,confirmButtonText:e,show:r.state.showConfirmModal,onConfirm:r.submitHook,onCancel:r.confirmModalDismissed})},r.state={showConfirmModal:!1,serverError:""},r}return(0,m.default)(t,e),(0,c.default)(t,[{key:"componentDidMount",value:function(){"true"===window.mm_config.EnableOutgoingWebhooks&&this.props.actions.getOutgoingHook(this.props.hookId)}},{key:"render",value:function(){return this.props.hook?H.default.createElement(q.default,{team:this.props.team,header:R,footer:j,renderExtra:this.renderExtra(),action:this.editOutgoingHook,serverError:this.state.serverError,initialHook:this.props.hook}):H.default.createElement(C.default,null)}}]),t}(H.default.PureComponent);S.propTypes={team:b.default.object.isRequired,hook:b.default.object,hookId:b.default.string.isRequired,updateOutgoingHookRequest:b.default.object.isRequired,actions:b.default.shape({updateOutgoingHook:b.default.func.isRequired,getOutgoingHook:b.default.func.isRequired}).isRequired},t.default=S}});
//# sourceMappingURL=18.05999cfcedd91e7c32de.js.map