(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{1358:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var a=r(4),s=r.n(a),i=r(1213);class n extends s.a.PureComponent{render(){return s.a.createElement(i.a,{id:"generic_icons.logout",defaultMessage:"Logout Icon"},e=>s.a.createElement("i",{className:"fa fa-1x fa-angle-left",title:e}))}}},2214:function(e,t,r){"use strict";r.r(t);var a=r(290),s=r(7),i=r(15),n=r(14),c=r(99),o=(r(58),r(135),r(205),r(31),r(573),r(133)),l=r.n(o),m=r(4),u=r.n(m),d=r(1382),g=r(1319),f=r(1213),h=r(47),v=r(1226),p=r(1295),E=r(1225),T=r(1252),S=r(1358),b=r(1274),O=r(96),_=r(1488),j=r(37),y=r(0);function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class R extends u.a.PureComponent{constructor(e){super(e),M(this,"getTermsOfService",async()=>{this.setState({customTermsOfServiceId:"",customTermsOfServiceText:"",loading:!0});const{data:e}=await this.props.actions.getTermsOfService();e?this.setState({customTermsOfServiceId:e.id,customTermsOfServiceText:e.text,loading:!1}):v.e("/login?extra=".concat(y.j.GET_TERMS_ERROR))}),M(this,"handleLogoutClick",e=>{e.preventDefault(),v.e("/login")}),M(this,"handleAcceptTerms",()=>{this.setState({loadingAgree:!0,serverError:null}),this.registerUserAction(!0,()=>{const e=new URLSearchParams(this.props.location.search).get("redirect_to");e&&e.match(/^\/([^/]|$)/)?O.a.push(e):v.f()})}),M(this,"handleRejectTerms",()=>{this.setState({loadingDisagree:!0,serverError:null}),this.registerUserAction(!1,()=>{v.e("/login?extra=".concat(y.j.TERMS_REJECTED))})}),M(this,"registerUserAction",async(e,t)=>{const{data:r}=await this.props.actions.updateMyTermsOfServiceStatus(this.state.customTermsOfServiceId,e);r?t(r):this.setState({loadingAgree:!1,loadingDisagree:!1,serverError:u.a.createElement(f.a,{id:"terms_of_service.api_error",defaultMessage:"Unable to complete the request. If this issue persists, contact your System Administrator."})})}),this.state={customTermsOfServiceId:"",customTermsOfServiceText:"",loading:!0,loadingAgree:!1,loadingDisagree:!1,serverError:null},this.formattedText=Object(h.memoizeResult)(t=>Object(j.f)(t,{},e.emojiMap))}componentDidMount(){this.props.termsEnabled?this.getTermsOfService():v.f()}render(){if(this.state.loading)return u.a.createElement(E.a,null);let e="terms-of-service__markdown";return this.state.serverError?e+=" terms-of-service-error__height--fill":e+=" terms-of-service__height--fill",u.a.createElement("div",null,u.a.createElement(p.a,null),u.a.createElement("div",{className:"signup-header"},u.a.createElement("a",{href:"#",onClick:this.handleLogoutClick},u.a.createElement(S.a,null),u.a.createElement(f.a,{id:"web.header.logout",defaultMessage:"Logout"}))),u.a.createElement("div",null,u.a.createElement("div",{className:"signup-team__container terms-of-service__container"},u.a.createElement("div",{className:e},u.a.createElement("div",{className:"medium-center"},Object(_.a)(this.formattedText(this.state.customTermsOfServiceText),!1,{mentions:!1}))),u.a.createElement("div",{className:"terms-of-service__footer medium-center"},u.a.createElement(d.a,{className:"terms-of-service__button-group"},u.a.createElement(g.a,{bsStyle:"primary",disabled:this.state.loadingAgree||this.state.loadingDisagree,id:"acceptTerms",onClick:this.handleAcceptTerms,type:"submit"},this.state.loadingAgree&&u.a.createElement(T.a,null),u.a.createElement(f.a,{id:"terms_of_service.agreeButton",defaultMessage:"I Agree"})),u.a.createElement(g.a,{bsStyle:"link",disabled:this.state.loadingAgree||this.state.loadingDisagree,id:"rejectTerms",onClick:this.handleRejectTerms,type:"reset"},this.state.loadingDisagree&&u.a.createElement(T.a,null),u.a.createElement(f.a,{id:"terms_of_service.disagreeButton",defaultMessage:"I Disagree"}))),Boolean(this.state.serverError)&&u.a.createElement("div",{className:"terms-of-service__server-error alert alert-warning"},u.a.createElement(b.a,null)," ",this.state.serverError)))))}}M(R,"propTypes",{location:l.a.object,termsEnabled:l.a.bool.isRequired,actions:l.a.shape({getTermsOfService:l.a.func.isRequired,updateMyTermsOfServiceStatus:l.a.func.isRequired}).isRequired,emojiMap:l.a.object.isRequired});t.default=Object(a.connect)((function(e){return{termsEnabled:"true"===Object(n.getConfig)(e).EnableCustomTermsOfService,emojiMap:Object(c.a)(e)}}),(function(e){return{actions:Object(s.bindActionCreators)({getTermsOfService:i.getTermsOfService,updateMyTermsOfServiceStatus:i.updateMyTermsOfServiceStatus},e)}}))(R)}}]);
//# sourceMappingURL=24.5987816c3a6250e94d30.js.map