diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/helpers/plan-helpers.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/helpers/plan-helpers.js')
-rw-r--r-- | src/helpers/plan-helpers.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/helpers/plan-helpers.js b/src/helpers/plan-helpers.js deleted file mode 100644 index b474f8bbd..000000000 --- a/src/helpers/plan-helpers.js +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
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: '!!!Professional', | ||
8 | }, | ||
9 | [PLANS.PERSONAL]: { | ||
10 | id: 'pricing.plan.personal', | ||
11 | defaultMessage: '!!!Personal', | ||
12 | }, | ||
13 | [PLANS.FREE]: { | ||
14 | id: 'pricing.plan.free', | ||
15 | defaultMessage: '!!!Free', | ||
16 | }, | ||
17 | [PLANS.LEGACY]: { | ||
18 | id: 'pricing.plan.legacy', | ||
19 | defaultMessage: '!!!Premium', | ||
20 | }, | ||
21 | }); | ||
22 | |||
23 | export function cleanupPlanId(id) { | ||
24 | return id.replace(/(.*)-x[0-9]/, '$1'); | ||
25 | } | ||
26 | |||
27 | export function i18nPlanName(planId, intl) { | ||
28 | if (!planId) { | ||
29 | throw new Error('planId is required'); | ||
30 | } | ||
31 | |||
32 | if (!intl) { | ||
33 | throw new Error('intl context is required'); | ||
34 | } | ||
35 | |||
36 | const id = cleanupPlanId(planId); | ||
37 | |||
38 | const plan = PLANS_MAPPING[id]; | ||
39 | |||
40 | return intl.formatMessage(messages[plan]); | ||
41 | } | ||
42 | |||
43 | export function getPlan(planId) { | ||
44 | if (!planId) { | ||
45 | throw new Error('planId is required'); | ||
46 | } | ||
47 | |||
48 | const id = cleanupPlanId(planId); | ||
49 | |||
50 | const plan = PLANS_MAPPING[id]; | ||
51 | |||
52 | return plan; | ||
53 | } | ||