<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ### Summary by CodeRabbit - Refactor: Transitioned to a new translation library (`@tolgee/react`) across the application, enhancing the localization capabilities and consistency. - New Feature: Introduced a JSON configuration file for application settings, improving customization and flexibility. - Refactor: Updated SVG attribute naming convention in the `WhatsAppLogo` component to align with React standards. - Chore: Adjusted the `.gitignore` file and added a new line at the end. - Documentation: Added instructions for setting up environment variables for the Tolgee i18n contribution dev tool, improving the self-hosting configuration guide. - Style: Updated the `CollaborationMenuButton` to hide the `PopoverContent` component by scaling it down to zero. - Refactor: Simplified error handling logic for fetching and updating typebots in `TypebotProvider.tsx`, improving code readability and maintenance. - Refactor: Removed the dependency on the `parseGroupTitle` function, simplifying the code in several components. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
36 lines
824 B
TypeScript
36 lines
824 B
TypeScript
import { useToast } from '@/hooks/useToast'
|
|
import { trpc } from '@/lib/trpc'
|
|
import { useTranslate } from '@tolgee/react'
|
|
import { Button, ButtonProps, Link } from '@chakra-ui/react'
|
|
|
|
type Props = {
|
|
workspaceId: string
|
|
} & Pick<ButtonProps, 'colorScheme'>
|
|
|
|
export const BillingPortalButton = ({ workspaceId, colorScheme }: Props) => {
|
|
const { t } = useTranslate()
|
|
const { showToast } = useToast()
|
|
const { data } = trpc.billing.getBillingPortalUrl.useQuery(
|
|
{
|
|
workspaceId,
|
|
},
|
|
{
|
|
onError: (error) => {
|
|
showToast({
|
|
description: error.message,
|
|
})
|
|
},
|
|
}
|
|
)
|
|
return (
|
|
<Button
|
|
as={Link}
|
|
href={data?.billingPortalUrl}
|
|
isLoading={!data}
|
|
colorScheme={colorScheme}
|
|
>
|
|
{t('billing.billingPortalButton.label')}
|
|
</Button>
|
|
)
|
|
}
|