From ea71fced95a6923926c92ada523840ebdbd0ef64 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 8 Apr 2019 15:18:58 +0200 Subject: Replace invoices & subscription info with links to website --- src/containers/settings/AccountScreen.js | 69 ++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 30 deletions(-) (limited to 'src/containers/settings/AccountScreen.js') diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index ce1b9c333..0c837fab9 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js @@ -9,6 +9,7 @@ import AppStore from '../../stores/AppStore'; import AccountDashboard from '../../components/settings/account/AccountDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; +import { WEBSITE } from '../../environment'; const { BrowserWindow } = remote; @@ -24,69 +25,77 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend onCloseWindow() { const { user, payment } = this.props.stores; user.getUserInfoRequest.invalidate({ immediately: true }); - payment.ordersDataRequest.invalidate({ immediately: true }); } reloadData() { const { user, payment } = this.props.stores; user.getUserInfoRequest.reload(); - payment.ordersDataRequest.reload(); payment.plansRequest.reload(); } async handlePaymentDashboard() { const { actions, stores } = this.props; - actions.payment.createDashboardUrl(); - - const dashboard = await stores.payment.createDashboardUrlRequest; - - if (dashboard.url) { - const paymentWindow = new BrowserWindow({ - title: '🔒 Franz Subscription Dashboard', - parent: remote.getCurrentWindow(), - modal: false, - width: 900, - minWidth: 600, - webPreferences: { - nodeIntegration: false, - }, - }); - paymentWindow.loadURL(dashboard.url); - - paymentWindow.on('closed', () => { - this.onCloseWindow(); - }); - } + // actions.payment.createDashboardUrl(); + + // const dashboard = await stores.payment.createDashboardUrlRequest; + + // if (dashboard.url) { + // const paymentWindow = new BrowserWindow({ + // title: '🔒 Franz Subscription Dashboard', + // parent: remote.getCurrentWindow(), + // modal: false, + // width: 900, + // minWidth: 600, + // webPreferences: { + // nodeIntegration: false, + // }, + // }); + // paymentWindow.loadURL(dashboard.url); + + // paymentWindow.on('closed', () => { + // this.onCloseWindow(); + // }); + // } + + const url = `${WEBSITE}/user/billing?token=${stores.user.authToken}&utm_source=app&utm_medium=edit_profile`; + + actions.app.openExternalUrl({ url }); + } + + handleWebsiteLink(route) { + const { actions, stores } = this.props; + + const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; + console.log(url); + + actions.app.openExternalUrl({ url }); } render() { const { user, payment } = this.props.stores; - const { openExternalUrl } = this.props.actions.app; const { user: userActions } = this.props.actions; const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; - const isLoadingOrdersInfo = payment.ordersDataRequest.isExecuting; const isLoadingPlans = payment.plansRequest.isExecuting; return ( this.reloadData()} - isCreatingPaymentDashboardUrl={payment.createDashboardUrlRequest.isExecuting} - openDashboard={price => this.handlePaymentDashboard(price)} - openExternalUrl={url => openExternalUrl({ url })} onCloseSubscriptionWindow={() => this.onCloseWindow()} deleteAccount={userActions.delete} isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} + openEditAccount={() => this.handleWebsiteLink('/user/profile')} + openBilling={() => this.handleWebsiteLink('/user/billing')} + openInvoices={() => this.handleWebsiteLink('/user/invoices')} /> ); -- cgit v1.2.3-70-g09d2 From 229c6017efbd0198747cba6e8997dc8ce4f9a7d4 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 8 Apr 2019 15:32:16 +0200 Subject: Clean up --- src/containers/settings/AccountScreen.js | 36 +------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/containers/settings/AccountScreen.js') diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 0c837fab9..4ac7328c6 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js @@ -1,4 +1,3 @@ -import { remote } from 'electron'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { inject, observer } from 'mobx-react'; @@ -11,8 +10,6 @@ import AccountDashboard from '../../components/settings/account/AccountDashboard import ErrorBoundary from '../../components/util/ErrorBoundary'; import { WEBSITE } from '../../environment'; -const { BrowserWindow } = remote; - export default @inject('stores', 'actions') @observer class AccountScreen extends Component { componentWillMount() { const { @@ -23,7 +20,7 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend } onCloseWindow() { - const { user, payment } = this.props.stores; + const { user } = this.props.stores; user.getUserInfoRequest.invalidate({ immediately: true }); } @@ -34,36 +31,6 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend payment.plansRequest.reload(); } - async handlePaymentDashboard() { - const { actions, stores } = this.props; - - // actions.payment.createDashboardUrl(); - - // const dashboard = await stores.payment.createDashboardUrlRequest; - - // if (dashboard.url) { - // const paymentWindow = new BrowserWindow({ - // title: '🔒 Franz Subscription Dashboard', - // parent: remote.getCurrentWindow(), - // modal: false, - // width: 900, - // minWidth: 600, - // webPreferences: { - // nodeIntegration: false, - // }, - // }); - // paymentWindow.loadURL(dashboard.url); - - // paymentWindow.on('closed', () => { - // this.onCloseWindow(); - // }); - // } - - const url = `${WEBSITE}/user/billing?token=${stores.user.authToken}&utm_source=app&utm_medium=edit_profile`; - - actions.app.openExternalUrl({ url }); - } - handleWebsiteLink(route) { const { actions, stores } = this.props; @@ -84,7 +51,6 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend Date: Thu, 11 Apr 2019 16:24:06 +0200 Subject: Don't invalidate user request on componentWillMount --- src/containers/settings/AccountScreen.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/containers/settings/AccountScreen.js') diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 4ac7328c6..b3f967353 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js @@ -11,14 +11,6 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; import { WEBSITE } from '../../environment'; export default @inject('stores', 'actions') @observer class AccountScreen extends Component { - componentWillMount() { - const { - user, - } = this.props.stores; - - user.getUserInfoRequest.invalidate({ immediately: true }); - } - onCloseWindow() { const { user } = this.props.stores; user.getUserInfoRequest.invalidate({ immediately: true }); -- cgit v1.2.3-70-g09d2