'use client' import type { FC } from 'react' import type { Category } from './types' import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog' import { ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, } from '@langgenius/dify-ui/scroll-area' import { useAtomValue } from 'jotai' import * as React from 'react' import { useState } from 'react' import { useGetPricingPageLanguage } from '@/context/i18n' import { useProviderContext } from '@/context/provider-context' import { isCurrentWorkspaceManagerAtom } from '@/context/workspace-state' import { NoiseBottom, NoiseTop } from './assets' import Footer from './footer' import Header from './header' import PlanSwitcher from './plan-switcher' import { PlanRange } from './plan-switcher/plan-range-switcher' import Plans from './plans' import { CategoryEnum } from './types' type PricingProps = { onCancel: () => void } const Pricing: FC = ({ onCancel }) => { const { plan, enableEducationPlan, isEducationAccount } = useProviderContext() const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom) const shouldDefaultToYearly = isCurrentWorkspaceManager && enableEducationPlan && isEducationAccount const [selectedPlanRange, setSelectedPlanRange] = React.useState() const planRange = selectedPlanRange ?? (shouldDefaultToYearly ? PlanRange.yearly : PlanRange.monthly) const [currentCategory, setCurrentCategory] = useState(CategoryEnum.CLOUD) const pricingPageLanguage = useGetPricingPageLanguage() const pricingPageURL = pricingPageLanguage ? `https://dify.ai/${pricingPageLanguage}/pricing#plans-and-features` : 'https://dify.ai/pricing#plans-and-features' return ( { if (!open) onCancel() }} >
) } export default React.memo(Pricing)