diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/containers/auth/PricingScreen.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/containers/auth/PricingScreen.js')
-rw-r--r-- | src/containers/auth/PricingScreen.js | 83 |
1 files changed, 0 insertions, 83 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 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | import { RouterStore } from 'mobx-react-router'; | ||
5 | |||
6 | import Pricing from '../../components/auth/Pricing'; | ||
7 | import UserStore from '../../stores/UserStore'; | ||
8 | |||
9 | import { globalError as globalErrorPropType } from '../../prop-types'; | ||
10 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
11 | |||
12 | export 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 | |||
74 | PricingScreen.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 | }; | ||