webpackJsonp([19],{2151:function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var a=t.location.query.id;return(0,s.default)({},t,{isSystemAdmin:(0,l.isCurrentUserSystemAdmin)(e),oauthAppId:a,oauthApp:e.entities.integrations.oauthApps[a]})}function n(e){return{actions:(0,p.bindActionCreators)({getOAuthApp:d.getOAuthApp,editOAuthApp:d.editOAuthApp},e)}}Object.defineProperty(t,"__esModule",{value:!0});var o=a(19),s=r(o),i=a(29),p=a(20),d=a(743),l=a(50),f=a(2397),c=r(f);t.default=(0,i.connect)(u,n)(c.default)},2397:function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var u=a(76),n=r(u),o=a(77),s=r(o),i=a(6),p=r(i),d=a(4),l=r(d),f=a(5),c=r(f),h=a(7),m=r(h),A=a(8),g=r(A),_=a(1),v=r(_),b=a(2),M=r(b),k=a(41),w=a(17),O=a(237),y=r(O),E=a(312),x=r(E),C=a(2109),S=r(C),q={id:"integrations.edit",defaultMessage:"Edit"},R={id:"update_incoming_webhook.update",defaultMessage:"Update"},j=function(e){function t(e){var a=this;(0,l.default)(this,t);var r=(0,m.default)(this,(t.__proto__||(0,p.default)(t)).call(this,e));return r.editOAuthApp=function(){var e=(0,s.default)(n.default.mark(function e(t){var u;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.newApp=t,r.props.oauthApp.id&&(t.id=r.props.oauthApp.id),r.props.oauthApp.token&&(t.token=r.props.oauthApp.token),!1!==(u=r.props.oauthApp.callback_urls.length===t.callback_urls.length&&r.props.oauthApp.callback_urls.every(function(e,a){return e===t.callback_urls[a]}))){e.next=8;break}r.handleConfirmModal(),e.next=10;break;case 8:return e.next=10,r.submitOAuthApp();case 10:case"end":return e.stop()}},e,a)}));return function(t){return e.apply(this,arguments)}}(),r.handleConfirmModal=function(){r.setState({showConfirmModal:!0})},r.confirmModalDismissed=function(){r.setState({showConfirmModal:!1})},r.submitOAuthApp=(0,s.default)(n.default.mark(function e(){var t,u,o;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.setState({serverError:""}),e.next=3,r.props.actions.editOAuthApp(r.newApp);case 3:if(t=e.sent,u=t.data,o=t.error,!u){e.next=9;break}return k.browserHistory.push("/"+r.props.team.name+"/integrations/oauth2-apps"),e.abrupt("return");case 9:r.setState({showConfirmModal:!1}),o&&r.setState({serverError:o.message});case 11:case"end":return e.stop()}},e,a)})),r.renderExtra=function(){var e=v.default.createElement(w.FormattedMessage,{id:"update_command.update",defaultMessage:"Update"}),t=v.default.createElement(w.FormattedMessage,{id:"update_oauth_app.confirm",defaultMessage:"Edit OAuth 2.0 application"}),a=v.default.createElement(w.FormattedMessage,{id:"update_oauth_app.question",defaultMessage:"Your changes may break the existing OAuth 2.0 application. Are you sure you would like to update it?"});return v.default.createElement(x.default,{title:t,message:a,confirmButtonText:e,show:r.state.showConfirmModal,onConfirm:r.submitOAuthApp,onCancel:r.confirmModalDismissed})},r.state={showConfirmModal:!1,serverError:""},r}return(0,g.default)(t,e),(0,c.default)(t,[{key:"componentDidMount",value:function(){"true"===window.mm_config.EnableOAuthServiceProvider&&this.props.actions.getOAuthApp(this.props.oauthAppId)}},{key:"render",value:function(){return this.props.oauthApp?v.default.createElement(S.default,{team:this.props.team,isSystemAdmin:this.props.isSystemAdmin,header:q,footer:R,renderExtra:this.renderExtra(),action:this.editOAuthApp,serverError:this.state.serverError,initialApp:this.props.oauthApp}):v.default.createElement(y.default,null)}}]),t}(v.default.PureComponent);j.propTypes={team:M.default.object.isRequired,isSystemAdmin:M.default.bool,oauthAppId:M.default.string.isRequired,oauthApp:M.default.object,actions:M.default.shape({getOAuthApp:M.default.func.isRequired,editOAuthApp:M.default.func.isRequired}).isRequired},t.default=j}});
//# sourceMappingURL=19.d2fa8ab16af82387a176.js.map