"use strict";var R=Object.create;var n=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var q=Object.getPrototypeOf;var v=Object.prototype.hasOwnProperty;var u=(t,e)=>n(t,"name",{value:e,configurable:true});var L=(t,e)=>{for(var s in e)n(t,s,{get:e[s],enumerable:true})};var a=(t,e,s,r)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let o of I(e))if(!v.call(t,o)&&o!==s)n(t,o,{get:()=>e[o],enumerable:!(r=A(e,o))||r.enumerable})}return t};var p=(t,e,s)=>(s=t!=null?R(q(t)):{},a(e||!t||!t.__esModule?n(s,"default",{value:t,enumerable:true}):s,t));var U=t=>a(n({},"__esModule",{value:true}),t);var b={};L(b,{default:()=>y});module.exports=U(b);var c=require("react/jsx-runtime");var i=require("mobx-react");var l=require("react");var m=p(require("../../components/settings/account/AccountDashboard"));var f=p(require("../../components/util/ErrorBoundary"));var g=require("../../config");var E=require("../../environment-remote");class d extends l.Component{reloadData(){const{user:e}=this.props.stores;e.getUserInfoRequest.reload()}handleWebsiteLink(e){const{actions:s,stores:r}=this.props;const o=r.settings.all.app.server;const h=o===g.LIVE_FRANZ_API?r.user.getAuthURL(`${E.WEBSITE}${e}?utm_source=app&utm_medium=account_dashboard`):`${o}${e}`;s.app.openExternalUrl({url:h})}render(){const{user:e,settings:s}=this.props.stores;const{user:r}=this.props.actions;const o=e.getUserInfoRequest.isExecuting;return(0,c.jsx)(f.default,{children:(0,c.jsx)(m.default,{server:s.all.app.server,user:e.data,isLoading:o,userInfoRequestFailed:e.getUserInfoRequest.wasExecuted&&e.getUserInfoRequest.isError,retryUserInfoRequest:()=>this.reloadData(),deleteAccount:r.delete,isLoadingDeleteAccount:e.deleteAccountRequest.isExecuting,isDeleteAccountSuccessful:e.deleteAccountRequest.wasExecuted&&!e.deleteAccountRequest.isError,openEditAccount:()=>this.handleWebsiteLink("/user/profile"),openInvoices:()=>this.handleWebsiteLink("/user/invoices")})})}}u(d,"AccountScreen");var y=(0,i.inject)("stores","actions")((0,i.observer)(d));
