From 2bd5d4b91129c9735a912fc397c7ff5bccfff373 Mon Sep 17 00:00:00 2001 From: Mike Fortman Date: Fri, 13 Sep 2024 13:01:06 -0500 Subject: [PATCH] feat: Update tracking (#3805) * Update tracking * [autofix.ci] apply automated fixes * cleanup --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../GenericNode/components/NodeStatus/index.tsx | 2 ++ .../components/sideBarFolderButtons/index.tsx | 3 +++ .../src/modals/IOModal/components/chatView/index.tsx | 8 +++++--- src/frontend/src/modals/exportModal/index.tsx | 2 ++ .../components/NewFlowCardComponent/index.tsx | 2 ++ .../modals/newFlowModal/components/undrawCards/index.tsx | 2 ++ .../src/pages/FlowPage/components/PageComponent/index.tsx | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/NodeStatus/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/NodeStatus/index.tsx index cf3824d4f..670a9f9e4 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/NodeStatus/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/NodeStatus/index.tsx @@ -11,6 +11,7 @@ import { STATUS_INACTIVE, } from "@/constants/constants"; import { BuildStatus } from "@/constants/enums"; +import { track } from "@/customization/utils/analytics"; import { useDarkStore } from "@/stores/darkStore"; import useFlowStore from "@/stores/flowStore"; import { useShortcutsStore } from "@/stores/shortcuts"; @@ -160,6 +161,7 @@ export default function NodeStatus({ if (buildStatus === BuildStatus.BUILDING || isBuilding) return; setValidationStatus(null); buildFlow({ stopNodeId: nodeId }); + track("Flow Build - Clicked", { stopNodeId: nodeId }); }} unstyled className="group p-1" diff --git a/src/frontend/src/components/folderSidebarComponent/components/sideBarFolderButtons/index.tsx b/src/frontend/src/components/folderSidebarComponent/components/sideBarFolderButtons/index.tsx index a019c8c82..17f944271 100644 --- a/src/frontend/src/components/folderSidebarComponent/components/sideBarFolderButtons/index.tsx +++ b/src/frontend/src/components/folderSidebarComponent/components/sideBarFolderButtons/index.tsx @@ -6,6 +6,7 @@ import { } from "@/controllers/API/queries/folders"; import { useGetDownloadFolders } from "@/controllers/API/queries/folders/use-get-download-folders"; import { ENABLE_CUSTOM_PARAM } from "@/customization/feature-flags"; +import { track } from "@/customization/utils/analytics"; import { createFileUpload } from "@/helpers/create-file-upload"; import { getObjectsFromFilelist } from "@/helpers/get-objects-from-filelist"; import useUploadFlow from "@/hooks/flows/use-upload-flow"; @@ -151,6 +152,7 @@ const SideBarFoldersButtonsComponent = ({ description: "", }, }); + track("Create New Folder"); } function handleEditFolderName(e, name): void { @@ -401,6 +403,7 @@ const SideBarFoldersButtonsComponent = ({ handleDownloadFolder(item.id!); e.stopPropagation(); e.preventDefault(); + track("Folder Exported", { folderId: item.id! }); }} unstyled > diff --git a/src/frontend/src/modals/IOModal/components/chatView/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/index.tsx index fd6bb270a..d78246579 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/index.tsx @@ -1,5 +1,6 @@ import { useDeleteBuilds } from "@/controllers/API/queries/_builds"; import { usePostUploadFile } from "@/controllers/API/queries/files/use-post-upload-file"; +import { track } from "@/customization/utils/analytics"; import { useEffect, useRef, useState } from "react"; import ShortUniqueId from "short-unique-id"; import IconComponent from "../../../../components/genericIconComponent"; @@ -284,9 +285,10 @@ export default function ChatView({ chatValue={chatValue} noInput={!inputTypes.includes("ChatInput")} lockChat={lockChat} - sendMessage={({ repeat, files }) => - sendMessage({ repeat, files }) - } + sendMessage={({ repeat, files }) => { + sendMessage({ repeat, files }); + track("Playground Message Sent"); + }} setChatValue={(value) => { setChatValue(value); }} diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx index 9689170fa..c4cb29613 100644 --- a/src/frontend/src/modals/exportModal/index.tsx +++ b/src/frontend/src/modals/exportModal/index.tsx @@ -1,3 +1,4 @@ +import { track } from "@/customization/utils/analytics"; import useFlowStore from "@/stores/flowStore"; import { ReactNode, forwardRef, useEffect, useState } from "react"; import EditFlowSettings from "../../components/editFlowSettingsComponent"; @@ -66,6 +67,7 @@ const ExportModal = forwardRef( description, ); setOpen(false); + track("Flow Exported", { flowId: currentFlow!.id }); }} > {props.children} diff --git a/src/frontend/src/modals/newFlowModal/components/NewFlowCardComponent/index.tsx b/src/frontend/src/modals/newFlowModal/components/NewFlowCardComponent/index.tsx index 05c87c68b..98e0510bb 100644 --- a/src/frontend/src/modals/newFlowModal/components/NewFlowCardComponent/index.tsx +++ b/src/frontend/src/modals/newFlowModal/components/NewFlowCardComponent/index.tsx @@ -1,4 +1,5 @@ import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate"; +import { track } from "@/customization/utils/analytics"; import useAddFlow from "@/hooks/flows/use-add-flow"; import { useParams } from "react-router-dom"; import { @@ -19,6 +20,7 @@ export default function NewFlowCardComponent() { addFlow().then((id) => { navigate(`/flow/${id}${folderId ? `/folder/${folderId}` : ""}`); }); + track("New Flow Created: Blank Flow"); }} className="h-64 w-80 cursor-pointer bg-background pt-4" data-testid="blank-flow" diff --git a/src/frontend/src/modals/newFlowModal/components/undrawCards/index.tsx b/src/frontend/src/modals/newFlowModal/components/undrawCards/index.tsx index 290f08fd6..a784552f0 100644 --- a/src/frontend/src/modals/newFlowModal/components/undrawCards/index.tsx +++ b/src/frontend/src/modals/newFlowModal/components/undrawCards/index.tsx @@ -11,6 +11,7 @@ import BasicPrompt from "../../../../assets/undraw_short_bio_re_fmx0.svg?react"; import TransferFiles from "../../../../assets/undraw_transfer_files_re_a2a9.svg?react"; import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate"; +import { track } from "@/customization/utils/analytics"; import useAddFlow from "@/hooks/flows/use-add-flow"; import { Card, @@ -144,6 +145,7 @@ export default function UndrawCardComponent({ addFlow({ flow }).then((id) => { navigate(`/flow/${id}/folder/${folderIdUrl}`); }); + track(`New Flow Created: ${flow.name} Template`); }} className="h-64 w-80 cursor-pointer bg-background pt-4" > diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 17c285368..093b9d594 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -295,6 +295,7 @@ export default function Page({ view }: { view?: boolean }): JSX.Element { (params: Connection) => { takeSnapshot(); onConnect(params); + track("New Component Connection Added"); }, [takeSnapshot, onConnect], );