diff options
author | 2019-10-14 13:59:48 +0200 | |
---|---|---|
committer | 2019-10-14 13:59:48 +0200 | |
commit | 65b0912c4595b0b3cfad0f1d19255f70ba2bc48a (patch) | |
tree | 8618baeee61abb6f6991b7edf4897b03daffaad9 | |
parent | only use window.open when url exists (diff) | |
download | ferdium-app-65b0912c4595b0b3cfad0f1d19255f70ba2bc48a.tar.gz ferdium-app-65b0912c4595b0b3cfad0f1d19255f70ba2bc48a.tar.zst ferdium-app-65b0912c4595b0b3cfad0f1d19255f70ba2bc48a.zip |
Move checkout to in app instead of external handling
-rw-r--r-- | src/components/settings/account/AccountDashboard.js | 6 | ||||
-rw-r--r-- | src/components/subscription/SubscriptionPopup.js | 2 | ||||
-rw-r--r-- | src/containers/settings/AccountScreen.js | 5 | ||||
-rw-r--r-- | src/containers/subscription/SubscriptionFormScreen.js | 32 | ||||
-rw-r--r-- | src/styles/subscription-popup.scss | 5 |
5 files changed, 45 insertions, 5 deletions
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index ac2594604..08e86fda6 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -109,6 +109,7 @@ class AccountDashboard extends Component { | |||
109 | openBilling: PropTypes.func.isRequired, | 109 | openBilling: PropTypes.func.isRequired, |
110 | upgradeToPro: PropTypes.func.isRequired, | 110 | upgradeToPro: PropTypes.func.isRequired, |
111 | openInvoices: PropTypes.func.isRequired, | 111 | openInvoices: PropTypes.func.isRequired, |
112 | onCloseSubscriptionWindow: PropTypes.func.isRequired, | ||
112 | }; | 113 | }; |
113 | 114 | ||
114 | static contextTypes = { | 115 | static contextTypes = { |
@@ -130,6 +131,7 @@ class AccountDashboard extends Component { | |||
130 | openBilling, | 131 | openBilling, |
131 | upgradeToPro, | 132 | upgradeToPro, |
132 | openInvoices, | 133 | openInvoices, |
134 | onCloseSubscriptionWindow, | ||
133 | } = this.props; | 135 | } = this.props; |
134 | const { intl } = this.context; | 136 | const { intl } = this.context; |
135 | 137 | ||
@@ -263,7 +265,9 @@ class AccountDashboard extends Component { | |||
263 | {!user.isPremium && ( | 265 | {!user.isPremium && ( |
264 | <div className="account franz-form"> | 266 | <div className="account franz-form"> |
265 | <div className="account__box"> | 267 | <div className="account__box"> |
266 | <SubscriptionForm /> | 268 | <SubscriptionForm |
269 | onCloseWindow={onCloseSubscriptionWindow} | ||
270 | /> | ||
267 | </div> | 271 | </div> |
268 | </div> | 272 | </div> |
269 | )} | 273 | )} |
diff --git a/src/components/subscription/SubscriptionPopup.js b/src/components/subscription/SubscriptionPopup.js index 12ef8a6e9..12a51ad7b 100644 --- a/src/components/subscription/SubscriptionPopup.js +++ b/src/components/subscription/SubscriptionPopup.js | |||
@@ -59,8 +59,10 @@ export default @observer class SubscriptionPopup extends Component { | |||
59 | className="subscription-popup__webview" | 59 | className="subscription-popup__webview" |
60 | 60 | ||
61 | autosize | 61 | autosize |
62 | allowpopups | ||
62 | src={encodeURI(url)} | 63 | src={encodeURI(url)} |
63 | onDidNavigate={completeCheck} | 64 | onDidNavigate={completeCheck} |
65 | onDidNavigateInPage={completeCheck} | ||
64 | /> | 66 | /> |
65 | </div> | 67 | </div> |
66 | <div className="subscription-popup__toolbar franz-form"> | 68 | <div className="subscription-popup__toolbar franz-form"> |
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 9c74cf2ab..b0354c86b 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -5,6 +5,7 @@ import { inject, observer } from 'mobx-react'; | |||
5 | import PaymentStore from '../../stores/PaymentStore'; | 5 | import PaymentStore from '../../stores/PaymentStore'; |
6 | import UserStore from '../../stores/UserStore'; | 6 | import UserStore from '../../stores/UserStore'; |
7 | import AppStore from '../../stores/AppStore'; | 7 | import AppStore from '../../stores/AppStore'; |
8 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
8 | 9 | ||
9 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; | 10 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; |
10 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 11 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
@@ -12,8 +13,9 @@ import { WEBSITE } from '../../environment'; | |||
12 | 13 | ||
13 | export default @inject('stores', 'actions') @observer class AccountScreen extends Component { | 14 | export default @inject('stores', 'actions') @observer class AccountScreen extends Component { |
14 | onCloseWindow() { | 15 | onCloseWindow() { |
15 | const { user } = this.props.stores; | 16 | const { user, features } = this.props.stores; |
16 | user.getUserInfoRequest.invalidate({ immediately: true }); | 17 | user.getUserInfoRequest.invalidate({ immediately: true }); |
18 | features.featuresRequest.invalidate({ immediately: true }); | ||
17 | } | 19 | } |
18 | 20 | ||
19 | reloadData() { | 21 | reloadData() { |
@@ -65,6 +67,7 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
65 | AccountScreen.wrappedComponent.propTypes = { | 67 | AccountScreen.wrappedComponent.propTypes = { |
66 | stores: PropTypes.shape({ | 68 | stores: PropTypes.shape({ |
67 | user: PropTypes.instanceOf(UserStore).isRequired, | 69 | user: PropTypes.instanceOf(UserStore).isRequired, |
70 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
68 | payment: PropTypes.instanceOf(PaymentStore).isRequired, | 71 | payment: PropTypes.instanceOf(PaymentStore).isRequired, |
69 | app: PropTypes.instanceOf(AppStore).isRequired, | 72 | app: PropTypes.instanceOf(AppStore).isRequired, |
70 | }).isRequired, | 73 | }).isRequired, |
diff --git a/src/containers/subscription/SubscriptionFormScreen.js b/src/containers/subscription/SubscriptionFormScreen.js index 726b10628..38e46a7ba 100644 --- a/src/containers/subscription/SubscriptionFormScreen.js +++ b/src/containers/subscription/SubscriptionFormScreen.js | |||
@@ -1,4 +1,5 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import { remote } from 'electron'; | ||
2 | import PropTypes from 'prop-types'; | 3 | import PropTypes from 'prop-types'; |
3 | import { inject, observer } from 'mobx-react'; | 4 | import { inject, observer } from 'mobx-react'; |
4 | 5 | ||
@@ -7,11 +8,21 @@ import PaymentStore from '../../stores/PaymentStore'; | |||
7 | import SubscriptionForm from '../../components/subscription/SubscriptionForm'; | 8 | import SubscriptionForm from '../../components/subscription/SubscriptionForm'; |
8 | import TrialForm from '../../components/subscription/TrialForm'; | 9 | import TrialForm from '../../components/subscription/TrialForm'; |
9 | 10 | ||
11 | const { BrowserWindow } = remote; | ||
12 | |||
10 | export default @inject('stores', 'actions') @observer class SubscriptionFormScreen extends Component { | 13 | export default @inject('stores', 'actions') @observer class SubscriptionFormScreen extends Component { |
14 | static propTypes = { | ||
15 | onCloseWindow: PropTypes.func, | ||
16 | } | ||
17 | |||
18 | static defaultProps = { | ||
19 | onCloseWindow: () => null, | ||
20 | } | ||
21 | |||
11 | async openBrowser() { | 22 | async openBrowser() { |
12 | const { | 23 | const { |
13 | actions, | ||
14 | stores, | 24 | stores, |
25 | onCloseWindow, | ||
15 | } = this.props; | 26 | } = this.props; |
16 | 27 | ||
17 | const { | 28 | const { |
@@ -22,7 +33,24 @@ export default @inject('stores', 'actions') @observer class SubscriptionFormScre | |||
22 | let hostedPageURL = features.features.planSelectionURL; | 33 | let hostedPageURL = features.features.planSelectionURL; |
23 | hostedPageURL = user.getAuthURL(hostedPageURL); | 34 | hostedPageURL = user.getAuthURL(hostedPageURL); |
24 | 35 | ||
25 | actions.app.openExternalUrl({ url: hostedPageURL }); | 36 | const paymentWindow = new BrowserWindow({ |
37 | parent: remote.getCurrentWindow(), | ||
38 | modal: true, | ||
39 | title: '🔒 Franz Supporter License', | ||
40 | width: 800, | ||
41 | height: window.innerHeight - 100, | ||
42 | maxWidth: 800, | ||
43 | minWidth: 600, | ||
44 | webPreferences: { | ||
45 | nodeIntegration: true, | ||
46 | webviewTag: true, | ||
47 | }, | ||
48 | }); | ||
49 | paymentWindow.loadURL(`file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPageURL)}`); | ||
50 | |||
51 | paymentWindow.on('closed', () => { | ||
52 | onCloseWindow(); | ||
53 | }); | ||
26 | } | 54 | } |
27 | 55 | ||
28 | render() { | 56 | render() { |
diff --git a/src/styles/subscription-popup.scss b/src/styles/subscription-popup.scss index fb4795d6c..14e05e65d 100644 --- a/src/styles/subscription-popup.scss +++ b/src/styles/subscription-popup.scss | |||
@@ -2,7 +2,10 @@ | |||
2 | height: 100%; | 2 | height: 100%; |
3 | 3 | ||
4 | &__content { height: calc(100% - 60px); } | 4 | &__content { height: calc(100% - 60px); } |
5 | &__webview { height: 100%; } | 5 | &__webview { |
6 | height: 100%; | ||
7 | background: #FFF; | ||
8 | } | ||
6 | 9 | ||
7 | &__toolbar { | 10 | &__toolbar { |
8 | background: $theme-gray-lightest; | 11 | background: $theme-gray-lightest; |