diff options
author | 2019-04-08 15:18:58 +0200 | |
---|---|---|
committer | 2019-04-08 15:18:58 +0200 | |
commit | ea71fced95a6923926c92ada523840ebdbd0ef64 (patch) | |
tree | ed5542a00b12a870fd6c426cad65b6daa797ebd6 /src/containers/settings | |
parent | remove console log (diff) | |
download | ferdium-app-ea71fced95a6923926c92ada523840ebdbd0ef64.tar.gz ferdium-app-ea71fced95a6923926c92ada523840ebdbd0ef64.tar.zst ferdium-app-ea71fced95a6923926c92ada523840ebdbd0ef64.zip |
Replace invoices & subscription info with links to website
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/AccountScreen.js | 69 |
1 files changed, 39 insertions, 30 deletions
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'; | |||
9 | 9 | ||
10 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; | 10 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; |
11 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 11 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
12 | import { WEBSITE } from '../../environment'; | ||
12 | 13 | ||
13 | const { BrowserWindow } = remote; | 14 | const { BrowserWindow } = remote; |
14 | 15 | ||
@@ -24,69 +25,77 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
24 | onCloseWindow() { | 25 | onCloseWindow() { |
25 | const { user, payment } = this.props.stores; | 26 | const { user, payment } = this.props.stores; |
26 | user.getUserInfoRequest.invalidate({ immediately: true }); | 27 | user.getUserInfoRequest.invalidate({ immediately: true }); |
27 | payment.ordersDataRequest.invalidate({ immediately: true }); | ||
28 | } | 28 | } |
29 | 29 | ||
30 | reloadData() { | 30 | reloadData() { |
31 | const { user, payment } = this.props.stores; | 31 | const { user, payment } = this.props.stores; |
32 | 32 | ||
33 | user.getUserInfoRequest.reload(); | 33 | user.getUserInfoRequest.reload(); |
34 | payment.ordersDataRequest.reload(); | ||
35 | payment.plansRequest.reload(); | 34 | payment.plansRequest.reload(); |
36 | } | 35 | } |
37 | 36 | ||
38 | async handlePaymentDashboard() { | 37 | async handlePaymentDashboard() { |
39 | const { actions, stores } = this.props; | 38 | const { actions, stores } = this.props; |
40 | 39 | ||
41 | actions.payment.createDashboardUrl(); | 40 | // actions.payment.createDashboardUrl(); |
42 | 41 | ||
43 | const dashboard = await stores.payment.createDashboardUrlRequest; | 42 | // const dashboard = await stores.payment.createDashboardUrlRequest; |
44 | 43 | ||
45 | if (dashboard.url) { | 44 | // if (dashboard.url) { |
46 | const paymentWindow = new BrowserWindow({ | 45 | // const paymentWindow = new BrowserWindow({ |
47 | title: '🔒 Franz Subscription Dashboard', | 46 | // title: '🔒 Franz Subscription Dashboard', |
48 | parent: remote.getCurrentWindow(), | 47 | // parent: remote.getCurrentWindow(), |
49 | modal: false, | 48 | // modal: false, |
50 | width: 900, | 49 | // width: 900, |
51 | minWidth: 600, | 50 | // minWidth: 600, |
52 | webPreferences: { | 51 | // webPreferences: { |
53 | nodeIntegration: false, | 52 | // nodeIntegration: false, |
54 | }, | 53 | // }, |
55 | }); | 54 | // }); |
56 | paymentWindow.loadURL(dashboard.url); | 55 | // paymentWindow.loadURL(dashboard.url); |
57 | 56 | ||
58 | paymentWindow.on('closed', () => { | 57 | // paymentWindow.on('closed', () => { |
59 | this.onCloseWindow(); | 58 | // this.onCloseWindow(); |
60 | }); | 59 | // }); |
61 | } | 60 | // } |
61 | |||
62 | const url = `${WEBSITE}/user/billing?token=${stores.user.authToken}&utm_source=app&utm_medium=edit_profile`; | ||
63 | |||
64 | actions.app.openExternalUrl({ url }); | ||
65 | } | ||
66 | |||
67 | handleWebsiteLink(route) { | ||
68 | const { actions, stores } = this.props; | ||
69 | |||
70 | const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; | ||
71 | console.log(url); | ||
72 | |||
73 | actions.app.openExternalUrl({ url }); | ||
62 | } | 74 | } |
63 | 75 | ||
64 | render() { | 76 | render() { |
65 | const { user, payment } = this.props.stores; | 77 | const { user, payment } = this.props.stores; |
66 | const { openExternalUrl } = this.props.actions.app; | ||
67 | const { user: userActions } = this.props.actions; | 78 | const { user: userActions } = this.props.actions; |
68 | 79 | ||
69 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; | 80 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; |
70 | const isLoadingOrdersInfo = payment.ordersDataRequest.isExecuting; | ||
71 | const isLoadingPlans = payment.plansRequest.isExecuting; | 81 | const isLoadingPlans = payment.plansRequest.isExecuting; |
72 | 82 | ||
73 | return ( | 83 | return ( |
74 | <ErrorBoundary> | 84 | <ErrorBoundary> |
75 | <AccountDashboard | 85 | <AccountDashboard |
76 | user={user.data} | 86 | user={user.data} |
77 | orders={payment.orders} | 87 | orders={payment.orders} // das muss raus |
78 | isLoading={isLoadingUserInfo} | 88 | isLoading={isLoadingUserInfo} |
79 | isLoadingOrdersInfo={isLoadingOrdersInfo} | ||
80 | isLoadingPlans={isLoadingPlans} | 89 | isLoadingPlans={isLoadingPlans} |
81 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} | 90 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} |
82 | retryUserInfoRequest={() => this.reloadData()} | 91 | retryUserInfoRequest={() => this.reloadData()} |
83 | isCreatingPaymentDashboardUrl={payment.createDashboardUrlRequest.isExecuting} | ||
84 | openDashboard={price => this.handlePaymentDashboard(price)} | ||
85 | openExternalUrl={url => openExternalUrl({ url })} | ||
86 | onCloseSubscriptionWindow={() => this.onCloseWindow()} | 92 | onCloseSubscriptionWindow={() => this.onCloseWindow()} |
87 | deleteAccount={userActions.delete} | 93 | deleteAccount={userActions.delete} |
88 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} | 94 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} |
89 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} | 95 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} |
96 | openEditAccount={() => this.handleWebsiteLink('/user/profile')} | ||
97 | openBilling={() => this.handleWebsiteLink('/user/billing')} | ||
98 | openInvoices={() => this.handleWebsiteLink('/user/invoices')} | ||
90 | /> | 99 | /> |
91 | </ErrorBoundary> | 100 | </ErrorBoundary> |
92 | ); | 101 | ); |