"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[1507],{51507:(e,t,a)=>{a.r(t),a.d(t,{default:()=>w});var r=a(64323),s=a(97779),n=a(85163),o=a(48431),i=a.n(o),c=(a(33948),a(41637),a(74916),a(64765),a(23157),a(15306),a(54156)),l=a.n(c),p=a(21005),m=a(46351),u=a(95795),d=a(89658),h=a(32854);function g(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class f extends l().PureComponent{constructor(e){super(e),g(this,"handleAllow",(()=>{const e=new URLSearchParams(this.props.location.search),t={responseType:e.get("response_type"),clientId:e.get("client_id"),redirectUri:e.get("redirect_uri"),state:e.get("state"),scope:e.get("store")};this.props.actions.allowOAuth2(t).then((e=>{let{data:t,error:a}=e;t&&t.redirect?window.location.href=t.redirect:a&&this.setState({error:a.message})}))})),g(this,"handleDeny",(()=>{const e=new URLSearchParams(this.props.location.search).get("redirect_uri");e&&(e.startsWith("https://")||e.startsWith("http://"))?window.location.href=e+"?error=access_denied":(0,d.s)().replace("/error")})),this.state={}}componentDidMount(){const e=document.getElementById("antiClickjack");e&&e.parentNode&&e.parentNode.removeChild(e);const t=new URLSearchParams(this.props.location.search).get("client_id");t&&!/^[a-z0-9]+$/.test(t)||this.props.actions.getOAuthAppInfo(t).then((e=>{let{data:t}=e;t&&this.setState({app:t})}))}render(){const e=this.state.app;if(!e)return null;let t,a;return t=e.icon_url?e.icon_url:m.Z,this.state.error&&(a=l().createElement("div",{className:"prompt__error form-group"},l().createElement(u.Z,{error:this.state.error}))),l().createElement("div",{className:"container-fluid"},l().createElement("div",{className:"prompt"},l().createElement("div",{className:"prompt__heading"},l().createElement("div",{className:"prompt__app-icon"},l().createElement("img",{alt:"prompt icon",src:t,width:"50",height:"50"})),l().createElement("div",{className:"text"},l().createElement(h.Z,{id:"authorize.title",defaultMessage:"Authorize **{appName}** to Connect to Your **Mattermost** User Account",values:{appName:e.name}}))),l().createElement("p",null,l().createElement(h.Z,{id:"authorize.app",defaultMessage:"The app **{appName}** would like the ability to access and modify your basic information.",values:{appName:e.name}})),l().createElement("h2",{className:"prompt__allow"},l().createElement(h.Z,{id:"authorize.access",defaultMessage:"Allow **{appName}** access?",values:{appName:e.name}})),l().createElement("div",{className:"prompt__buttons"},l().createElement("button",{type:"submit",className:"btn btn-link authorize-btn",onClick:this.handleDeny},l().createElement(p.FormattedMessage,{id:"authorize.deny",defaultMessage:"Deny"})),l().createElement("button",{type:"submit",className:"btn btn-primary authorize-btn",onClick:this.handleAllow},l().createElement(p.FormattedMessage,{id:"authorize.allow",defaultMessage:"Allow"}))),a))}}g(f,"propTypes",{location:i().shape({search:i().string.isRequired}).isRequired,actions:i().shape({getOAuthAppInfo:i().func.isRequired,allowOAuth2:i().func.isRequired}).isRequired});const w=(0,r.connect)(null,(function(e){return{actions:(0,s.bindActionCreators)({getOAuthAppInfo:n.jI,allowOAuth2:n.yT},e)}}))(f)}}]);
//# sourceMappingURL=1507.8632c8c1586ca9a850be.js.map