'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import useSWR from 'swr' import { RiExternalLinkLine, } from '@remixicon/react' import PlanComp from '../plan' import { ReceiptList } from '../../base/icons/src/vender/line/financeAndECommerce' 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 { enableBilling } = useProviderContext() const { data: billingUrl } = useSWR( (!enableBilling || !isCurrentWorkspaceManager) ? null : ['/billing/invoices'], () => fetchBillingUrl().then(data => data.url), ) return (
{enableBilling && isCurrentWorkspaceManager && billingUrl && (
{t('billing.viewBilling')}
)}
) } export default React.memo(Billing)