'use client' import type { FC } from 'react' import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' import PlanComp from '../plan' import { ReceiptList } from '../../base/icons/src/vender/line/financeAndECommerce' import { LinkExternal01 } from '../../base/icons/src/vender/line/general' import { fetchBillingUrl } from '@/service/billing' import { useAppContext } from '@/context/app-context' import { useProviderContext } from '@/context/provider-context' const Billing: FC = () => { const { t } = useTranslation() const { isCurrentWorkspaceManager } = useAppContext() const [billingUrl, setBillingUrl] = React.useState('') const { enableBilling } = useProviderContext() useEffect(() => { if (!enableBilling && !isCurrentWorkspaceManager) return (async () => { const { url } = await fetchBillingUrl() setBillingUrl(url) })() }, [isCurrentWorkspaceManager]) return (
{enableBilling && isCurrentWorkspaceManager && billingUrl && (
{t('billing.viewBilling')}
)}
) } export default React.memo(Billing)