"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9744],{89744:(e,t,a)=>{a.r(t),a.d(t,{default:()=>f});var r=a(70314),n=a(36891),s=a(59713),o=(a(14078),a(68581),a(52077),a(83526),a(90938),a(911),a(92189),a(84390)),i=a.n(o),l=a(72060),c=a(38210),p=a(2664),m=a(62355),u=a(8243);function d(e,t,a){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var r=a.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class h extends i().PureComponent{constructor(e){super(e),d(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})}))})),d(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,u.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,this.state.error&&(a=i().createElement("div",{className:"prompt__error form-group"},i().createElement(c.Z,{error:this.state.error}))),i().createElement("div",{className:"container-fluid"},i().createElement("div",{className:"prompt"},i().createElement("div",{className:"prompt__heading"},i().createElement("div",{className:"prompt__app-icon"},i().createElement("img",{alt:"prompt icon",src:t,width:"50",height:"50"})),i().createElement("div",{className:"text"},i().createElement(p.Z,{id:"authorize.title",defaultMessage:"Authorize **{appName}** to Connect to Your **Mattermost** User Account",values:{appName:e.name}}))),i().createElement("p",null,i().createElement(p.Z,{id:"authorize.app",defaultMessage:"The app **{appName}** would like the ability to access and modify your basic information.",values:{appName:e.name}})),i().createElement("h2",{className:"prompt__allow"},i().createElement(p.Z,{id:"authorize.access",defaultMessage:"Allow **{appName}** access?",values:{appName:e.name}})),i().createElement("div",{className:"prompt__buttons"},i().createElement("button",{type:"submit",className:"btn btn-tertiary authorize-btn",onClick:this.handleDeny},i().createElement(l.FormattedMessage,{id:"authorize.deny",defaultMessage:"Deny"})),i().createElement("button",{type:"submit",className:"btn btn-primary authorize-btn",onClick:this.handleAllow},i().createElement(l.FormattedMessage,{id:"authorize.allow",defaultMessage:"Allow"}))),a))}}const f=(0,r.connect)(null,(function(e){return{actions:(0,n.bindActionCreators)({getOAuthAppInfo:s.jI,allowOAuth2:s.yT},e)}}))(h)}}]);
//# sourceMappingURL=9744.030b456564d00fd0ce15.js.map