From 6c3b34a61d8c08c9ea91f42bb387ad196c9f55ff Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 29 Jan 2024 17:26:43 +0800 Subject: [PATCH] chore: update price page (#2272) --- web/app/components/billing/config.ts | 26 ++++++++-- .../components/billing/pricing/plan-item.tsx | 52 +++++++++++++------ web/app/components/billing/type.ts | 6 ++- web/i18n/lang/billing.en.ts | 11 ++-- web/i18n/lang/billing.pt.ts | 5 +- web/i18n/lang/billing.zh.ts | 11 ++-- 6 files changed, 80 insertions(+), 31 deletions(-) diff --git a/web/app/components/billing/config.ts b/web/app/components/billing/config.ts index 435b78c77c..1456bdd081 100644 --- a/web/app/components/billing/config.ts +++ b/web/app/components/billing/config.ts @@ -3,6 +3,8 @@ import { Plan, type PlanInfo, Priority } from '@/app/components/billing/type' const supportModelProviders = 'OpenAI/Anthropic/Azure OpenAI/ Llama2/Hugging Face/Replicate' export const NUM_INFINITE = 99999999 +export const contractSales = 'contractSales' +export const unAvailable = 'unAvailable' export const contactSalesUrl = 'mailto:business@dify.ai' @@ -16,7 +18,11 @@ export const ALL_PLANS: Record = { vectorSpace: 5, documentProcessingPriority: Priority.standard, logHistory: 30, - messageRequest: 500, + customTools: unAvailable, + messageRequest: { + en: '200 messages', + zh: '200 条信息', + }, annotatedResponse: 10, }, professional: { @@ -28,7 +34,11 @@ export const ALL_PLANS: Record = { vectorSpace: 200, documentProcessingPriority: Priority.priority, logHistory: NUM_INFINITE, - messageRequest: NUM_INFINITE, + customTools: 10, + messageRequest: { + en: '5,000 messages/month', + zh: '5,000 条信息/月', + }, annotatedResponse: 2000, }, team: { @@ -40,7 +50,11 @@ export const ALL_PLANS: Record = { vectorSpace: 1000, documentProcessingPriority: Priority.topPriority, logHistory: NUM_INFINITE, - messageRequest: NUM_INFINITE, + customTools: NUM_INFINITE, + messageRequest: { + en: '10,000 messages/month', + zh: '10,000 条信息/月', + }, annotatedResponse: 5000, }, enterprise: { @@ -52,7 +66,11 @@ export const ALL_PLANS: Record = { vectorSpace: NUM_INFINITE, documentProcessingPriority: Priority.topPriority, logHistory: NUM_INFINITE, - messageRequest: NUM_INFINITE, + customTools: NUM_INFINITE, + messageRequest: { + en: contractSales, + zh: contractSales, + }, annotatedResponse: NUM_INFINITE, }, } diff --git a/web/app/components/billing/pricing/plan-item.tsx b/web/app/components/billing/pricing/plan-item.tsx index bd7c265cc0..823e4308d1 100644 --- a/web/app/components/billing/pricing/plan-item.tsx +++ b/web/app/components/billing/pricing/plan-item.tsx @@ -3,14 +3,17 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import cn from 'classnames' +import { useContext } from 'use-context-selector' import { Plan } from '../type' -import { ALL_PLANS, NUM_INFINITE, contactSalesUrl } from '../config' +import { ALL_PLANS, NUM_INFINITE, contactSalesUrl, contractSales, unAvailable } from '../config' import Toast from '../../base/toast' import TooltipPlus from '../../base/tooltip-plus' import { PlanRange } from './select-plan-range' import { HelpCircle } from '@/app/components/base/icons/src/vender/line/general' import { useAppContext } from '@/context/app-context' import { fetchSubscriptionUrls } from '@/service/billing' +import { LanguagesSupportedUnderscore, getModelRuntimeSupported } from '@/utils/language' +import I18n from '@/context/i18n' type Props = { currentPlan: Plan @@ -69,6 +72,9 @@ const PlanItem: FC = ({ canPay, }) => { const { t } = useTranslation() + const { locale } = useContext(I18n) + const language = getModelRuntimeSupported(locale) + const isZh = language === LanguagesSupportedUnderscore[1] const [loading, setLoading] = React.useState(false) const i18nPrefix = `billing.plans.${plan}` const isFreePlan = plan === Plan.sandbox @@ -79,7 +85,13 @@ const PlanItem: FC = ({ const isCurrent = plan === currentPlan const isPlanDisabled = planInfo.level <= ALL_PLANS[currentPlan].level || (!canPay && plan !== Plan.enterprise) const { isCurrentWorkspaceManager } = useAppContext() + const messagesRequest = (() => { + const value = planInfo.messageRequest[isZh ? 'zh' : 'en'] + if (value === contractSales) + return t('billing.plansCommon.contractSales') + return value + })() const btnText = (() => { if (!canPay && plan !== Plan.enterprise) return t('billing.plansCommon.contractOwner') @@ -100,7 +112,16 @@ const PlanItem: FC = ({ const supportContent = (() => { switch (plan) { case Plan.sandbox: - return t('billing.plansCommon.supportItems.communityForums') + return (
+
{t('billing.plansCommon.supportItems.communityForums')}
+
{t('billing.plansCommon.supportItems.agentMode')}
+
+
+
 {t('billing.plansCommon.supportItems.workflow')}
+
+
{comingSoon}
+
+
) case Plan.professional: return (
@@ -122,19 +143,12 @@ const PlanItem: FC = ({
{comingSoon}
-
-
+ {t('billing.plansCommon.supportItems.agentModel')}
-
{comingSoon}
-
) case Plan.team: return (
{t('billing.plansCommon.supportItems.priorityEmail')}
-
-
+ {t('billing.plansCommon.supportItems.logoChange')}
-
+ {t('billing.plansCommon.supportItems.SSOAuthentication')}
{comingSoon}
@@ -145,6 +159,9 @@ const PlanItem: FC = ({ return (
{t('billing.plansCommon.supportItems.personalizedSupport')}
+
+
+ {t('billing.plansCommon.supportItems.dedicatedAPISupport')}
+
+ {t('billing.plansCommon.supportItems.customIntegration')}
@@ -194,7 +211,7 @@ const PlanItem: FC = ({ )}
{t(`${i18nPrefix}.name`)}
-
{t(`${i18nPrefix}.description`)}
+
{t(`${i18nPrefix}.description`)}
{/* Price */} {isFreePlan && ( @@ -225,6 +242,11 @@ const PlanItem: FC = ({
{t(`${i18nPrefix}.includesTitle`)}
+ = ({ label={t('billing.plansCommon.documentProcessingPriority')} value={t(`billing.plansCommon.priority.${planInfo.documentProcessingPriority}`) as string} /> - + = ({ label={t('billing.plansCommon.logsHistory')} value={planInfo.logHistory === NUM_INFINITE ? t('billing.plansCommon.unlimited') as string : `${planInfo.logHistory} ${t('billing.plansCommon.days')}`} /> +