diff --git a/apps/agent/src/Layout/Workspace/modules/FeatureArea/index.tsx b/apps/agent/src/Layout/Workspace/modules/FeatureArea/index.tsx index fc479bef..8e48dd29 100644 --- a/apps/agent/src/Layout/Workspace/modules/FeatureArea/index.tsx +++ b/apps/agent/src/Layout/Workspace/modules/FeatureArea/index.tsx @@ -73,7 +73,7 @@ const FeatureArea: FC = () => { const handleClickFunction = () => { const isEmptyTeam = getIsEmptyTeam(store.getState()) - TipisTrack.track("click_function_entry") + TipisTrack.track("click_function_dashboard_tab") if (isEmptyTeam) { TipisTrack.track("click_create_team_entry", { diff --git a/apps/agent/src/main.tsx b/apps/agent/src/main.tsx index 781e972c..fec49749 100644 --- a/apps/agent/src/main.tsx +++ b/apps/agent/src/main.tsx @@ -10,6 +10,7 @@ import "@/i18n" import { initI18n } from "@/i18n" import App from "./App.tsx" import store from "./redux/store.ts" +import { TIPISStorage } from "./utils/storage/index.ts" if (import.meta.env.ILLA_APP_ENV === "production") { Sentry.init({ @@ -21,16 +22,16 @@ if (import.meta.env.ILLA_APP_ENV === "production") { if (import.meta.env.ILLA_MUI_LICENSE) { LicenseInfo.setLicenseKey(import.meta.env.ILLA_MUI_LICENSE) } - initGTMConfig() initI18n().then(() => { createRoot(document.getElementById("root")!).render( diff --git a/apps/agent/src/page/WorkSpace/AI/AIAgent/components/FunctionEditor/mockData.ts b/apps/agent/src/page/WorkSpace/AI/AIAgent/components/FunctionEditor/mockData.ts deleted file mode 100644 index 2e9775fc..00000000 --- a/apps/agent/src/page/WorkSpace/AI/AIAgent/components/FunctionEditor/mockData.ts +++ /dev/null @@ -1,99 +0,0 @@ -export const MOCK_LIST_DATA = [ - { - aiToolID: "ILAfx4p1C7er", - name: "Data report generation", - description: "Generate data reports based on user input", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/bd97de31-9cbb-4463-b44d-0202af7afdf6.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ep", - name: "Ask PDF", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7eq", - name: "Product Review Analysis", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/373dda4f-57aa-4992-b89a-ecdca9c1c2df.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - // -- - { - aiToolID: "ILAfx4p1C7ff1", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff2", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff3", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff4", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff5", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff6", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff7", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, - { - aiToolID: "ILAfx4p1C7ff8", - name: "Ask PDF Temp", - description: "Generate a thorough report on a specific subject", - config: { - icon: "https://sfo3.digitaloceanspaces.com/tipisai-team-storage.tipis.ai/team-8973d45a-d247-42d0-9eef-ef539955134b/system/icon/c103f69e-e471-41f7-9d96-22ca41470099.png", - }, - }, -] diff --git a/apps/agent/src/page/WorkSpace/Function/components/EditField/IntegrationEditor/index.tsx b/apps/agent/src/page/WorkSpace/Function/components/EditField/IntegrationEditor/index.tsx index 053954ae..31ff575a 100644 --- a/apps/agent/src/page/WorkSpace/Function/components/EditField/IntegrationEditor/index.tsx +++ b/apps/agent/src/page/WorkSpace/Function/components/EditField/IntegrationEditor/index.tsx @@ -9,6 +9,7 @@ import { PenIcon, PlusIcon, } from "@illa-public/icon" +import { TipisTrack } from "@illa-public/track-utils" import { ErrorText } from "@/Layout/Form/ErrorText" import LayoutBlock from "@/Layout/Function/LayoutBlock" import IntegrationSelectorModal from "@/Modules/Integration/CreateOrSelectIntegration/modal" @@ -33,9 +34,10 @@ import { const IntegrationEditor = memo(() => { const { t } = useTranslation() const { control } = useFormContext() - const integrationType = useWatch({ + + const [integrationType, aiToolID] = useWatch({ control, - name: "resourceType", + name: ["resourceType", "aiToolID"], }) const currentTeamInfo = useGetCurrentTeamInfo()! @@ -71,6 +73,12 @@ const IntegrationEditor = memo(() => { CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP, SELECT_INTEGRATION_STEP.SELECT_OR_CREATE, ) + TipisTrack.track("function_add_integration", { + parameter1: aiToolID + ? "edit_function" + : "create_function", + parameter2: integrationType, + }) setCreateOrSelectModalShow(true) }} > @@ -86,6 +94,12 @@ const IntegrationEditor = memo(() => { CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP, SELECT_INTEGRATION_STEP.SELECT_OR_CREATE, ) + TipisTrack.track("function_change_integration", { + parameter1: aiToolID + ? "edit_function" + : "create_function", + parameter2: integrationType, + }) setCreateOrSelectModalShow(true) }} > @@ -104,6 +118,12 @@ const IntegrationEditor = memo(() => {
{ + TipisTrack.track("function_edit_integration", { + parameter1: aiToolID + ? "edit_function" + : "create_function", + parameter2: integrationType, + }) IntegrationEventEmitter.emit( CREATE_INTEGRATION_EVENT.CHANGE_MODAL_STEP, SELECT_INTEGRATION_STEP.EDIT, @@ -124,6 +144,10 @@ const IntegrationEditor = memo(() => { changeOpen={setCreateOrSelectModalShow} integrationType={integrationType} onConfirm={async (integrationID) => { + TipisTrack.track("integration_save", { + parameter1: aiToolID ? "edit_function" : "create_function", + parameter2: integrationType, + }) try { const integrationList = await dispatch( integrationAPI.endpoints.getIntegrationList.initiate( diff --git a/apps/agent/src/page/WorkSpace/Function/create.tsx b/apps/agent/src/page/WorkSpace/Function/create.tsx index 79f7fc12..58b9104e 100644 --- a/apps/agent/src/page/WorkSpace/Function/create.tsx +++ b/apps/agent/src/page/WorkSpace/Function/create.tsx @@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next" import { useBeforeUnload, useParams } from "react-router-dom" import { getFunctionInitDataByType } from "@illa-public/public-configs" import { IBaseFunction, TIntegrationType } from "@illa-public/public-types" +import { TipisTrack } from "@illa-public/track-utils" import { getCurrentId } from "@illa-public/user-data" import WorkspacePCHeaderLayout from "@/Layout/Workspace/pc/components/Header" import { useCreateAIToolMutation } from "@/redux/services/aiToolsAPI" @@ -75,6 +76,10 @@ const CreateFunction: FC = () => { }, [values]) const createFunctionWhenSubmit = async (data: IFunctionForm) => { + TipisTrack.track("create_function", { + parameter1: "edit_function", + parameter2: data.resourceType, + }) const icon = data.config.icon const aiTool: IBaseFunction = { diff --git a/apps/agent/src/page/WorkSpace/Function/edit.tsx b/apps/agent/src/page/WorkSpace/Function/edit.tsx index d87504ff..c117abe6 100644 --- a/apps/agent/src/page/WorkSpace/Function/edit.tsx +++ b/apps/agent/src/page/WorkSpace/Function/edit.tsx @@ -4,6 +4,7 @@ import { FormProvider, useForm, useWatch } from "react-hook-form" import { useTranslation } from "react-i18next" import { useBeforeUnload, useParams } from "react-router-dom" import { IBaseFunction } from "@illa-public/public-types" +import { TipisTrack } from "@illa-public/track-utils" import { getCurrentId } from "@illa-public/user-data" import WorkspacePCHeaderLayout from "@/Layout/Workspace/pc/components/Header" import FullSectionLoading from "@/components/FullSectionLoading" @@ -157,6 +158,10 @@ const EditFunction: FC = ({ originData, cacheData }) => { }, [currentTeamInfo.id, functionID, values]) const updateFunctionWhenSubmit = async (data: IFunctionForm) => { + TipisTrack.track("function_save", { + parameter1: "edit_function", + parameter2: data.resourceType, + }) const icon = data.config.icon const aiTool: IBaseFunction = { diff --git a/apps/agent/src/page/WorkSpace/Function/interface.ts b/apps/agent/src/page/WorkSpace/Function/interface.ts index 6a98b8e1..32508e6e 100644 --- a/apps/agent/src/page/WorkSpace/Function/interface.ts +++ b/apps/agent/src/page/WorkSpace/Function/interface.ts @@ -10,11 +10,13 @@ export interface IIntegrationInfo { export interface ITencentCosFunctionForm extends Omit { + aiToolID: string integrationInfo: IIntegrationInfo } export interface ILarkBotFunctionForm extends Omit { + aiToolID: string integrationInfo: IIntegrationInfo } diff --git a/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/index.tsx b/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/index.tsx index 34d71e72..7a741a72 100644 --- a/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/index.tsx +++ b/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/index.tsx @@ -1,6 +1,7 @@ import { List } from "antd" import Fuse from "fuse.js" import { FC, useContext } from "react" +import { TipisTrack } from "@illa-public/track-utils" import FullSectionLoading from "@/components/FullSectionLoading" import TeamNoData from "@/components/TeamNoData" import { useGetAllAIToolsListQuery } from "@/redux/services/aiToolsAPI" @@ -22,6 +23,9 @@ const TeamCardList: FC = (props) => { const { data, isLoading } = useGetAllAIToolsListQuery(currentTeamInfo.id) const handleClickCreateTipis = () => { + TipisTrack.track("click_create_function_entry", { + parameter1: "dashboard_create", + }) changeCreateFunctionModal(true) } @@ -67,6 +71,7 @@ const TeamCardList: FC = (props) => { description={item.description} publishToMarketplace={item.publishedToMarketplace} id={item.aiToolID} + type={item.resourceType} /> )} /> diff --git a/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/interface.ts b/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/interface.ts index b3730795..2aa9a49a 100644 --- a/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/interface.ts +++ b/apps/agent/src/page/WorkSpace/FunctionDashboard/components/TeamCardList/interface.ts @@ -1,4 +1,5 @@ import { ComponentType } from "react" +import { TIntegrationType } from "@illa-public/public-types" export interface ITeamCardListItemProps { icon: string @@ -6,7 +7,9 @@ export interface ITeamCardListItemProps { publishToMarketplace: boolean description: string id: string + type: TIntegrationType } + export interface ITeamCardListProps { RenderItem: ComponentType } diff --git a/apps/agent/src/page/WorkSpace/FunctionDashboard/index.tsx b/apps/agent/src/page/WorkSpace/FunctionDashboard/index.tsx index 69065ae8..580eb8f0 100644 --- a/apps/agent/src/page/WorkSpace/FunctionDashboard/index.tsx +++ b/apps/agent/src/page/WorkSpace/FunctionDashboard/index.tsx @@ -2,10 +2,9 @@ import { FC, lazy, useEffect } from "react" import { LayoutAutoChange } from "@illa-public/layout-auto-change" import { useAddExploreFunctionsTab } from "@/utils/recentTabs/hook" import { FunctionDashboardUIStateProvider } from "./context/functionDashboard" -import FunctionsMobileDashboard from "./mobile" const FunctionsPCDashboard = lazy(() => import("./pc")) -// const TipisMobileDashboard = lazy(() => import("./mobile")) +const FunctionsMobileDashboard = lazy(() => import("./mobile")) const FunctionsDashboard: FC = () => { const addExploreFunctionTab = useAddExploreFunctionsTab() diff --git a/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/HeaderTools/index.tsx b/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/HeaderTools/index.tsx index b23bfc87..65f86c2f 100644 --- a/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/HeaderTools/index.tsx +++ b/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/HeaderTools/index.tsx @@ -2,6 +2,7 @@ import Icon from "@ant-design/icons" import { Button, Input } from "antd" import { FC, useContext } from "react" import { PlusIcon, SearchIcon } from "@illa-public/icon" +import { TipisTrack } from "@illa-public/track-utils" import { useSearchFunctionDashboard } from "../../../utils" import { FunctionDashboardContext } from "../../context" import { headerToolsContainerStyle } from "./style" @@ -11,6 +12,10 @@ const HeaderTools: FC = () => { const { searchValue, handleChangeSearchValue } = useSearchFunctionDashboard() const handleClickCreateFunction = () => { + TipisTrack.track("click_create_function_entry", { + parameter1: "dashboard_create", + }) + changeCreateFunctionModal(true) } diff --git a/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/TeamCardListItem/index.tsx b/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/TeamCardListItem/index.tsx index ebc69d22..b56240f7 100644 --- a/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/TeamCardListItem/index.tsx +++ b/apps/agent/src/page/WorkSpace/FunctionDashboard/pc/components/TeamCardListItem/index.tsx @@ -3,6 +3,7 @@ import { App, Button, Dropdown, List, MenuProps, Tag } from "antd" import { FC, MouseEventHandler, useMemo, useState } from "react" import { useTranslation } from "react-i18next" import { CopyIcon, DeleteIcon, MoreIcon, PenIcon } from "@illa-public/icon" +import { TipisTrack } from "@illa-public/track-utils" import PCTeamCard from "@/components/TeamCard/pc" import { useDeleteAIToolByIDMutation, @@ -12,10 +13,10 @@ import { canShowCreateFunction } from "@/utils/UIHelper/functions" import { canShownCreateTipi } from "@/utils/UIHelper/tipis" import { useNavigateToEditFunction } from "@/utils/routeHelper/hook" import { useGetCurrentTeamInfo } from "@/utils/team" -import { ITeamCardListItemProps } from "./interface" +import { ITeamCardListItemProps } from "../../../components/TeamCardList/interface" const TeamCardListItem: FC = (props) => { - const { icon, title, description, id, publishToMarketplace } = props + const { icon, title, description, id, publishToMarketplace, type } = props const { modal, message } = App.useApp() const { t } = useTranslation() @@ -94,10 +95,13 @@ const TeamCardListItem: FC = (props) => { } } - const onClickCard = () => {} - const onClickEditButton: MouseEventHandler = async (e) => { e.stopPropagation() + TipisTrack.track("click_function_card_edit", { + parameter1: "dashboard_edit", + parameter2: type, + }) + await navigateToEditFunction({ functionName: title, functionID: id, @@ -116,7 +120,6 @@ const TeamCardListItem: FC = (props) => { title={title} description={description} tags={tags} - onClickCard={onClickCard} moreButton={ menuItems.length > 0 && (