diff options
author | 2019-08-19 12:11:38 +0200 | |
---|---|---|
committer | 2019-08-19 12:11:38 +0200 | |
commit | 478b5fc6574765072eafd4fa074ae832e67627bf (patch) | |
tree | 07dba02a6746685b00106ae2f37b529573876852 /src/components | |
parent | remove monthly & yearly names (diff) | |
download | ferdium-app-478b5fc6574765072eafd4fa074ae832e67627bf.tar.gz ferdium-app-478b5fc6574765072eafd4fa074ae832e67627bf.tar.zst ferdium-app-478b5fc6574765072eafd4fa074ae832e67627bf.zip |
Add trial / subscription handling
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/settings/account/AccountDashboard.js | 12 | ||||
-rw-r--r-- | src/components/settings/team/TeamDashboard.js | 10 | ||||
-rw-r--r-- | src/components/subscription/SubscriptionForm.js | 52 | ||||
-rw-r--r-- | src/components/subscription/SubscriptionPopup.js | 6 | ||||
-rw-r--r-- | src/components/subscription/TrialForm.js | 99 |
5 files changed, 126 insertions, 53 deletions
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index 079d50380..6d10487e8 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -23,10 +23,6 @@ const messages = defineMessages({ | |||
23 | id: 'settings.account.headlineSubscription', | 23 | id: 'settings.account.headlineSubscription', |
24 | defaultMessage: '!!!Your Subscription', | 24 | defaultMessage: '!!!Your Subscription', |
25 | }, | 25 | }, |
26 | headlineUpgrade: { | ||
27 | id: 'settings.account.headlineTrialUpgrade', | ||
28 | defaultMessage: '!!!Get the free 14 day Franz Professional Trial', | ||
29 | }, | ||
30 | headlineDangerZone: { | 26 | headlineDangerZone: { |
31 | id: 'settings.account.headlineDangerZone', | 27 | id: 'settings.account.headlineDangerZone', |
32 | defaultMessage: '!!Danger Zone', | 28 | defaultMessage: '!!Danger Zone', |
@@ -97,10 +93,8 @@ export default @observer class AccountDashboard extends Component { | |||
97 | static propTypes = { | 93 | static propTypes = { |
98 | user: MobxPropTypes.observableObject.isRequired, | 94 | user: MobxPropTypes.observableObject.isRequired, |
99 | isLoading: PropTypes.bool.isRequired, | 95 | isLoading: PropTypes.bool.isRequired, |
100 | isLoadingPlans: PropTypes.bool.isRequired, | ||
101 | userInfoRequestFailed: PropTypes.bool.isRequired, | 96 | userInfoRequestFailed: PropTypes.bool.isRequired, |
102 | retryUserInfoRequest: PropTypes.func.isRequired, | 97 | retryUserInfoRequest: PropTypes.func.isRequired, |
103 | onCloseSubscriptionWindow: PropTypes.func.isRequired, | ||
104 | deleteAccount: PropTypes.func.isRequired, | 98 | deleteAccount: PropTypes.func.isRequired, |
105 | isLoadingDeleteAccount: PropTypes.bool.isRequired, | 99 | isLoadingDeleteAccount: PropTypes.bool.isRequired, |
106 | isDeleteAccountSuccessful: PropTypes.bool.isRequired, | 100 | isDeleteAccountSuccessful: PropTypes.bool.isRequired, |
@@ -117,10 +111,8 @@ export default @observer class AccountDashboard extends Component { | |||
117 | const { | 111 | const { |
118 | user, | 112 | user, |
119 | isLoading, | 113 | isLoading, |
120 | isLoadingPlans, | ||
121 | userInfoRequestFailed, | 114 | userInfoRequestFailed, |
122 | retryUserInfoRequest, | 115 | retryUserInfoRequest, |
123 | onCloseSubscriptionWindow, | ||
124 | deleteAccount, | 116 | deleteAccount, |
125 | isLoadingDeleteAccount, | 117 | isLoadingDeleteAccount, |
126 | isDeleteAccountSuccessful, | 118 | isDeleteAccountSuccessful, |
@@ -134,7 +126,6 @@ export default @observer class AccountDashboard extends Component { | |||
134 | 126 | ||
135 | if (user.team && user.team.plan) { | 127 | if (user.team && user.team.plan) { |
136 | planName = i18nPlanName(user.team.plan, intl); | 128 | planName = i18nPlanName(user.team.plan, intl); |
137 | console.log(planName); | ||
138 | } | 129 | } |
139 | 130 | ||
140 | return ( | 131 | return ( |
@@ -221,7 +212,7 @@ export default @observer class AccountDashboard extends Component { | |||
221 | )} | 212 | )} |
222 | </div> | 213 | </div> |
223 | </div> | 214 | </div> |
224 | {user.isSubscriptionOwner && ( | 215 | {user.isPremium && user.isSubscriptionOwner && ( |
225 | <div className="account"> | 216 | <div className="account"> |
226 | <div className="account__box"> | 217 | <div className="account__box"> |
227 | <H2> | 218 | <H2> |
@@ -268,7 +259,6 @@ export default @observer class AccountDashboard extends Component { | |||
268 | {!user.isPremium && ( | 259 | {!user.isPremium && ( |
269 | <div className="account franz-form"> | 260 | <div className="account franz-form"> |
270 | <div className="account__box"> | 261 | <div className="account__box"> |
271 | <H2>{intl.formatMessage(messages.headlineUpgrade)}</H2> | ||
272 | <SubscriptionForm /> | 262 | <SubscriptionForm /> |
273 | </div> | 263 | </div> |
274 | </div> | 264 | </div> |
diff --git a/src/components/settings/team/TeamDashboard.js b/src/components/settings/team/TeamDashboard.js index 82c517fcb..990ee52e7 100644 --- a/src/components/settings/team/TeamDashboard.js +++ b/src/components/settings/team/TeamDashboard.js | |||
@@ -133,13 +133,13 @@ export default @injectSheet(styles) @observer class TeamDashboard extends Compon | |||
133 | </div> | 133 | </div> |
134 | <img className={classes.image} src="https://cdn.franzinfra.com/announcements/assets/teams.png" alt="Franz for Teams" /> | 134 | <img className={classes.image} src="https://cdn.franzinfra.com/announcements/assets/teams.png" alt="Franz for Teams" /> |
135 | </div> | 135 | </div> |
136 | <Button | ||
137 | label={intl.formatMessage(messages.manageButton)} | ||
138 | onClick={openTeamManagement} | ||
139 | className={classes.cta} | ||
140 | /> | ||
141 | </> | 136 | </> |
142 | </PremiumFeatureContainer> | 137 | </PremiumFeatureContainer> |
138 | <Button | ||
139 | label={intl.formatMessage(messages.manageButton)} | ||
140 | onClick={openTeamManagement} | ||
141 | className={classes.cta} | ||
142 | /> | ||
143 | </> | 143 | </> |
144 | )} | 144 | )} |
145 | </> | 145 | </> |
diff --git a/src/components/subscription/SubscriptionForm.js b/src/components/subscription/SubscriptionForm.js index 0c630f047..641368734 100644 --- a/src/components/subscription/SubscriptionForm.js +++ b/src/components/subscription/SubscriptionForm.js | |||
@@ -1,35 +1,30 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, intlShape, IntlProvider } from 'react-intl'; |
5 | import injectSheet from 'react-jss'; | 5 | import injectSheet from 'react-jss'; |
6 | 6 | ||
7 | import { H3 } from '@meetfranz/ui'; | 7 | import { H3, H2 } from '@meetfranz/ui'; |
8 | 8 | ||
9 | import { Button } from '@meetfranz/forms'; | 9 | import { Button } from '@meetfranz/forms'; |
10 | import { FeatureList } from '../ui/FeatureList'; | 10 | import { FeatureList } from '../ui/FeatureList'; |
11 | import { FeatureItem } from '../ui/FeatureItem'; | ||
12 | 11 | ||
13 | const messages = defineMessages({ | 12 | const messages = defineMessages({ |
14 | submitButtonLabel: { | 13 | submitButtonLabel: { |
15 | id: 'subscription.cta.activateTrial', | 14 | id: 'subscription.cta.choosePlan', |
16 | defaultMessage: '!!!Yes, upgrade my account to Franz Professional', | 15 | defaultMessage: '!!!Choose your plan', |
17 | }, | 16 | }, |
18 | includedFeatures: { | 17 | teaserHeadline: { |
19 | id: 'subscription.includedProFeatures', | 18 | id: 'settings.account.headlineUpgradeAccount', |
20 | defaultMessage: '!!!The Franz Professional Plan includes:', | 19 | defaultMessage: '!!!Upgrade your account and get the full Franz experience', |
21 | }, | ||
22 | noStringsAttachedHeadline: { | ||
23 | id: 'pricing.trial.terms.headline', | ||
24 | defaultMessage: '!!!No strings attached', | ||
25 | }, | 20 | }, |
26 | noCreditCard: { | 21 | teaserText: { |
27 | id: 'pricing.trial.terms.noCreditCard', | 22 | id: 'subscription.teaser.intro', |
28 | defaultMessage: '!!!No credit card required', | 23 | defaultMessage: '!!!Franz 5 comes with a wide range of new features to boost up your everyday communication - batteries included. Check out our new plans and find out which one suits you most!', |
29 | }, | 24 | }, |
30 | automaticTrialEnd: { | 25 | includedFeatures: { |
31 | id: 'pricing.trial.terms.automaticTrialEnd', | 26 | id: 'subscription.teaser.includedFeatures', |
32 | defaultMessage: '!!!Your free trial ends automatically after 14 days', | 27 | defaultMessage: '!!!Paid Franz Plans include:', |
33 | }, | 28 | }, |
34 | }); | 29 | }); |
35 | 30 | ||
@@ -37,14 +32,11 @@ const styles = () => ({ | |||
37 | activateTrialButton: { | 32 | activateTrialButton: { |
38 | margin: [40, 0, 50], | 33 | margin: [40, 0, 50], |
39 | }, | 34 | }, |
40 | keyTerms: { | ||
41 | marginTop: 20, | ||
42 | }, | ||
43 | }); | 35 | }); |
44 | 36 | ||
45 | export default @observer @injectSheet(styles) class SubscriptionForm extends Component { | 37 | export default @observer @injectSheet(styles) class SubscriptionForm extends Component { |
46 | static propTypes = { | 38 | static propTypes = { |
47 | activateTrial: PropTypes.func.isRequired, | 39 | selectPlan: PropTypes.func.isRequired, |
48 | isActivatingTrial: PropTypes.bool.isRequired, | 40 | isActivatingTrial: PropTypes.bool.isRequired, |
49 | classes: PropTypes.object.isRequired, | 41 | classes: PropTypes.object.isRequired, |
50 | }; | 42 | }; |
@@ -56,28 +48,20 @@ export default @observer @injectSheet(styles) class SubscriptionForm extends Com | |||
56 | render() { | 48 | render() { |
57 | const { | 49 | const { |
58 | isActivatingTrial, | 50 | isActivatingTrial, |
59 | activateTrial, | 51 | selectPlan, |
60 | classes, | 52 | classes, |
61 | } = this.props; | 53 | } = this.props; |
62 | const { intl } = this.context; | 54 | const { intl } = this.context; |
63 | 55 | ||
64 | console.log('isActivatingTrial', isActivatingTrial); | ||
65 | |||
66 | return ( | 56 | return ( |
67 | <> | 57 | <> |
68 | <H3 className={classes.keyTerms}> | 58 | <H2>{intl.formatMessage(messages.teaserHeadline)}</H2> |
69 | {intl.formatMessage(messages.noStringsAttachedHeadline)} | 59 | <p>{intl.formatMessage(messages.teaserText)}</p> |
70 | </H3> | ||
71 | <ul> | ||
72 | <FeatureItem icon="👉" name={intl.formatMessage(messages.noCreditCard)} /> | ||
73 | <FeatureItem icon="👉" name={intl.formatMessage(messages.automaticTrialEnd)} /> | ||
74 | </ul> | ||
75 | |||
76 | <Button | 60 | <Button |
77 | label={intl.formatMessage(messages.submitButtonLabel)} | 61 | label={intl.formatMessage(messages.submitButtonLabel)} |
78 | className={classes.activateTrialButton} | 62 | className={classes.activateTrialButton} |
79 | busy={isActivatingTrial} | 63 | busy={isActivatingTrial} |
80 | onClick={activateTrial} | 64 | onClick={selectPlan} |
81 | stretch | 65 | stretch |
82 | /> | 66 | /> |
83 | <div className="subscription__premium-info"> | 67 | <div className="subscription__premium-info"> |
diff --git a/src/components/subscription/SubscriptionPopup.js b/src/components/subscription/SubscriptionPopup.js index 0f6f0260f..9404e9c19 100644 --- a/src/components/subscription/SubscriptionPopup.js +++ b/src/components/subscription/SubscriptionPopup.js | |||
@@ -43,7 +43,7 @@ export default @observer class SubscriptionPopup extends Component { | |||
43 | 43 | ||
44 | setTimeout(() => { | 44 | setTimeout(() => { |
45 | this.props.closeWindow(); | 45 | this.props.closeWindow(); |
46 | }, ms('4s')); | 46 | }, ms('1s')); |
47 | } | 47 | } |
48 | 48 | ||
49 | render() { | 49 | render() { |
@@ -61,8 +61,8 @@ export default @observer class SubscriptionPopup extends Component { | |||
61 | autosize | 61 | autosize |
62 | src={encodeURI(url)} | 62 | src={encodeURI(url)} |
63 | onDidNavigate={completeCheck} | 63 | onDidNavigate={completeCheck} |
64 | // onNewWindow={(event, url, frameName, options) => | 64 | // webpreferences="allowpopups" |
65 | // openWindow({ event, url, frameName, options })} | 65 | // onNewWindow={(event, url, frameName, options) => console.log(event, url)} |
66 | /> | 66 | /> |
67 | </div> | 67 | </div> |
68 | <div className="subscription-popup__toolbar franz-form"> | 68 | <div className="subscription-popup__toolbar franz-form"> |
diff --git a/src/components/subscription/TrialForm.js b/src/components/subscription/TrialForm.js new file mode 100644 index 000000000..9c512b5f2 --- /dev/null +++ b/src/components/subscription/TrialForm.js | |||
@@ -0,0 +1,99 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer } from 'mobx-react'; | ||
4 | import { defineMessages, intlShape } from 'react-intl'; | ||
5 | import injectSheet from 'react-jss'; | ||
6 | |||
7 | import { H3, H2 } from '@meetfranz/ui'; | ||
8 | |||
9 | import { Button } from '@meetfranz/forms'; | ||
10 | import { FeatureList } from '../ui/FeatureList'; | ||
11 | import { FeatureItem } from '../ui/FeatureItem'; | ||
12 | |||
13 | const messages = defineMessages({ | ||
14 | submitButtonLabel: { | ||
15 | id: 'subscription.cta.activateTrial', | ||
16 | defaultMessage: '!!!Yes, start the free Franz Professional trial', | ||
17 | }, | ||
18 | teaserHeadline: { | ||
19 | id: 'settings.account.headlineTrialUpgrade', | ||
20 | defaultMessage: '!!!Get the free 14 day Franz Professional Trial', | ||
21 | }, | ||
22 | includedFeatures: { | ||
23 | id: 'subscription.includedProFeatures', | ||
24 | defaultMessage: '!!!The Franz Professional Plan includes:', | ||
25 | }, | ||
26 | noStringsAttachedHeadline: { | ||
27 | id: 'pricing.trial.terms.headline', | ||
28 | defaultMessage: '!!!No strings attached', | ||
29 | }, | ||
30 | noCreditCard: { | ||
31 | id: 'pricing.trial.terms.noCreditCard', | ||
32 | defaultMessage: '!!!No credit card required', | ||
33 | }, | ||
34 | automaticTrialEnd: { | ||
35 | id: 'pricing.trial.terms.automaticTrialEnd', | ||
36 | defaultMessage: '!!!Your free trial ends automatically after 14 days', | ||
37 | }, | ||
38 | }); | ||
39 | |||
40 | const styles = () => ({ | ||
41 | activateTrialButton: { | ||
42 | margin: [40, 0, 50], | ||
43 | }, | ||
44 | keyTerms: { | ||
45 | marginTop: 20, | ||
46 | }, | ||
47 | }); | ||
48 | |||
49 | export default @observer @injectSheet(styles) class TrialForm extends Component { | ||
50 | static propTypes = { | ||
51 | activateTrial: PropTypes.func.isRequired, | ||
52 | isActivatingTrial: PropTypes.bool.isRequired, | ||
53 | classes: PropTypes.object.isRequired, | ||
54 | }; | ||
55 | |||
56 | static contextTypes = { | ||
57 | intl: intlShape, | ||
58 | }; | ||
59 | |||
60 | render() { | ||
61 | const { | ||
62 | isActivatingTrial, | ||
63 | activateTrial, | ||
64 | classes, | ||
65 | } = this.props; | ||
66 | const { intl } = this.context; | ||
67 | |||
68 | console.log('isActivatingTrial', isActivatingTrial); | ||
69 | |||
70 | return ( | ||
71 | <> | ||
72 | <H2>{intl.formatMessage(messages.teaserHeadline)}</H2> | ||
73 | <H3 className={classes.keyTerms}> | ||
74 | {intl.formatMessage(messages.noStringsAttachedHeadline)} | ||
75 | </H3> | ||
76 | <ul> | ||
77 | <FeatureItem icon="👉" name={intl.formatMessage(messages.noCreditCard)} /> | ||
78 | <FeatureItem icon="👉" name={intl.formatMessage(messages.automaticTrialEnd)} /> | ||
79 | </ul> | ||
80 | |||
81 | <Button | ||
82 | label={intl.formatMessage(messages.submitButtonLabel)} | ||
83 | className={classes.activateTrialButton} | ||
84 | busy={isActivatingTrial} | ||
85 | onClick={activateTrial} | ||
86 | stretch | ||
87 | /> | ||
88 | <div className="subscription__premium-info"> | ||
89 | <H3> | ||
90 | {intl.formatMessage(messages.includedFeatures)} | ||
91 | </H3> | ||
92 | <div className="subscription"> | ||
93 | <FeatureList /> | ||
94 | </div> | ||
95 | </div> | ||
96 | </> | ||
97 | ); | ||
98 | } | ||
99 | } | ||