'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 * as React from 'react' import { useState } from 'react' import { useAppContext } from '@/context/app-context' import { useGetPricingPageLanguage } from '@/context/i18n' import { useProviderContext } from '@/context/provider-context' 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 pricingScrollAreaClassNames = { root: 'relative h-full w-full overflow-hidden', viewport: 'overscroll-contain', content: 'min-h-full min-w-[1200px]', verticalScrollbar: 'data-[orientation=vertical]:my-2 data-[orientation=vertical]:me-1', horizontalScrollbar: 'data-[orientation=horizontal]:mx-2 data-[orientation=horizontal]:mb-0.5', corner: 'bg-saas-background', } as const const Pricing: FC = ({ onCancel, }) => { const { plan, enableEducationPlan, isEducationAccount } = useProviderContext() const { isCurrentWorkspaceManager } = useAppContext() 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 canPay = isCurrentWorkspaceManager 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)