diff options
author | 2019-10-24 15:15:42 +0200 | |
---|---|---|
committer | 2019-10-24 15:15:42 +0200 | |
commit | 54f8b191a94bd78a85b046bbf21dd2245d3a6f3e (patch) | |
tree | ada5876f0e8a697ba4693bba07f5e0f31fea1fc9 /src/containers/auth | |
parent | Update submodules (diff) | |
parent | bump version to 5.4.0 (diff) | |
download | ferdium-app-54f8b191a94bd78a85b046bbf21dd2245d3a6f3e.tar.gz ferdium-app-54f8b191a94bd78a85b046bbf21dd2245d3a6f3e.tar.zst ferdium-app-54f8b191a94bd78a85b046bbf21dd2245d3a6f3e.zip |
Merge https://github.com/meetfranz/franz into franz-5.4.0-release
Diffstat (limited to 'src/containers/auth')
-rw-r--r-- | src/containers/auth/PricingScreen.js | 32 | ||||
-rw-r--r-- | src/containers/auth/SignupScreen.js | 22 |
2 files changed, 45 insertions, 9 deletions
diff --git a/src/containers/auth/PricingScreen.js b/src/containers/auth/PricingScreen.js index af1651931..21c859c12 100644 --- a/src/containers/auth/PricingScreen.js +++ b/src/containers/auth/PricingScreen.js | |||
@@ -20,14 +20,19 @@ export default @inject('stores', 'actions') @observer class PricingScreen extend | |||
20 | } = this.props; | 20 | } = this.props; |
21 | 21 | ||
22 | const { activateTrialRequest } = stores.user; | 22 | const { activateTrialRequest } = stores.user; |
23 | const { defaultTrialPlan } = stores.features.features; | 23 | const { defaultTrialPlan, canSkipTrial } = stores.features.anonymousFeatures; |
24 | 24 | ||
25 | actions.user.activateTrial({ planId: defaultTrialPlan }); | 25 | if (!canSkipTrial) { |
26 | await activateTrialRequest._promise; | ||
27 | |||
28 | if (!activateTrialRequest.isError) { | ||
29 | stores.router.push('/'); | 26 | stores.router.push('/'); |
30 | stores.user.hasCompletedSignup = true; | 27 | stores.user.hasCompletedSignup = true; |
28 | } else { | ||
29 | actions.user.activateTrial({ planId: defaultTrialPlan }); | ||
30 | await activateTrialRequest._promise; | ||
31 | |||
32 | if (!activateTrialRequest.isError) { | ||
33 | stores.router.push('/'); | ||
34 | stores.user.hasCompletedSignup = true; | ||
35 | } | ||
31 | } | 36 | } |
32 | } | 37 | } |
33 | 38 | ||
@@ -37,8 +42,17 @@ export default @inject('stores', 'actions') @observer class PricingScreen extend | |||
37 | stores, | 42 | stores, |
38 | } = this.props; | 43 | } = this.props; |
39 | 44 | ||
40 | const { getUserInfoRequest, activateTrialRequest } = stores.user; | 45 | const { getUserInfoRequest, activateTrialRequest, data } = stores.user; |
41 | const { featuresRequest } = stores.features; | 46 | const { featuresRequest, features } = stores.features; |
47 | |||
48 | const { pricingConfig } = features; | ||
49 | |||
50 | let currency = '$'; | ||
51 | let price = 5.99; | ||
52 | if (pricingConfig) { | ||
53 | ({ currency } = pricingConfig); | ||
54 | ({ price } = pricingConfig.plans.pro.yearly); | ||
55 | } | ||
42 | 56 | ||
43 | return ( | 57 | return ( |
44 | <Pricing | 58 | <Pricing |
@@ -46,7 +60,11 @@ export default @inject('stores', 'actions') @observer class PricingScreen extend | |||
46 | isLoadingRequiredData={(getUserInfoRequest.isExecuting || !getUserInfoRequest.wasExecuted) || (featuresRequest.isExecuting || !featuresRequest.wasExecuted)} | 60 | isLoadingRequiredData={(getUserInfoRequest.isExecuting || !getUserInfoRequest.wasExecuted) || (featuresRequest.isExecuting || !featuresRequest.wasExecuted)} |
47 | isActivatingTrial={activateTrialRequest.isExecuting} | 61 | isActivatingTrial={activateTrialRequest.isExecuting} |
48 | trialActivationError={activateTrialRequest.isError} | 62 | trialActivationError={activateTrialRequest.isError} |
63 | canSkipTrial={features.canSkipTrial} | ||
49 | error={error} | 64 | error={error} |
65 | currency={currency} | ||
66 | price={price} | ||
67 | name={data.firstname} | ||
50 | /> | 68 | /> |
51 | ); | 69 | ); |
52 | } | 70 | } |
diff --git a/src/containers/auth/SignupScreen.js b/src/containers/auth/SignupScreen.js index efc7ea4c1..f93498be2 100644 --- a/src/containers/auth/SignupScreen.js +++ b/src/containers/auth/SignupScreen.js | |||
@@ -4,6 +4,7 @@ import { inject, observer } from 'mobx-react'; | |||
4 | 4 | ||
5 | import Signup from '../../components/auth/Signup'; | 5 | import Signup from '../../components/auth/Signup'; |
6 | import UserStore from '../../stores/UserStore'; | 6 | import UserStore from '../../stores/UserStore'; |
7 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
7 | 8 | ||
8 | import { globalError as globalErrorPropType } from '../../prop-types'; | 9 | import { globalError as globalErrorPropType } from '../../prop-types'; |
9 | 10 | ||
@@ -12,11 +13,27 @@ export default @inject('stores', 'actions') @observer class SignupScreen extends | |||
12 | error: globalErrorPropType.isRequired, | 13 | error: globalErrorPropType.isRequired, |
13 | }; | 14 | }; |
14 | 15 | ||
16 | onSignup(values) { | ||
17 | const { actions, stores } = 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 | |||
28 | actions.user.signup(values); | ||
29 | } | ||
30 | |||
15 | render() { | 31 | render() { |
16 | const { actions, stores, error } = this.props; | 32 | const { stores, error } = this.props; |
33 | |||
17 | return ( | 34 | return ( |
18 | <Signup | 35 | <Signup |
19 | onSubmit={actions.user.signup} | 36 | onSubmit={values => this.onSignup(values)} |
20 | isSubmitting={stores.user.signupRequest.isExecuting} | 37 | isSubmitting={stores.user.signupRequest.isExecuting} |
21 | loginRoute={stores.user.loginRoute} | 38 | loginRoute={stores.user.loginRoute} |
22 | error={error} | 39 | error={error} |
@@ -33,5 +50,6 @@ SignupScreen.wrappedComponent.propTypes = { | |||
33 | }).isRequired, | 50 | }).isRequired, |
34 | stores: PropTypes.shape({ | 51 | stores: PropTypes.shape({ |
35 | user: PropTypes.instanceOf(UserStore).isRequired, | 52 | user: PropTypes.instanceOf(UserStore).isRequired, |
53 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
36 | }).isRequired, | 54 | }).isRequired, |
37 | }; | 55 | }; |