aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UserStore.js
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/stores/UserStore.js
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/stores/UserStore.js')
-rw-r--r--src/stores/UserStore.js65
1 files changed, 1 insertions, 64 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 7947e5a27..8a525c2ef 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -2,16 +2,13 @@ import { observable, computed, action } from 'mobx';
2import moment from 'moment'; 2import moment from 'moment';
3import jwt from 'jsonwebtoken'; 3import jwt from 'jsonwebtoken';
4import localStorage from 'mobx-localstorage'; 4import localStorage from 'mobx-localstorage';
5import ms from 'ms';
6import { session } from '@electron/remote'; 5import { session } from '@electron/remote';
7 6
8import { isDevMode } from '../environment'; 7import { isDevMode } from '../environment';
9import Store from './lib/Store'; 8import Store from './lib/Store';
10import Request from './lib/Request'; 9import Request from './lib/Request';
11import CachedRequest from './lib/CachedRequest'; 10import CachedRequest from './lib/CachedRequest';
12import { sleep } from '../helpers/async-helpers'; 11import { TODOS_PARTITION_ID } from '../config';
13import { getPlan } from '../helpers/plan-helpers';
14import { PLANS, TODOS_PARTITION_ID } from '../config';
15 12
16const debug = require('debug')('Ferdi:UserStore'); 13const debug = require('debug')('Ferdi:UserStore');
17 14
@@ -27,8 +24,6 @@ export default class UserStore extends Store {
27 24
28 SIGNUP_ROUTE = `${this.BASE_ROUTE}/signup`; 25 SIGNUP_ROUTE = `${this.BASE_ROUTE}/signup`;
29 26
30 PRICING_ROUTE = `${this.BASE_ROUTE}/signup/pricing`;
31
32 SETUP_ROUTE = `${this.BASE_ROUTE}/signup/setup`; 27 SETUP_ROUTE = `${this.BASE_ROUTE}/signup/setup`;
33 28
34 IMPORT_ROUTE = `${this.BASE_ROUTE}/signup/import`; 29 IMPORT_ROUTE = `${this.BASE_ROUTE}/signup/import`;
@@ -45,8 +40,6 @@ export default class UserStore extends Store {
45 40
46 @observable passwordRequest = new Request(this.api.user, 'password'); 41 @observable passwordRequest = new Request(this.api.user, 'password');
47 42
48 @observable activateTrialRequest = new Request(this.api.user, 'activateTrial');
49
50 @observable inviteRequest = new Request(this.api.user, 'invite'); 43 @observable inviteRequest = new Request(this.api.user, 'invite');
51 44
52 @observable getUserInfoRequest = new CachedRequest(this.api.user, 'getInfo'); 45 @observable getUserInfoRequest = new CachedRequest(this.api.user, 'getInfo');
@@ -71,8 +64,6 @@ export default class UserStore extends Store {
71 64
72 @observable hasCompletedSignup = false; 65 @observable hasCompletedSignup = false;
73 66
74 @observable hasActivatedTrial = false;
75
76 @observable userData = {}; 67 @observable userData = {};
77 68
78 @observable actionStatus = []; 69 @observable actionStatus = [];
@@ -93,7 +84,6 @@ export default class UserStore extends Store {
93 this.actions.user.retrievePassword.listen(this._retrievePassword.bind(this)); 84 this.actions.user.retrievePassword.listen(this._retrievePassword.bind(this));
94 this.actions.user.logout.listen(this._logout.bind(this)); 85 this.actions.user.logout.listen(this._logout.bind(this));
95 this.actions.user.signup.listen(this._signup.bind(this)); 86 this.actions.user.signup.listen(this._signup.bind(this));
96 this.actions.user.activateTrial.listen(this._activateTrial.bind(this));
97 this.actions.user.invite.listen(this._invite.bind(this)); 87 this.actions.user.invite.listen(this._invite.bind(this));
98 this.actions.user.update.listen(this._update.bind(this)); 88 this.actions.user.update.listen(this._update.bind(this));
99 this.actions.user.resetStatus.listen(this._resetStatus.bind(this)); 89 this.actions.user.resetStatus.listen(this._resetStatus.bind(this));
@@ -104,7 +94,6 @@ export default class UserStore extends Store {
104 this.registerReactions([ 94 this.registerReactions([
105 this._requireAuthenticatedUser.bind(this), 95 this._requireAuthenticatedUser.bind(this),
106 this._getUserData.bind(this), 96 this._getUserData.bind(this),
107 this._resetTrialActivationState.bind(this),
108 ]); 97 ]);
109 } 98 }
110 99
@@ -126,10 +115,6 @@ export default class UserStore extends Store {
126 return this.SIGNUP_ROUTE; 115 return this.SIGNUP_ROUTE;
127 } 116 }
128 117
129 get pricingRoute() {
130 return this.PRICING_ROUTE;
131 }
132
133 get setupRoute() { 118 get setupRoute() {
134 return this.SETUP_ROUTE; 119 return this.SETUP_ROUTE;
135 } 120 }
@@ -172,31 +157,6 @@ export default class UserStore extends Store {
172 return this.data.team || null; 157 return this.data.team || null;
173 } 158 }
174 159
175 @computed get isPremium() {
176 return true;
177 }
178
179 @computed get isPremiumOverride() {
180 return ((!this.team || !this.team.plan) && this.isPremium) || (this.team && this.team.state === 'expired' && this.isPremium);
181 }
182
183 @computed get isPersonal() {
184 if (!this.team || !this.team.plan) return false;
185 const plan = getPlan(this.team.plan);
186
187 return plan === PLANS.PERSONAL;
188 }
189
190 @computed get isPro() {
191 return true;
192 // if (this.isPremiumOverride) return true;
193
194 // if (!this.team || (!this.team.plan || this.team.state === 'expired')) return false;
195 // const plan = getPlan(this.team.plan);
196
197 // return plan === PLANS.PRO || plan === PLANS.LEGACY;
198 }
199
200 @computed get legacyServices() { 160 @computed get legacyServices() {
201 return this.getLegacyServicesRequest.execute() || {}; 161 return this.getLegacyServicesRequest.execute() || {};
202 } 162 }
@@ -244,21 +204,6 @@ export default class UserStore extends Store {
244 this.actionStatus = request.result.status || []; 204 this.actionStatus = request.result.status || [];
245 } 205 }
246 206
247 @action async _activateTrial({ planId }) {
248 debug('activate trial', planId);
249
250 this.activateTrialRequest.execute({
251 plan: planId,
252 });
253
254 await this.activateTrialRequest._promise;
255
256 this.hasActivatedTrial = true;
257
258 this.stores.features.featuresRequest.invalidate({ immediately: true });
259 this.stores.user.getUserInfoRequest.invalidate({ immediately: true });
260 }
261
262 @action async _invite({ invites }) { 207 @action async _invite({ invites }) {
263 const data = invites.filter(invite => invite.email !== ''); 208 const data = invites.filter(invite => invite.email !== '');
264 209
@@ -386,14 +331,6 @@ export default class UserStore extends Store {
386 } 331 }
387 } 332 }
388 333
389 async _resetTrialActivationState() {
390 if (this.hasActivatedTrial) {
391 await sleep(ms('12s'));
392
393 this.hasActivatedTrial = false;
394 }
395 }
396
397 // Helpers 334 // Helpers
398 _parseToken(authToken) { 335 _parseToken(authToken) {
399 try { 336 try {