aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/plan-helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/plan-helpers.js')
-rw-r--r--src/helpers/plan-helpers.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/helpers/plan-helpers.js b/src/helpers/plan-helpers.js
index ee22e4471..b474f8bbd 100644
--- a/src/helpers/plan-helpers.js
+++ b/src/helpers/plan-helpers.js
@@ -20,6 +20,10 @@ const messages = defineMessages({
20 }, 20 },
21}); 21});
22 22
23export function cleanupPlanId(id) {
24 return id.replace(/(.*)-x[0-9]/, '$1');
25}
26
23export function i18nPlanName(planId, intl) { 27export function i18nPlanName(planId, intl) {
24 if (!planId) { 28 if (!planId) {
25 throw new Error('planId is required'); 29 throw new Error('planId is required');
@@ -29,7 +33,9 @@ export function i18nPlanName(planId, intl) {
29 throw new Error('intl context is required'); 33 throw new Error('intl context is required');
30 } 34 }
31 35
32 const plan = PLANS_MAPPING[planId]; 36 const id = cleanupPlanId(planId);
37
38 const plan = PLANS_MAPPING[id];
33 39
34 return intl.formatMessage(messages[plan]); 40 return intl.formatMessage(messages[plan]);
35} 41}
@@ -39,7 +45,9 @@ export function getPlan(planId) {
39 throw new Error('planId is required'); 45 throw new Error('planId is required');
40 } 46 }
41 47
42 const plan = PLANS_MAPPING[planId]; 48 const id = cleanupPlanId(planId);
49
50 const plan = PLANS_MAPPING[id];
43 51
44 return plan; 52 return plan;
45} 53}