diff options
author | vantezzen <properly@protonmail.com> | 2019-09-07 15:50:23 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-09-07 15:50:23 +0200 |
commit | e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e (patch) | |
tree | b8314e4155503b135dcb07e8b4a0e847e25c19cf /src/helpers | |
parent | Update CHANGELOG.md (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.tar.gz ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.tar.zst ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.zip |
Merge branch 'master' of https://github.com/meetfranz/franz into franz-5.3.0
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/plan-helpers.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/helpers/plan-helpers.js b/src/helpers/plan-helpers.js new file mode 100644 index 000000000..e0f1fd89a --- /dev/null +++ b/src/helpers/plan-helpers.js | |||
@@ -0,0 +1,45 @@ | |||
1 | import { defineMessages } from 'react-intl'; | ||
2 | import { PLANS_MAPPING, PLANS } from '../config'; | ||
3 | |||
4 | const messages = defineMessages({ | ||
5 | [PLANS.PRO]: { | ||
6 | id: 'pricing.plan.pro', | ||
7 | defaultMessage: '!!!Franz Professional', | ||
8 | }, | ||
9 | [PLANS.PERSONAL]: { | ||
10 | id: 'pricing.plan.personal', | ||
11 | defaultMessage: '!!!Franz Personal', | ||
12 | }, | ||
13 | [PLANS.FREE]: { | ||
14 | id: 'pricing.plan.free', | ||
15 | defaultMessage: '!!!Franz Free', | ||
16 | }, | ||
17 | [PLANS.LEGACY]: { | ||
18 | id: 'pricing.plan.legacy', | ||
19 | defaultMessage: '!!!Franz Premium', | ||
20 | }, | ||
21 | }); | ||
22 | |||
23 | export function i18nPlanName(planId, intl) { | ||
24 | if (!planId) { | ||
25 | throw new Error('planId is required'); | ||
26 | } | ||
27 | |||
28 | if (!intl) { | ||
29 | throw new Error('intl context is required'); | ||
30 | } | ||
31 | |||
32 | const plan = PLANS_MAPPING[planId]; | ||
33 | |||
34 | return intl.formatMessage(messages[plan]); | ||
35 | } | ||
36 | |||
37 | export function getPlan(planId) { | ||
38 | if (!planId) { | ||
39 | throw new Error('planId is required'); | ||
40 | } | ||
41 | |||
42 | const plan = PLANS_MAPPING[planId]; | ||
43 | |||
44 | return plan; | ||
45 | } | ||