diff options
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/plan-helpers.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/helpers/plan-helpers.js b/src/helpers/plan-helpers.js new file mode 100644 index 000000000..19392585e --- /dev/null +++ b/src/helpers/plan-helpers.js | |||
@@ -0,0 +1,35 @@ | |||
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 | } | ||