The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: Add two new events for the submit form (#35199)
Ivan Vasilov77304a4c5667
diff --git a/apps/studio/components/interfaces/Support/AIAssistantOption.tsx b/apps/studio/components/interfaces/Support/AIAssistantOption.tsxindex 7a20fa9eb44..8549b831b2c 100644--- a/apps/studio/components/interfaces/Support/AIAssistantOption.tsx+++ b/apps/studio/components/interfaces/Support/AIAssistantOption.tsx@@ -1,9 +1,10 @@-import { Button } from 'ui'-import { MessageSquare, Send, X } from 'lucide-react'-import { motion, AnimatePresence } from 'framer-motion'-import { useState, useEffect } from 'react'-import Link from 'next/link'import { useProjectsQuery } from 'data/projects/projects-query'+import { useSendEventMutation } from 'data/telemetry/send-event-mutation'+import { AnimatePresence, motion } from 'framer-motion'+import { MessageSquare, X } from 'lucide-react'+import Link from 'next/link'+import { useCallback, useEffect, useState } from 'react'+import { Button } from 'ui'interface AIAssistantOptionProps {projectRef: string@@ -13,12 +14,23 @@ interface AIAssistantOptionProps {export const AIAssistantOption = ({ projectRef, organizationSlug }: AIAssistantOptionProps) => {const [isVisible, setIsVisible] = useState(false)const { data: projects } = useProjectsQuery()+ const { mutate: sendEvent } = useSendEventMutation()useEffect(() => {const timer = setTimeout(() => setIsVisible(true), 800)return () => clearTimeout(timer)}, [])+ const onAiAssistantClicked = useCallback(() => {+ sendEvent({+ action: 'ai_assistant_in_support_form_clicked',+ groups: {+ project: projectRef === 'no-project' ? undefined : projectRef,+ organization: organizationSlug,+ },+ })+ }, [projectRef, organizationSlug, sendEvent])+if (!organizationSlug || organizationSlug === 'no-org') {return null}@@ -59,7 +71,7 @@ export const AIAssistantOption = ({ projectRef, organizationSlug }: AIAssistantO</p></div><div>- <Link href={aiLink}>+ <Link href={aiLink} onClick={onAiAssistantClicked}><Button size="tiny" type="default">Ask AI assistant</Button>diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsxindex d1adafc13dd..8a6dc6e2962 100644--- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx+++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx@@ -14,6 +14,7 @@ import { useSendSupportTicketMutation } from 'data/feedback/support-ticket-send'import { useOrganizationsQuery } from 'data/organizations/organizations-query'import type { Project } from 'data/projects/project-detail-query'import { useProjectsQuery } from 'data/projects/projects-query'+import { useSendEventMutation } from 'data/telemetry/send-event-mutation'import { detectBrowser } from 'lib/helpers'import { useProfile } from 'lib/profile'import {@@ -146,11 +147,22 @@ export const SupportFormV2 = ({isLoading: isLoadingProjects,isSuccess: isSuccessProjects,} = useProjectsQuery()+ const { mutate: sendEvent } = useSendEventMutation()const { mutate: submitSupportTicket } = useSendSupportTicketMutation({onSuccess: (res, variables) => {toast.success('Support request sent. Thank you!')setSentCategory(variables.category)+ sendEvent({+ action: 'support_ticket_submitted',+ properties: {+ ticketCategory: variables.category,+ },+ groups: {+ project: projectRef === 'no-project' ? undefined : projectRef,+ organization: variables.organizationSlug,+ },+ })setSelectedProject(variables.projectRef ?? 'no-project')},onError: (error) => {diff --git a/apps/studio/components/layouts/OrganizationLayout.tsx b/apps/studio/components/layouts/OrganizationLayout.tsxindex 1327d8a641a..4bdfa107cd8 100644--- a/apps/studio/components/layouts/OrganizationLayout.tsx+++ b/apps/studio/components/layouts/OrganizationLayout.tsx@@ -1,6 +1,6 @@import { ExternalLink } from 'lucide-react'import { useRouter } from 'next/router'-import { Fragment, type PropsWithChildren } from 'react'+import { type PropsWithChildren } from 'react'import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import PartnerIcon from 'components/ui/PartnerIcon'@@ -138,17 +138,24 @@ const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {},]- const OrganizationLayoutContentWrapper = !newLayoutPreview ? WithSidebar : Fragment+ if (newLayoutPreview) {+ return (+ <>+ {!newLayoutPreview && <LayoutHeader />}+ <OrganizationLayoutContent>{children}</OrganizationLayoutContent>+ </>+ )+ }return (- <OrganizationLayoutContentWrapper+ <WithSidebartitle={selectedOrganization?.name ?? 'Supabase'}breadcrumbs={[{ key: `org-settings`, label: 'Settings' }]}sections={sectionsWithHeaders}>{!newLayoutPreview && <LayoutHeader />}<OrganizationLayoutContent>{children}</OrganizationLayoutContent>- </OrganizationLayoutContentWrapper>+ </WithSidebar>)}diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex ea6a7531f89..cac4d1d6696 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -1254,6 +1254,40 @@ export interface EdgeFunctionTestSidePanelOpenedEvent {}}+/**+ * User submitted a support ticket. Project and organization are optional because the ticket might be about user account issues.+ *+ * @group Events+ * @source studio+ * @page /dashboard/support/new+ */+export interface SupportTicketSubmittedEvent {+ action: 'support_ticket_submitted'+ properties: {+ ticketCategory: string+ }+ groups: {+ project?: string+ organization?: string+ }+}++/**+ * User clicked the AI Assistant card on top of the support ticket form.+ * This event is specifically when the user goes back to the AI Assistant in the Studio.+ *+ * @group Events+ * @source studio+ * @page /dashboard/support/new+ */+export interface AiAssistantInSupportFormClickedEvent {+ action: 'ai_assistant_in_support_form_clicked'+ groups: {+ project?: string+ organization?: string+ }+}+/*** User copied the command for a Supabase UI component.*@@ -1347,3 +1381,5 @@ export type TelemetryEvent =| EdgeFunctionTestSendButtonClickedEvent| EdgeFunctionTestSidePanelOpenedEvent| SupabaseUiCommandCopyButtonClickedEvent+ | SupportTicketSubmittedEvent+ | AiAssistantInSupportFormClickedEvent