🧑💻 (folders) Add folder trpc endpoints (#1218)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced folder management capabilities including creation, deletion, update, listing, and retrieval within workspaces. - Added telemetry tracking for client events, Typebot publish events, and analytics page views. - Enhanced settings to track client events under specific conditions. - Implemented server-side logic for analytics tracking with PostHog integration. - Added API documentation for folder operations (create, delete, get, list, update). - **Refactor** - Updated `onConfirm` function's return type in `ConfirmModal`. - Simplified folder creation process in tests. - Refactored logic for handling file upload blocks and parsing publish events in Typebot publishing. - Migrated handler functions to TRPC endpoints for folder operations. - **Documentation** - Introduced documentation for new folder and telemetry functionalities. - **Chores** - Added new schemas for folders and telemetry events, including event tracking and folder structure. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -10,6 +10,9 @@ import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
|
||||
import { ChangePlanModal } from '@/features/billing/components/ChangePlanModal'
|
||||
import { useTranslate } from '@tolgee/react'
|
||||
import { defaultTheme } from '@typebot.io/schemas/features/typebot/theme/constants'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
import { env } from '@typebot.io/env'
|
||||
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
|
||||
|
||||
type Props = {
|
||||
isBrandingEnabled: boolean
|
||||
@@ -27,8 +30,12 @@ export const GeneralSettings = ({
|
||||
const { t } = useTranslate()
|
||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||
const { workspace } = useWorkspace()
|
||||
const { typebot } = useTypebot()
|
||||
const isWorkspaceFreePlan = isFreePlan(workspace)
|
||||
|
||||
const { mutate: trackClientEvents } =
|
||||
trpc.telemetry.trackClientEvents.useMutation()
|
||||
|
||||
const handleSelectFont = (font: string) =>
|
||||
onGeneralThemeChange({ ...generalTheme, font })
|
||||
|
||||
@@ -37,6 +44,22 @@ export const GeneralSettings = ({
|
||||
|
||||
const updateBranding = () => {
|
||||
if (isBrandingEnabled && isWorkspaceFreePlan) return
|
||||
if (
|
||||
env.NEXT_PUBLIC_POSTHOG_KEY &&
|
||||
typebot &&
|
||||
workspace &&
|
||||
isBrandingEnabled
|
||||
) {
|
||||
trackClientEvents({
|
||||
events: [
|
||||
{
|
||||
name: 'Branding removed',
|
||||
typebotId: typebot.id,
|
||||
workspaceId: workspace.id,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
onBrandingChange(!isBrandingEnabled)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user