var __extends=(this&&this.__extends)||(function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||({__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b;})||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p];};return extendStatics(d,b);};return function(d,b){extendStatics(d,b);function __(){this.constructor=d;} d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __());};})();var __decorate=(this&&this.__decorate)||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r;};define(["require","exports","dojo/on","react","@login/styles/app-style","react-router-dom","@core/material-ui-components","@login/interfaces/initial-state-interface","@core/snackbar-container","@login/dialogs-container","@core/with-state-manager"],function(require,exports,on,React,app_style_1,react_router_dom_1,material_ui_components_1,initial_state_interface_1,snackbar_container_1,dialogs_container_1,with_state_manager_1){Object.defineProperty(exports,"__esModule",{value:true});var LoginApp=(function(_super){__extends(LoginApp,_super);function LoginApp(props){var _this=_super.call(this,props)||this;_this._loaded_pages={};_this._loaded_utils={};_this.state=Object.assign(props,_this.props.state_manager.getRunState());_app.app=_this;return _this;} LoginApp.prototype.render=function(){return(React.createElement("div",{className:app_style_1.styles.app_container},React.createElement(react_router_dom_1.Switch,null,React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/login",component:this.pageFactory.bind(this,'login')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/mfa/",component:this.pageFactory.bind(this,'mfa')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/enable-mfa/",component:this.newPageFactory.bind(this,'enable-mfa')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/forgot-password",component:this.pageFactory.bind(this,'forgot-password')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/reset-password",component:this.pageFactory.bind(this,'reset-password')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/reset-pass",component:this.pageFactory.bind(this,'reset-password')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/recover-account",component:this.pageFactory.bind(this,'recover-account')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/recover-account-confirmation",component:this.pageFactory.bind(this,'recover-account-confirmation')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/create-password",component:this.pageFactory.bind(this,'create-password')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/create-account",component:this.pageFactory.bind(this,'create-account')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/create-user",component:this.pageFactory.bind(this,'create-user')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/createUser",component:this.pageFactory.bind(this,'create-user')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/email-sent",component:this.pageFactory.bind(this,'email-sent')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/employee-offer/",component:this.pageFactory.bind(this,'employee-offer')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/futa-pay-selection",component:this.newPageFactory.bind(this,'futa-pay-selection')}),React.createElement(react_router_dom_1.Route,{exact:true,path:"/app/verify-action",component:this.newPageFactory.bind(this,'verify-action')}),React.createElement(react_router_dom_1.Route,{component:this.pageFactory.bind(this,'login')})),React.createElement(snackbar_container_1.default,null),React.createElement(dialogs_container_1.default,null)));};LoginApp.prototype.componentDidMount=function(){var _this=this;on(this.props.state_manager,this.props.state_manager.UPDATE_RUN_STATE,function(data){switch(data.property){case initial_state_interface_1.Initial_state_enum.page:_this.props.history.push("/app/"+data.value);break;}});};LoginApp.prototype.pageFactory=function(page_name){var _this=this;if(this._loaded_pages[page_name]){var Page=this._loaded_pages[page_name];return React.createElement(Page,{key:page_name,utils:new this._loaded_utils[page_name](),location:this.props.location});} window.require(["@login/views/"+page_name,"@login/utils/"+page_name+"-utils"],function(Page,Utils){_this._loaded_pages[page_name]=Page.default;_this._loaded_utils[page_name]=Utils.default;_this.forceUpdate();});return React.createElement("div",{style:{margin:'40px'}},React.createElement(material_ui_components_1.CircularProgress,null));};LoginApp.prototype.newPageFactory=function(page_name){var _this=this;if(this._loaded_pages[page_name]){var Page=this._loaded_pages[page_name];return React.createElement(Page,{key:page_name,location:this.props.location});} window.require(["@login/views/"+page_name],function(Page,Utils){_this._loaded_pages[page_name]=Page.default;_this.forceUpdate();});return React.createElement("div",{style:{margin:'40px'}},React.createElement(material_ui_components_1.CircularProgress,null));};LoginApp.prototype.showTopAlert=function(args){var _this=this;var content=args.content,variant=args.variant,secondary_button_content=args.secondary_button_content,secondary_button_action=args.secondary_button_action;this.props.state_manager.getAt("/run",function(state){_this.props.state_manager.putAt("/run",{data:state.set(initial_state_interface_1.Initial_state_enum.snackbar_queue,[{content:content,variant:variant,secondary_button_content:secondary_button_content,secondary_button_action:secondary_button_action}])});});};LoginApp.prototype.xhrError=function(error){console.error(error);var text="";if(typeof error==="string"){text=error;} else{if(error.data){text=error.data.error_message;}} this.showTopAlert({content:"We are unable to perform your request, "+text,variant:"error"});};Object.defineProperty(LoginApp.prototype,"router",{get:function(){return this._router;},set:function(router){this._router=router;},enumerable:true,configurable:true});LoginApp=__decorate([material_ui_components_1.withStyles({}),react_router_dom_1.withRouter,with_state_manager_1.default],LoginApp);return LoginApp;}(React.Component));exports.default=LoginApp;});