From 524d55f46e3834a84db17945eaa1c65891f06547 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 8 Aug 2019 19:50:17 +0200 Subject: Add option to subscribe to trial via account dashboard --- src/helpers/plan-helpers.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/helpers/plan-helpers.js (limited to 'src/helpers/plan-helpers.js') diff --git a/src/helpers/plan-helpers.js b/src/helpers/plan-helpers.js new file mode 100644 index 000000000..37a4457af --- /dev/null +++ b/src/helpers/plan-helpers.js @@ -0,0 +1,43 @@ +import { defineMessages } from 'react-intl'; +import { PLANS_MAPPING, PLANS } from '../config'; + +const messages = defineMessages({ + [PLANS.PRO_YEARLY]: { + id: 'pricing.plan.pro-yearly', + defaultMessage: '!!!Franz Professional Yearly', + }, + [PLANS.PRO_MONTHLY]: { + id: 'pricing.plan.pro-monthly', + defaultMessage: '!!!Franz Professional Monthly', + }, + [PLANS.PERSONAL_YEARLY]: { + id: 'pricing.plan.personal-yearly', + defaultMessage: '!!!Franz Personal Yearly', + }, + [PLANS.PERSONAL_MONTHLY]: { + id: 'pricing.plan.personal-monthly', + defaultMessage: '!!!Franz Personal Monthly', + }, + [PLANS.FREE]: { + id: 'pricing.plan.free', + defaultMessage: '!!!Franz Free', + }, + [PLANS.LEGACY]: { + id: 'pricing.plan.legacy', + defaultMessage: '!!!Franz Premium', + }, +}); + +export function i18nPlanName(planId, intl) { + if (!planId) { + throw new Error('planId is required'); + } + + if (!intl) { + throw new Error('intl context is required'); + } + + const plan = PLANS_MAPPING[planId]; + + return intl.formatMessage(messages[plan]); +} -- cgit v1.2.3-70-g09d2