aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-07-17 20:32:22 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-07-20 16:02:15 +0000
commit45373f655f68fdd0b320cde175b6108454ad4731 (patch)
treec1ccb0c73639d754b68a36a1977b74471fe4b566 /src/containers
parentNew Crowdin updates (#1668) (diff)
downloadferdium-app-45373f655f68fdd0b320cde175b6108454ad4731.tar.gz
ferdium-app-45373f655f68fdd0b320cde175b6108454ad4731.tar.zst
ferdium-app-45373f655f68fdd0b320cde175b6108454ad4731.zip
Removed Franz paid plans features:
- serviceLimit - planSelection - trialStatusBar and other Franz features that were for different tiers of subscription.
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/auth/PricingScreen.js83
-rw-r--r--src/containers/auth/SetupAssistantScreen.js9
-rw-r--r--src/containers/auth/SignupScreen.js11
-rw-r--r--src/containers/layout/AppLayoutContainer.js5
-rw-r--r--src/containers/settings/AccountScreen.js20
-rw-r--r--src/containers/settings/EditServiceScreen.js3
-rw-r--r--src/containers/settings/EditSettingsScreen.js6
-rw-r--r--src/containers/settings/RecipesScreen.js4
-rw-r--r--src/containers/settings/TeamScreen.js3
-rw-r--r--src/containers/subscription/SubscriptionFormScreen.js99
-rw-r--r--src/containers/subscription/SubscriptionPopupScreen.js41
11 files changed, 8 insertions, 276 deletions
diff --git a/src/containers/auth/PricingScreen.js b/src/containers/auth/PricingScreen.js
deleted file mode 100644
index 97bf1f6be..000000000
--- a/src/containers/auth/PricingScreen.js
+++ /dev/null
@@ -1,83 +0,0 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react';
4import { RouterStore } from 'mobx-react-router';
5
6import Pricing from '../../components/auth/Pricing';
7import UserStore from '../../stores/UserStore';
8
9import { globalError as globalErrorPropType } from '../../prop-types';
10import FeaturesStore from '../../stores/FeaturesStore';
11
12export default @inject('stores', 'actions') @observer class PricingScreen extends Component {
13 static propTypes = {
14 error: globalErrorPropType.isRequired,
15 };
16
17 async submit() {
18 const {
19 actions,
20 stores,
21 } = this.props;
22
23 const { activateTrialRequest } = stores.user;
24 const { defaultTrialPlan, canSkipTrial } = stores.features.anonymousFeatures;
25
26 if (!canSkipTrial) {
27 stores.router.push('/');
28 stores.user.hasCompletedSignup = true;
29 } else {
30 actions.user.activateTrial({ planId: defaultTrialPlan });
31 await activateTrialRequest._promise;
32
33 if (!activateTrialRequest.isError) {
34 stores.router.push('/');
35 stores.user.hasCompletedSignup = true;
36 }
37 }
38 }
39
40 render() {
41 const {
42 error,
43 stores,
44 } = this.props;
45
46 const { getUserInfoRequest, activateTrialRequest, data } = stores.user;
47 const { featuresRequest, features } = stores.features;
48
49 const { pricingConfig } = features;
50
51 let currency = '$';
52 let price = 5.99;
53 if (pricingConfig) {
54 ({ currency } = pricingConfig);
55 ({ price } = pricingConfig.plans.pro.yearly);
56 }
57
58 return (
59 <Pricing
60 onSubmit={this.submit.bind(this)}
61 isLoadingRequiredData={(getUserInfoRequest.isExecuting || !getUserInfoRequest.wasExecuted) || (featuresRequest.isExecuting || !featuresRequest.wasExecuted)}
62 isActivatingTrial={activateTrialRequest.isExecuting}
63 trialActivationError={activateTrialRequest.isError}
64 canSkipTrial={features.canSkipTrial}
65 error={error}
66 currency={currency}
67 price={price}
68 name={data.firstname}
69 />
70 );
71 }
72}
73
74PricingScreen.wrappedComponent.propTypes = {
75 actions: PropTypes.shape({
76 user: PropTypes.instanceOf(UserStore).isRequired,
77 }).isRequired,
78 stores: PropTypes.shape({
79 user: PropTypes.instanceOf(UserStore).isRequired,
80 router: PropTypes.instanceOf(RouterStore).isRequired,
81 features: PropTypes.instanceOf(FeaturesStore).isRequired,
82 }).isRequired,
83};
diff --git a/src/containers/auth/SetupAssistantScreen.js b/src/containers/auth/SetupAssistantScreen.js
index 2a8f2c010..eaf3fda8a 100644
--- a/src/containers/auth/SetupAssistantScreen.js
+++ b/src/containers/auth/SetupAssistantScreen.js
@@ -12,6 +12,7 @@ import RecipesStore from '../../stores/RecipesStore';
12import UserStore from '../../stores/UserStore'; 12import UserStore from '../../stores/UserStore';
13 13
14export default @inject('stores', 'actions') @observer class SetupAssistantScreen extends Component { 14export default @inject('stores', 'actions') @observer class SetupAssistantScreen extends Component {
15 // TODO: Why are these hardcoded here? Do they need to conform to specific services in the packaged recipes? If so, its more important to fix this
15 services = { 16 services = {
16 whatsapp: { 17 whatsapp: {
17 name: 'WhatsApp', 18 name: 'WhatsApp',
@@ -56,14 +57,14 @@ export default @inject('stores', 'actions') @observer class SetupAssistantScreen
56 } 57 }
57 58
58 async setupServices(serviceConfig) { 59 async setupServices(serviceConfig) {
59 const { stores: { services, router, user } } = this.props; 60 const { stores: { services } } = this.props;
60 console.log(serviceConfig); 61 console.log(serviceConfig);
61 62
62 this.setState({ 63 this.setState({
63 isSettingUpServices: true, 64 isSettingUpServices: true,
64 }); 65 });
65 66
66 // The store requests are not build for paralell requests so we need to finish one request after another 67 // The store requests are not build for parallel requests so we need to finish one request after another
67 for (const config of serviceConfig) { 68 for (const config of serviceConfig) {
68 const serviceData = { 69 const serviceData = {
69 name: this.services[config.id].name, 70 name: this.services[config.id].name,
@@ -96,10 +97,6 @@ export default @inject('stores', 'actions') @observer class SetupAssistantScreen
96 this.setState({ 97 this.setState({
97 isSettingUpServices: false, 98 isSettingUpServices: false,
98 }); 99 });
99
100 await sleep(100);
101
102 router.push(user.pricingRoute);
103 } 100 }
104 101
105 render() { 102 render() {
diff --git a/src/containers/auth/SignupScreen.js b/src/containers/auth/SignupScreen.js
index 42ee09f33..eeab63a0c 100644
--- a/src/containers/auth/SignupScreen.js
+++ b/src/containers/auth/SignupScreen.js
@@ -14,16 +14,7 @@ export default @inject('stores', 'actions') @observer class SignupScreen extends
14 }; 14 };
15 15
16 onSignup(values) { 16 onSignup(values) {
17 const { actions, stores } = this.props; 17 const { actions } = this.props;
18
19 const { canSkipTrial, defaultTrialPlan, pricingConfig } = stores.features.anonymousFeatures;
20
21 if (!canSkipTrial) {
22 Object.assign(values, {
23 plan: defaultTrialPlan,
24 currency: pricingConfig.currencyID,
25 });
26 }
27 18
28 actions.user.signup(values); 19 actions.user.signup(values);
29 } 20 }
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index 7a12aee83..9cdb20727 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -20,7 +20,6 @@ import Sidebar from '../../components/layout/Sidebar';
20import Services from '../../components/services/content/Services'; 20import Services from '../../components/services/content/Services';
21import AppLoader from '../../components/ui/AppLoader'; 21import AppLoader from '../../components/ui/AppLoader';
22 22
23import { state as delayAppState } from '../../features/delayApp';
24import { workspaceActions } from '../../features/workspaces/actions'; 23import { workspaceActions } from '../../features/workspaces/actions';
25import WorkspaceDrawer from '../../features/workspaces/components/WorkspaceDrawer'; 24import WorkspaceDrawer from '../../features/workspaces/components/WorkspaceDrawer';
26import { workspaceStore } from '../../features/workspaces'; 25import { workspaceStore } from '../../features/workspaces';
@@ -94,7 +93,6 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
94 getServicesForWorkspace={workspace => ( 93 getServicesForWorkspace={workspace => (
95 workspace ? workspaceStore.getWorkspaceServices(workspace).map(s => s.name) : services.all.map(s => s.name) 94 workspace ? workspaceStore.getWorkspaceServices(workspace).map(s => s.name) : services.all.map(s => s.name)
96 )} 95 )}
97 onUpgradeAccountClick={() => openSettings({ path: 'user' })}
98 /> 96 />
99 ); 97 );
100 98
@@ -131,7 +129,6 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
131 openSettings={openSettings} 129 openSettings={openSettings}
132 update={updateService} 130 update={updateService}
133 userHasCompletedSignup={user.hasCompletedSignup} 131 userHasCompletedSignup={user.hasCompletedSignup}
134 hasActivatedTrial={user.hasActivatedTrial}
135 isSpellcheckerEnabled={settings.app.enableSpellchecking} 132 isSpellcheckerEnabled={settings.app.enableSpellchecking}
136 /> 133 />
137 ); 134 );
@@ -157,8 +154,6 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
157 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful} 154 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful}
158 retryRequiredRequests={retryRequiredRequests} 155 retryRequiredRequests={retryRequiredRequests}
159 areRequiredRequestsLoading={requests.areRequiredRequestsLoading} 156 areRequiredRequestsLoading={requests.areRequiredRequestsLoading}
160 isDelayAppScreenVisible={delayAppState.isDelayAppScreenVisible}
161 hasActivatedTrial={user.hasActivatedTrial}
162 > 157 >
163 {React.Children.count(children) > 0 ? children : null} 158 {React.Children.count(children) > 0 ? children : null}
164 </AppLayout> 159 </AppLayout>
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js
index db3b2a4a7..4ee932895 100644
--- a/src/containers/settings/AccountScreen.js
+++ b/src/containers/settings/AccountScreen.js
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react'; 3import { inject, observer } from 'mobx-react';
4 4
5import PaymentStore from '../../stores/PaymentStore';
6import UserStore from '../../stores/UserStore'; 5import UserStore from '../../stores/UserStore';
7import AppStore from '../../stores/AppStore'; 6import AppStore from '../../stores/AppStore';
8import FeaturesStore from '../../stores/FeaturesStore'; 7import FeaturesStore from '../../stores/FeaturesStore';
@@ -24,10 +23,9 @@ class AccountScreen extends Component {
24 } 23 }
25 24
26 reloadData() { 25 reloadData() {
27 const { user, payment } = this.props.stores; 26 const { user } = this.props.stores;
28 27
29 user.getUserInfoRequest.reload(); 28 user.getUserInfoRequest.reload();
30 payment.plansRequest.reload();
31 } 29 }
32 30
33 handleWebsiteLink(route) { 31 handleWebsiteLink(route) {
@@ -50,26 +48,18 @@ class AccountScreen extends Component {
50 render() { 48 render() {
51 const { 49 const {
52 user, 50 user,
53 payment,
54 features,
55 settings, 51 settings,
56 } = this.props.stores; 52 } = this.props.stores;
57 const { user: userActions, payment: paymentActions } = this.props.actions; 53 const { user: userActions } = this.props.actions;
58 54
59 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; 55 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
60 const isLoadingPlans = payment.plansRequest.isExecuting;
61
62 const { upgradeAccount } = paymentActions;
63 56
64 return ( 57 return (
65 <ErrorBoundary> 58 <ErrorBoundary>
66 <AccountDashboard 59 <AccountDashboard
67 server={settings.all.app.server} 60 server={settings.all.app.server}
68 user={user.data} 61 user={user.data}
69 isPremiumOverrideUser={user.isPremiumOverride}
70 isProUser={user.isPro}
71 isLoading={isLoadingUserInfo} 62 isLoading={isLoadingUserInfo}
72 isLoadingPlans={isLoadingPlans}
73 userInfoRequestFailed={ 63 userInfoRequestFailed={
74 user.getUserInfoRequest.wasExecuted 64 user.getUserInfoRequest.wasExecuted
75 && user.getUserInfoRequest.isError 65 && user.getUserInfoRequest.isError
@@ -83,10 +73,6 @@ class AccountScreen extends Component {
83 && !user.deleteAccountRequest.isError 73 && !user.deleteAccountRequest.isError
84 } 74 }
85 openEditAccount={() => this.handleWebsiteLink('/user/profile')} 75 openEditAccount={() => this.handleWebsiteLink('/user/profile')}
86 upgradeToPro={() => upgradeAccount({
87 planId: features.features.pricingConfig.plans.pro.yearly.id,
88 })}
89 openBilling={() => this.handleWebsiteLink('/user/billing')}
90 openInvoices={() => this.handleWebsiteLink('/user/invoices')} 76 openInvoices={() => this.handleWebsiteLink('/user/invoices')}
91 /> 77 />
92 </ErrorBoundary> 78 </ErrorBoundary>
@@ -98,12 +84,10 @@ AccountScreen.wrappedComponent.propTypes = {
98 stores: PropTypes.shape({ 84 stores: PropTypes.shape({
99 user: PropTypes.instanceOf(UserStore).isRequired, 85 user: PropTypes.instanceOf(UserStore).isRequired,
100 features: PropTypes.instanceOf(FeaturesStore).isRequired, 86 features: PropTypes.instanceOf(FeaturesStore).isRequired,
101 payment: PropTypes.instanceOf(PaymentStore).isRequired,
102 settings: PropTypes.instanceOf(SettingsStore).isRequired, 87 settings: PropTypes.instanceOf(SettingsStore).isRequired,
103 app: PropTypes.instanceOf(AppStore).isRequired, 88 app: PropTypes.instanceOf(AppStore).isRequired,
104 }).isRequired, 89 }).isRequired,
105 actions: PropTypes.shape({ 90 actions: PropTypes.shape({
106 payment: PropTypes.instanceOf(PaymentStore).isRequired,
107 app: PropTypes.instanceOf(AppStore).isRequired, 91 app: PropTypes.instanceOf(AppStore).isRequired,
108 user: PropTypes.instanceOf(UserStore).isRequired, 92 user: PropTypes.instanceOf(UserStore).isRequired,
109 }).isRequired, 93 }).isRequired,
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index ddf2d2d25..e22e91822 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -19,7 +19,6 @@ import { required, url, oneRequired } from '../../helpers/validation-helpers';
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 19import { getSelectOptions } from '../../helpers/i18n-helpers';
20 20
21import { config as proxyFeature } from '../../features/serviceProxy'; 21import { config as proxyFeature } from '../../features/serviceProxy';
22import { config as spellcheckerFeature } from '../../features/spellchecker';
23 22
24import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; 23import { SPELLCHECKER_LOCALES } from '../../i18n/languages';
25 24
@@ -399,8 +398,6 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
399 onDelete={() => this.deleteService()} 398 onDelete={() => this.deleteService()}
400 openRecipeFile={file => this.openRecipeFile(file)} 399 openRecipeFile={file => this.openRecipeFile(file)}
401 isProxyFeatureEnabled={proxyFeature.isEnabled} 400 isProxyFeatureEnabled={proxyFeature.isEnabled}
402 isServiceProxyIncludedInCurrentPlan={proxyFeature.isIncludedInCurrentPlan}
403 isSpellcheckerIncludedInCurrentPlan={spellcheckerFeature.isIncludedInCurrentPlan}
404 isHibernationFeatureActive={settings.app.hibernate} 401 isHibernationFeatureActive={settings.app.hibernate}
405 /> 402 />
406 </ErrorBoundary> 403 </ErrorBoundary>
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index d601e03d4..3b8f03ae4 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -14,7 +14,6 @@ import {
14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, 14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER,
15} from '../../config'; 15} from '../../config';
16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; 16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment';
17import { config as spellcheckerConfig } from '../../features/spellchecker';
18 17
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 18import { getSelectOptions } from '../../helpers/i18n-helpers';
20import { hash } from '../../helpers/password-helpers'; 19import { hash } from '../../helpers/password-helpers';
@@ -516,8 +515,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
516 }, 515 },
517 enableSpellchecking: { 516 enableSpellchecking: {
518 label: intl.formatMessage(messages.enableSpellchecking), 517 label: intl.formatMessage(messages.enableSpellchecking),
519 value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking, 518 value: settings.all.app.enableSpellchecking,
520 default: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, 519 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
521 }, 520 },
522 spellcheckerLanguage: { 521 spellcheckerLanguage: {
523 label: intl.formatMessage(globalMessages.spellcheckerLanguage), 522 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
@@ -650,7 +649,6 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
650 getCacheSize={() => app.cacheSize} 649 getCacheSize={() => app.cacheSize}
651 isClearingAllCache={isClearingAllCache} 650 isClearingAllCache={isClearingAllCache}
652 onClearAllCache={clearAllCache} 651 onClearAllCache={clearAllCache}
653 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan}
654 isTodosEnabled={todos.isFeatureActive} 652 isTodosEnabled={todos.isFeatureActive}
655 isWorkspaceEnabled={workspaces.isFeatureActive} 653 isWorkspaceEnabled={workspaces.isFeatureActive}
656 lockingFeatureEnabled={lockingFeatureEnabled} 654 lockingFeatureEnabled={lockingFeatureEnabled}
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index f12f67b1f..9a16fd064 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -107,7 +107,6 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
107 recipePreviews, 107 recipePreviews,
108 recipes, 108 recipes,
109 services, 109 services,
110 user,
111 } = this.props.stores; 110 } = this.props.stores;
112 111
113 const { 112 const {
@@ -155,7 +154,6 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
155 customWebsiteRecipe={customWebsiteRecipe} 154 customWebsiteRecipe={customWebsiteRecipe}
156 isLoading={isLoading} 155 isLoading={isLoading}
157 addedServiceCount={services.all.length} 156 addedServiceCount={services.all.length}
158 isPremium={user.data.isPremium}
159 hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted} 157 hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted}
160 showAddServiceInterface={serviceActions.showAddServiceInterface} 158 showAddServiceInterface={serviceActions.showAddServiceInterface}
161 searchRecipes={e => this.searchRecipes(e)} 159 searchRecipes={e => this.searchRecipes(e)}
@@ -171,8 +169,6 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
171 openDevDocs={() => { 169 openDevDocs={() => {
172 appActions.openExternalUrl({ url: FRANZ_DEV_DOCS }); 170 appActions.openExternalUrl({ url: FRANZ_DEV_DOCS });
173 }} 171 }}
174 isCommunityRecipesIncludedInCurrentPlan={communityRecipesStore.isCommunityRecipesIncludedInCurrentPlan}
175 isUserPremiumUser={user.isPremium}
176 /> 172 />
177 </ErrorBoundary> 173 </ErrorBoundary>
178 ); 174 );
diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js
index a627a047a..10c2e36ef 100644
--- a/src/containers/settings/TeamScreen.js
+++ b/src/containers/settings/TeamScreen.js
@@ -9,7 +9,6 @@ import SettingsStore from '../../stores/SettingsStore';
9import TeamDashboard from '../../components/settings/team/TeamDashboard'; 9import TeamDashboard from '../../components/settings/team/TeamDashboard';
10import ErrorBoundary from '../../components/util/ErrorBoundary'; 10import ErrorBoundary from '../../components/util/ErrorBoundary';
11import { DEV_API_FRANZ_WEBSITE } from '../../config'; 11import { DEV_API_FRANZ_WEBSITE } from '../../config';
12import PaymentStore from '../../stores/PaymentStore';
13 12
14export default @inject('stores', 'actions') @observer class TeamScreen extends Component { 13export default @inject('stores', 'actions') @observer class TeamScreen extends Component {
15 handleWebsiteLink(route) { 14 handleWebsiteLink(route) {
@@ -33,7 +32,6 @@ export default @inject('stores', 'actions') @observer class TeamScreen extends C
33 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} 32 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError}
34 retryUserInfoRequest={() => this.reloadData()} 33 retryUserInfoRequest={() => this.reloadData()}
35 openTeamManagement={() => this.handleWebsiteLink('/user/team')} 34 openTeamManagement={() => this.handleWebsiteLink('/user/team')}
36 isProUser={user.isPro}
37 server={server} 35 server={server}
38 /> 36 />
39 </ErrorBoundary> 37 </ErrorBoundary>
@@ -48,7 +46,6 @@ TeamScreen.wrappedComponent.propTypes = {
48 settings: PropTypes.instanceOf(SettingsStore).isRequired, 46 settings: PropTypes.instanceOf(SettingsStore).isRequired,
49 }).isRequired, 47 }).isRequired,
50 actions: PropTypes.shape({ 48 actions: PropTypes.shape({
51 payment: PropTypes.instanceOf(PaymentStore).isRequired,
52 app: PropTypes.instanceOf(AppStore).isRequired, 49 app: PropTypes.instanceOf(AppStore).isRequired,
53 user: PropTypes.instanceOf(UserStore).isRequired, 50 user: PropTypes.instanceOf(UserStore).isRequired,
54 }).isRequired, 51 }).isRequired,
diff --git a/src/containers/subscription/SubscriptionFormScreen.js b/src/containers/subscription/SubscriptionFormScreen.js
deleted file mode 100644
index e5c8207be..000000000
--- a/src/containers/subscription/SubscriptionFormScreen.js
+++ /dev/null
@@ -1,99 +0,0 @@
1import React, { Component } from 'react';
2import { BrowserWindow, getCurrentWindow } from '@electron/remote';
3import PropTypes from 'prop-types';
4import { inject, observer } from 'mobx-react';
5
6import PaymentStore from '../../stores/PaymentStore';
7
8import SubscriptionForm from '../../components/subscription/SubscriptionForm';
9import TrialForm from '../../components/subscription/TrialForm';
10import UserStore from '../../stores/UserStore';
11import FeaturesStore from '../../stores/FeaturesStore';
12import AppStore from '../../stores/AppStore';
13
14export default @inject('stores', 'actions') @observer class SubscriptionFormScreen extends Component {
15 static propTypes = {
16 onCloseWindow: PropTypes.func,
17 }
18
19 static defaultProps = {
20 onCloseWindow: () => null,
21 }
22
23 async openBrowser() {
24 const {
25 stores,
26 onCloseWindow,
27 } = this.props;
28
29 const {
30 user,
31 features,
32 } = stores;
33
34 let hostedPageURL = features.features.planSelectionURL;
35 hostedPageURL = user.getAuthURL(hostedPageURL);
36
37 const paymentWindow = new BrowserWindow({
38 parent: getCurrentWindow(),
39 modal: true,
40 title: '🔒 Franz Supporter License',
41 width: 800,
42 height: window.innerHeight - 100,
43 maxWidth: 800,
44 minWidth: 600,
45 webPreferences: {
46 nodeIntegration: true,
47 webviewTag: true,
48 enableRemoteModule: true,
49 contextIsolation: false,
50 },
51 });
52 paymentWindow.loadURL(`file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPageURL)}`);
53
54 paymentWindow.on('closed', () => {
55 onCloseWindow();
56 });
57 }
58
59 render() {
60 const {
61 actions,
62 stores,
63 } = this.props;
64
65 const { data: user } = stores.user;
66
67 if (user.hadSubscription) {
68 return (
69 <SubscriptionForm
70 plan={stores.payment.plan}
71 selectPlan={() => this.openBrowser()}
72 isActivatingTrial={stores.user.activateTrialRequest.isExecuting || stores.user.getUserInfoRequest.isExecuting}
73 />
74 );
75 }
76
77 return (
78 <TrialForm
79 plan={stores.payment.plan}
80 activateTrial={() => actions.user.activateTrial({ planId: stores.features.features.defaultTrialPlan })}
81 showAllOptions={() => this.openBrowser()}
82 isActivatingTrial={stores.user.activateTrialRequest.isExecuting || stores.user.getUserInfoRequest.isExecuting}
83 />
84 );
85 }
86}
87
88SubscriptionFormScreen.wrappedComponent.propTypes = {
89 actions: PropTypes.shape({
90 app: PropTypes.instanceOf(AppStore).isRequired,
91 payment: PropTypes.instanceOf(PaymentStore).isRequired,
92 user: PropTypes.instanceOf(UserStore).isRequired,
93 }).isRequired,
94 stores: PropTypes.shape({
95 payment: PropTypes.instanceOf(PaymentStore).isRequired,
96 user: PropTypes.instanceOf(UserStore).isRequired,
97 features: PropTypes.instanceOf(FeaturesStore).isRequired,
98 }).isRequired,
99};
diff --git a/src/containers/subscription/SubscriptionPopupScreen.js b/src/containers/subscription/SubscriptionPopupScreen.js
deleted file mode 100644
index 43966b6a4..000000000
--- a/src/containers/subscription/SubscriptionPopupScreen.js
+++ /dev/null
@@ -1,41 +0,0 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react';
4
5import SubscriptionPopup from '../../components/subscription/SubscriptionPopup';
6import { isDevMode } from '../../environment';
7
8export default @inject('stores', 'actions') @observer class SubscriptionPopupScreen extends Component {
9 state = {
10 complete: false,
11 };
12
13 completeCheck(event) {
14 const { url } = event;
15
16 if ((url.includes('recurly') && url.includes('confirmation')) || ((url.includes('meetfranz') || isDevMode) && url.includes('success'))) {
17 this.setState({
18 complete: true,
19 });
20 }
21 }
22
23 render() {
24 return (
25 <SubscriptionPopup
26 url={this.props.router.params.url}
27 closeWindow={() => window.close()}
28 completeCheck={e => this.completeCheck(e)}
29 isCompleted={this.state.complete}
30 />
31 );
32 }
33}
34
35SubscriptionPopupScreen.wrappedComponent.propTypes = {
36 router: PropTypes.shape({
37 params: PropTypes.shape({
38 url: PropTypes.string.isRequired,
39 }).isRequired,
40 }).isRequired,
41};