text: "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),_react=require("react"),_react2=_interopRequireDefault(_react),_reduxConnect=require("rufUtils/redux-connect"),_reduxConnect2=_interopRequireDefault(_reduxConnect),_http=require("rufUtils/http"),_http2=_interopRequireDefault(_http),_reactRouterDom=require("react-router-dom"),_Loading=require("rufUtils/Loading"),_Loading2=_interopRequireDefault(_Loading),SetupExistingUser=function(e){function t(e,r){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),n=new URLSearchParams(e.location.search);return a.state={setupData:{id:n.get("id"),code:n.get("code")},team:""},a}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this;_http2.default.get("/data/setup?id="+this.state.setupData.id+"&code="+this.state.setupData.code).then(function(t){t.setup&&t.setup.teamToJoin?e.setState({team:t.setup.teamToJoin}):e.props.history.replace("/home")})}},{key:"accept",value:function(){var e=this;_http2.default.post("/data/setup/setupExistingUser",this.state.setupData).then(function(t){e.props.history.replace("/home")})}},{key:"decline",value:function(){this.props.history.replace("/home")}},{key:"render",value:function(){return this.state.team?_react2.default.createElement("div",{className:"container text-center"},_react2.default.createElement("h2",{className:"red"},"Invitation"),"You have been invited as a user for ",this.state.team,_react2.default.createElement("div",{className:"row"},_react2.default.createElement("div",{className:"col-4 text-right"},_react2.default.createElement("button",{className:"btn btn-primary",onClick:this.decline.bind(this)},"Decline")),_react2.default.createElement("div",{className:"col-4"}),_react2.default.createElement("div",{className:"col-4 text-left"},_react2.default.createElement("button",{className:"btn btn-primary",onClick:this.accept.bind(this)},"Accept")))):_react2.default.createElement("div",{className:"text-center"},_react2.default.createElement("h1",null,"Checking your verification link"),_react2.default.createElement(_Loading2.default,null))}}]),t}(_react.Component);exports.default=(0,_reactRouterDom.withRouter)((0,_reduxConnect2.default)(SetupExistingUser,{website:"website",user:"user"}));