(window.webpackJsonp=window.webpackJsonp||[]).push([[25],{1253:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var s=r(6),a=r.n(s),i=r(28);class n extends a.a.PureComponent{render(){return a.a.createElement(i.c,{id:"generic_icons.logout",defaultMessage:"Logout Icon"},e=>a.a.createElement("i",{className:"fa fa-1x fa-angle-left",title:e}))}}},1966:function(e,t,r){"use strict";r.r(t);var s=r(307),a=r(7),i=r(21),n=r(15),c=(r(51),r(137),r(170),r(35),r(603),r(16)),o=r.n(c),l=r(6),m=r.n(l),u=r(1268),d=r(1221),g=r(28),f=r(52),h=r(1136),v=r(1200),E=r(1135),p=r(1170),T=r(1253),S=r(1179),_=r(96),b=r(1286),O=r(42),y=r(0);function A(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 m.a.PureComponent{constructor(e){super(e),A(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}):h.e("/login?extra=".concat(y.j.GET_TERMS_ERROR))}),A(this,"handleLogoutClick",e=>{e.preventDefault(),h.e("/login")}),A(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(/^\/([^/]|$)/)?_.a.push(e):h.f()})}),A(this,"handleRejectTerms",()=>{this.setState({loadingDisagree:!0,serverError:null}),this.registerUserAction(!1,()=>{h.e("/login?extra=".concat(y.j.TERMS_REJECTED))})}),A(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:m.a.createElement(g.c,{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(f.memoizeResult)(e=>Object(O.e)(e))}componentDidMount(){this.props.termsEnabled?this.getTermsOfService():h.f()}render(){if(this.state.loading)return m.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",m.a.createElement("div",null,m.a.createElement(v.a,null),m.a.createElement("div",{className:"signup-header"},m.a.createElement("a",{href:"#",onClick:this.handleLogoutClick},m.a.createElement(T.a,null),m.a.createElement(g.c,{id:"web.header.logout",defaultMessage:"Logout"}))),m.a.createElement("div",null,m.a.createElement("div",{className:"signup-team__container terms-of-service__container"},m.a.createElement("div",{className:e},m.a.createElement("div",{className:"medium-center"},Object(b.a)(this.formattedText(this.state.customTermsOfServiceText),!1,{mentions:!1}))),m.a.createElement("div",{className:"terms-of-service__footer medium-center"},m.a.createElement(u.a,{className:"terms-of-service__button-group"},m.a.createElement(d.a,{bsStyle:"primary",disabled:this.state.loadingAgree||this.state.loadingDisagree,id:"acceptTerms",onClick:this.handleAcceptTerms,type:"submit"},this.state.loadingAgree&&m.a.createElement(p.a,null),m.a.createElement(g.c,{id:"terms_of_service.agreeButton",defaultMessage:"I Agree"})),m.a.createElement(d.a,{bsStyle:"link",disabled:this.state.loadingAgree||this.state.loadingDisagree,id:"rejectTerms",onClick:this.handleRejectTerms,type:"reset"},this.state.loadingDisagree&&m.a.createElement(p.a,null),m.a.createElement(g.c,{id:"terms_of_service.disagreeButton",defaultMessage:"I Disagree"}))),Boolean(this.state.serverError)&&m.a.createElement("div",{className:"terms-of-service__server-error alert alert-warning"},m.a.createElement(S.a,null)," ",this.state.serverError)))))}}A(R,"propTypes",{location:o.a.object,termsEnabled:o.a.bool.isRequired,actions:o.a.shape({getTermsOfService:o.a.func.isRequired,updateMyTermsOfServiceStatus:o.a.func.isRequired}).isRequired});t.default=Object(s.connect)((function(e){return{termsEnabled:"true"===Object(n.getConfig)(e).EnableCustomTermsOfService}}),(function(e){return{actions:Object(a.bindActionCreators)({getTermsOfService:i.getTermsOfService,updateMyTermsOfServiceStatus:i.updateMyTermsOfServiceStatus},e)}}))(R)}}]);
//# sourceMappingURL=25.1b44a8533cea1f4fbe2a.js.map