/* * @Author: ZhaoYing * @Date: 2026-02-03 17:38:12 * @Last Modified by: ZhaoYing * @Last Modified time: 2026-02-03 17:38:12 */ /** * Pricing Page * Displays subscription plans with features and pricing * Supports navigation to payment or order history */ import React from 'react'; import { Button } from 'antd'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import personal from '@/assets/images/order/personal.png' import team from '@/assets/images/order/team.png' import biz from '@/assets/images/order/biz.png' import commerce from '@/assets/images/order/commerce.png' import checkIcon from '@/assets/images/login/checkBg.png' import alertIcon from '@/assets/images/order/alert.svg'; import { useUser } from '@/store/user' import { useI18n } from '@/store/locale' /** * Price item configuration interface */ interface PriceItem { type: string; label: string; typeDesc: string; priceDescObj: { solution: string; targetAudience: string; }; priceObj: { type: string; price?: number; time: string; }; btnType: string; memoryCapacity: string; intelligentSearchFrequency: string; mostPopular?: boolean; flexibleDeployment?: boolean; reliableGuarantee?: boolean; } /** Button style classes by plan type */ const btnClassNames = { personal: 'rb:h-10! rb:rounded-[8px]!', team: 'rb:h-10! rb:rounded-[8px]! rb:bg-[#FF5D34]! rb:text-white! rb:border-0! rb:hover:border-0! rb:hover:opacity-[0.8]', biz: 'rb:h-10! rb:rounded-[8px]!', commerce: 'rb:h-10! rb:rounded-[8px]! rb:bg-[#212332]! rb:text-white! rb:border-0! rb:hover:border-0! rb:hover:opacity-[0.8]', } /** Price plan list configuration */ export const PRICE_LIST: PriceItem[] = [ { type: 'personal', label: 'pricing.personal.label', typeDesc: 'pricing.personal.typeDesc', priceDescObj: { solution: 'pricing.personal.solution', targetAudience: 'pricing.personal.targetAudience', }, priceObj: { type: 'default', price: 0, time: 'pricing.personal.priceDesc', }, btnType: 'started', // started / choosePlan / contact memoryCapacity: '2000', intelligentSearchFrequency: '100', }, { type: 'team', label: 'pricing.team.label', typeDesc: 'pricing.team.typeDesc', priceDescObj: { solution: 'pricing.team.solution', targetAudience: 'pricing.team.targetAudience', }, priceObj: { type: 'default', price: 19, time: 'pricing.team.priceDesc' }, btnType: 'choosePlan', // started / choosePlan / contact memoryCapacity: '20,000', intelligentSearchFrequency: '10,000', }, { type: 'biz', label: 'pricing.biz.label', typeDesc: 'pricing.biz.typeDesc', priceDescObj: { solution: 'pricing.biz.solution', targetAudience: 'pricing.biz.targetAudience', }, mostPopular: true, priceObj: { type: 'default', // default / biz price: 299, time: 'pricing.biz.priceDesc' }, btnType: 'choosePlan', // started / choosePlan / contact memoryCapacity: '100,000', intelligentSearchFrequency: '50,000', }, { type: 'commerce', label: 'pricing.commerce.label', typeDesc: 'pricing.commerce.typeDesc', priceDescObj: { solution: 'pricing.commerce.solution', targetAudience: 'pricing.commerce.targetAudience', }, priceObj: { type: 'commerce', // default / commerce time: 'pricing.commerce.priceDesc' }, btnType: 'contact', // started / choosePlan / contact memoryCapacity: '20,000', intelligentSearchFrequency: '10,000', flexibleDeployment: true, reliableGuarantee: true }, ] const PricingView: React.FC = () => { const { t } = useTranslation(); const navigate = useNavigate(); const { user } = useUser(); const { language } = useI18n() /** Handle plan selection */ const handleChoosePlan = (type: string) => { switch(type) { case 'team': case 'biz': navigate(`/order-pay?type=${type}`); break case 'personal': navigate(user.current_workspace_id ? '/' : '/space'); break case 'commerce': window.open(`https://docs.redbearai.com/s/${language || 'en'}-memorybear`, '_blank') break } }; /** Navigate to order history */ const goToHistory = () => { navigate('/orders'); } /** Get card icon by plan type */ const getCardIcon = (type: string) => { const iconMap: Record = { personal: personal, team: team, biz: biz, commerce: commerce }; return iconMap[type] || commerce; }; return (
{/*
{t(`pricing.${'personal'}.type`)}
{t('pricing.currentAccountType')} | {t(`pricing.validUntil`)} December 31, 2024
*/}
{PRICE_LIST.map((item) => (
{item.mostPopular && (
{t('pricing.mostPopular')}
)} {/* Icon */} {/* Title */}

{t(`pricing.${item.type}.type`)}

{/* Description */}

{t(item.typeDesc)}

{/* Price */}
{typeof item.priceObj.price !== 'undefined' ? (
$ {item.priceObj.price.toLocaleString()} {t(item.priceObj.time)}
) : (
{t(item.priceObj.time)}
)}
{/* CTA Button */} {Object.keys(item.priceDescObj).map(key => (
{t(`pricing.${key}`)}
{t(item.priceDescObj[key as keyof typeof item.priceDescObj])}
))} {/* Features */}
{t('pricing.memoryCapacity')} { item.memoryCapacity } {t('pricing.entries')}
{t('pricing.intelligentSearchFrequency')}{ item.intelligentSearchFrequency } {t('pricing.timesMonth')}
{['supportServices', 'flexibleDeployment', 'reliableGuarantee'].map(type => { if ((item as any)[type] || type === 'supportServices') { return (
{t(`pricing.${type}`)}{t(`pricing.${item.type}.${type}`)}
) } return null })}
))}
{/* Warning Notice */}

{t('pricing.alertTitle')}

{t('pricing.alertContent')}

); }; export default PricingView;