chore: posthog event for workspace invite (#2989)

* chore: posthog event for workspace invite

* chore: updated event names, added all the existing events to workspace metrics group

* chore: seperated workspace invite

* fix: workspace invite accept event updated

---------

Co-authored-by: Ramesh Kumar Chandra <rameshkumar2299@gmail.com>
This commit is contained in:
Bavisetti Narayan 2023-12-06 17:15:14 +05:30 committed by sriram veeraghanta
parent 37c03ff239
commit b35874e294
25 changed files with 441 additions and 120 deletions

View file

@ -8,11 +8,9 @@ import githubWhiteImage from "/public/logos/github-white.png";
// components
import { ProductUpdatesModal } from "components/common";
import { Breadcrumbs } from "@plane/ui";
import { useMobxStore } from "lib/mobx/store-provider";
export const WorkspaceDashboardHeader = () => {
const [isProductUpdatesModalOpen, setIsProductUpdatesModalOpen] = useState(false);
const { trackEvent: { postHogEventTracker } } = useMobxStore();
// theme
const { resolvedTheme } = useTheme();

View file

@ -24,7 +24,7 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
const router = useRouter();
const { workspaceSlug, projectId, inboxIssueId } = router.query;
const { user: userStore } = useMobxStore();
const { user: userStore, trackEvent: { postHogEventTracker }, workspace: { currentWorkspace } } = useMobxStore();
const { setToastAlert } = useToast();
@ -42,7 +42,22 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
await issueCommentService
.patchIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, data)
.then(() => mutateIssueActivity());
.then((res) => {
mutateIssueActivity();
postHogEventTracker(
"COMMENT_UPDATED",
{
...res,
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
}
);
};
const handleCommentDelete = async (commentId: string) => {
@ -52,7 +67,21 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
await issueCommentService
.deleteIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId)
.then(() => mutateIssueActivity());
.then(() => {
mutateIssueActivity();
postHogEventTracker(
"COMMENT_DELETED",
{
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
}
);
};
const handleAddComment = async (formData: IIssueComment) => {
@ -60,8 +89,20 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
await issueCommentService
.createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData)
.then(() => {
.then((res) => {
mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id));
postHogEventTracker(
"COMMENT_ADDED",
{
...res,
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch(() =>
setToastAlert({

View file

@ -62,6 +62,7 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
inboxIssueDetails: inboxIssueDetailsStore,
trackEvent: { postHogEventTracker },
appConfig: { envConfig },
workspace: { currentWorkspace }
} = useMobxStore();
const {
@ -91,16 +92,30 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
router.push(`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${res.issue_inbox[0].id}`);
handleClose();
} else reset(defaultValues);
postHogEventTracker("ISSUE_CREATE", {
...res,
state: "SUCCESS",
});
postHogEventTracker("ISSUE_CREATED",
{
...res,
state: "SUCCESS",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch((error) => {
console.log(error);
postHogEventTracker("ISSUE_CREATE", {
state: "FAILED",
});
postHogEventTracker("ISSUE_CREATED",
{
state: "FAILED",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
});
};
@ -214,9 +229,8 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
{issueName && issueName !== "" && (
<button
type="button"
className={`flex items-center gap-1 rounded px-1.5 py-1 text-xs hover:bg-custom-background-90 ${
iAmFeelingLucky ? "cursor-wait" : ""
}`}
className={`flex items-center gap-1 rounded px-1.5 py-1 text-xs hover:bg-custom-background-90 ${iAmFeelingLucky ? "cursor-wait" : ""
}`}
onClick={handleAutoGenerateDescription}
disabled={iAmFeelingLucky}
>
@ -296,7 +310,7 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
onClick={() => setCreateMore((prevData) => !prevData)}
>
<span className="text-xs">Create more</span>
<ToggleSwitch value={createMore} onChange={() => {}} size="md" />
<ToggleSwitch value={createMore} onChange={() => { }} size="md" />
</div>
<div className="flex items-center gap-2">
<Button variant="neutral-primary" size="sm" onClick={() => handleClose()}>

View file

@ -26,7 +26,7 @@ export const DeleteInboxIssueModal: React.FC<Props> = observer(({ isOpen, onClos
const router = useRouter();
const { workspaceSlug, projectId, inboxId } = router.query;
const { inboxIssueDetails: inboxIssueDetailsStore } = useMobxStore();
const { inboxIssueDetails: inboxIssueDetailsStore, trackEvent: { postHogEventTracker }, workspace: { currentWorkspace } } = useMobxStore();
const { setToastAlert } = useToast();
@ -48,7 +48,17 @@ export const DeleteInboxIssueModal: React.FC<Props> = observer(({ isOpen, onClos
title: "Success!",
message: "Issue deleted successfully.",
});
postHogEventTracker(
"ISSUE_DELETED",
{
state: "SUCCESS",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
)
// remove inboxIssueId from the url
router.push({
pathname: `/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}`,
@ -56,12 +66,24 @@ export const DeleteInboxIssueModal: React.FC<Props> = observer(({ isOpen, onClos
handleClose();
})
.catch(() =>
.catch(() => {
setToastAlert({
type: "error",
title: "Error!",
message: "Issue could not be deleted. Please try again.",
})
postHogEventTracker(
"ISSUE_DELETED",
{
state: "FAILED",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
}
)
.finally(() => setIsDeleting(false));
};

View file

@ -24,7 +24,7 @@ export const IssueBlocksList: FC<Props> = (props) => {
{issueIds && issueIds.length > 0 ? (
issueIds.map((issueId: string) => (
<IssueBlock
key={issues[issueId].id}
key={issues[issueId]?.id}
columnId={columnId}
issue={issues[issueId]}
handleIssues={handleIssues}

View file

@ -54,6 +54,8 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
user: userStore,
project: projectStore,
projectState: { states },
trackEvent: { postHogEventTracker },
workspace: { currentWorkspace }
} = useMobxStore();
const user = userStore.currentUser ?? undefined;
const userRole = userStore.currentProjectRole;
@ -82,7 +84,22 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
await issueCommentService
.patchIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, data)
.then(() => mutateIssueActivity());
.then((res) => {
mutateIssueActivity();
postHogEventTracker(
"COMMENT_UPDATED",
{
...res,
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
}
);
};
const handleCommentDelete = async (commentId: string) => {
@ -92,7 +109,21 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
await issueCommentService
.deleteIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId)
.then(() => mutateIssueActivity());
.then(() => {
mutateIssueActivity();
postHogEventTracker(
"COMMENT_DELETED",
{
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
}
);
};
const handleAddComment = async (formData: IIssueComment) => {
@ -100,8 +131,20 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
await issueCommentService
.createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData)
.then(() => {
.then((res) => {
mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id));
postHogEventTracker(
"COMMENT_ADDED",
{
...res,
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch(() =>
setToastAlert({

View file

@ -82,6 +82,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
moduleIssues: moduleIssueStore,
user: userStore,
trackEvent: { postHogEventTracker },
workspace: { currentWorkspace }
} = useMobxStore();
const user = userStore.currentUser;
@ -250,10 +251,16 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
title: "Success!",
message: "Issue created successfully.",
});
postHogEventTracker("ISSUE_CREATE", {
postHogEventTracker("ISSUE_CREATED", {
...res,
state: "SUCCESS",
});
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
if (payload.parent && payload.parent !== "") mutate(SUB_ISSUES(payload.parent));
}
})
@ -263,9 +270,15 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
title: "Error!",
message: "Issue could not be created. Please try again.",
});
postHogEventTracker("ISSUE_CREATE", {
postHogEventTracker("ISSUE_CREATED", {
state: "FAILED",
});
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
});
if (!createMore) onFormSubmitClose();
@ -317,10 +330,16 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
title: "Success!",
message: "Issue updated successfully.",
});
postHogEventTracker("ISSUE_UPDATE", {
postHogEventTracker("ISSUE_UPDATED", {
...res,
state: "SUCCESS",
});
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch(() => {
setToastAlert({
@ -328,9 +347,15 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
title: "Error!",
message: "Issue could not be updated. Please try again.",
});
postHogEventTracker("ISSUE_UPDATE", {
postHogEventTracker("ISSUE_UPDATED", {
state: "FAILED",
});
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
});
};

View file

@ -26,7 +26,7 @@ export const DeleteModuleModal: React.FC<Props> = observer((props) => {
const router = useRouter();
const { workspaceSlug, projectId, moduleId, peekModule } = router.query;
const { module: moduleStore } = useMobxStore();
const { module: moduleStore, trackEvent: { postHogEventTracker } } = useMobxStore();
const { setToastAlert } = useToast();
@ -50,6 +50,12 @@ export const DeleteModuleModal: React.FC<Props> = observer((props) => {
title: "Success!",
message: "Module deleted successfully.",
});
postHogEventTracker(
"MODULE_DELETED",
{
state: 'SUCCESS'
}
);
})
.catch(() => {
setToastAlert({
@ -57,6 +63,12 @@ export const DeleteModuleModal: React.FC<Props> = observer((props) => {
title: "Error!",
message: "Module could not be deleted. Please try again.",
});
postHogEventTracker(
"MODULE_DELETED",
{
state: 'FAILED'
}
);
})
.finally(() => {
setIsDeleteLoading(false);

View file

@ -32,7 +32,7 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
const [activeProject, setActiveProject] = useState<string | null>(null);
const { project: projectStore, module: moduleStore } = useMobxStore();
const { project: projectStore, module: moduleStore, trackEvent: { postHogEventTracker } } = useMobxStore();
const projects = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : undefined;
@ -52,7 +52,7 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
const selectedProjectId = payload.project ?? projectId.toString();
await moduleStore
.createModule(workspaceSlug.toString(), selectedProjectId, payload)
.then(() => {
.then((res) => {
handleClose();
setToastAlert({
@ -60,6 +60,13 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
title: "Success!",
message: "Module created successfully.",
});
postHogEventTracker(
"MODULE_CREATED",
{
...res,
state: "SUCCESS"
}
);
})
.catch(() => {
setToastAlert({
@ -67,6 +74,12 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
title: "Error!",
message: "Module could not be created. Please try again.",
});
postHogEventTracker(
"MODULE_CREATED",
{
state: "FAILED"
}
);
});
};
@ -75,7 +88,7 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
const selectedProjectId = payload.project ?? projectId.toString();
await moduleStore
.updateModuleDetails(workspaceSlug.toString(), selectedProjectId, data.id, payload)
.then(() => {
.then((res) => {
handleClose();
setToastAlert({
@ -83,6 +96,13 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
title: "Success!",
message: "Module updated successfully.",
});
postHogEventTracker(
"MODULE_UPDATED",
{
...res,
state: "SUCCESS"
}
);
})
.catch(() => {
setToastAlert({
@ -90,6 +110,12 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
title: "Error!",
message: "Module could not be updated. Please try again.",
});
postHogEventTracker(
"MODULE_UPDATED",
{
state: "FAILED"
}
);
});
};

View file

@ -62,7 +62,7 @@ export const Invitations: React.FC<Props> = (props) => {
await workspaceService
.joinWorkspaces({ invitations: invitationsRespond })
.then(async (res) => {
postHogEventTracker("WORKSPACE_USER_INVITE_ACCEPT", { ...res, state: "SUCCESS" });
postHogEventTracker("MEMBER_ACCEPTED", { ...res, state: "SUCCESS", accepted_from: "App" });
await workspaceStore.fetchWorkspaces();
await mutate(USER_WORKSPACES);
await updateLastWorkspace();
@ -71,7 +71,7 @@ export const Invitations: React.FC<Props> = (props) => {
})
.catch((error) => {
console.log(error);
postHogEventTracker("WORKSPACE_USER_INVITE_ACCEPT", { state: "FAILED" });
postHogEventTracker("MEMBER_ACCEPTED", { state: "FAILED", accepted_from: "App" });
})
.finally(() => setIsJoiningWorkspaces(false));
};
@ -88,11 +88,10 @@ export const Invitations: React.FC<Props> = (props) => {
return (
<div
key={invitation.id}
className={`flex cursor-pointer items-center gap-2 border p-3.5 rounded ${
isSelected
className={`flex cursor-pointer items-center gap-2 border p-3.5 rounded ${isSelected
? "border-custom-primary-100"
: "border-onboarding-border-200 hover:bg-onboarding-background-300/30"
}`}
}`}
onClick={() => handleInvitation(invitation, isSelected ? "withdraw" : "accepted")}
>
<div className="flex-shrink-0">

View file

@ -22,7 +22,7 @@ export const WorkspaceDashboardView = observer(() => {
user: userStore,
project: projectStore,
commandPalette: commandPaletteStore,
trackEvent: { setTrackElement },
trackEvent: { setTrackElement, postHogEventTracker },
} = useMobxStore();
const user = userStore.currentUser;
@ -37,7 +37,18 @@ export const WorkspaceDashboardView = observer(() => {
);
const handleTourCompleted = () => {
userStore.updateTourCompleted();
userStore.updateTourCompleted().then(() => {
postHogEventTracker(
"USER_TOUR_COMPLETE",
{
user_id: user?.id,
email: user?.email,
state: "SUCCESS"
}
)
}).catch((error) => {
console.log(error);
})
};
return (

View file

@ -9,8 +9,6 @@ import { PageForm } from "./page-form";
import { IPage } from "types";
// store
import { useMobxStore } from "lib/mobx/store-provider";
// helpers
import { trackEvent } from "helpers/event-tracker.helper";
type Props = {
data?: IPage | null;
@ -27,6 +25,8 @@ export const CreateUpdatePageModal: FC<Props> = (props) => {
// store
const {
page: { createPage, updatePage },
trackEvent: { postHogEventTracker },
workspace: { currentWorkspace }
} = useMobxStore();
const { setToastAlert } = useToast();
@ -47,10 +47,18 @@ export const CreateUpdatePageModal: FC<Props> = (props) => {
title: "Success!",
message: "Page created successfully.",
});
trackEvent("PAGE_CREATE", {
...res,
case: "SUCCESS",
});
postHogEventTracker(
"PAGE_CREATED",
{
...res,
state: "SUCCESS",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch(() => {
setToastAlert({
@ -58,9 +66,16 @@ export const CreateUpdatePageModal: FC<Props> = (props) => {
title: "Error!",
message: "Page could not be created. Please try again.",
});
trackEvent("PAGE_CREATE", {
case: "FAILED",
});
postHogEventTracker("PAGE_CREATED",
{
state: "FAILED",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
});
};
@ -75,10 +90,17 @@ export const CreateUpdatePageModal: FC<Props> = (props) => {
title: "Success!",
message: "Page updated successfully.",
});
trackEvent("PAGE_UPDATE", {
...res,
case: "SUCCESS",
});
postHogEventTracker("PAGE_UPDATED",
{
...res,
state: "SUCCESS",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch(() => {
setToastAlert({
@ -86,9 +108,16 @@ export const CreateUpdatePageModal: FC<Props> = (props) => {
title: "Error!",
message: "Page could not be updated. Please try again.",
});
trackEvent("PAGE_UPDATE", {
case: "FAILED",
});
postHogEventTracker("PAGE_UPDATED",
{
state: "FAILED",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
});
};

View file

@ -66,7 +66,8 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
const {
project: projectStore,
workspaceMember: { workspaceMembers },
trackEvent: { postHogEventTracker }
trackEvent: { postHogEventTracker },
workspace: { currentWorkspace },
} = useMobxStore();
// states
const [isChangeInIdentifierRequired, setIsChangeInIdentifierRequired] = useState(true);
@ -135,8 +136,13 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
state: "SUCCESS"
}
postHogEventTracker(
"PROJECT_CREATE",
"PROJECT_CREATED",
newPayload,
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: res.workspace
}
)
setToastAlert({
type: "success",
@ -156,10 +162,15 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
message: err.data[key],
});
postHogEventTracker(
"PROJECT_CREATE",
"PROJECT_CREATED",
{
state: "FAILED"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
)
}
);

View file

@ -12,7 +12,6 @@ import { Button, Input } from "@plane/ui";
import type { IProject } from "types";
// fetch-keys
import { useMobxStore } from "lib/mobx/store-provider";
import { trackEvent } from "helpers/event-tracker.helper";
type DeleteProjectModal = {
isOpen: boolean;
@ -28,7 +27,7 @@ const defaultValues = {
export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
const { isOpen, project, onClose } = props;
// store
const { project: projectStore } = useMobxStore();
const { project: projectStore, workspace: { currentWorkspace }, trackEvent: { postHogEventTracker } } = useMobxStore();
// router
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
@ -63,9 +62,17 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
if (projectId && projectId.toString() === project.id) router.push(`/${workspaceSlug}/projects`);
handleClose();
trackEvent(
'DELETE_PROJECT'
)
postHogEventTracker(
'PROJECT_DELETED',
{
state: "SUCCESS"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
setToastAlert({
type: "success",
title: "Success!",
@ -73,9 +80,17 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
});
})
.catch(() => {
trackEvent(
'DELETE_PROJECT/FAIL'
)
postHogEventTracker(
'PROJECT_DELETED',
{
state: "FAILED"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
setToastAlert({
type: "error",
title: "Error!",

View file

@ -28,7 +28,7 @@ const projectService = new ProjectService();
export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
const { project, workspaceSlug, isAdmin } = props;
// store
const { project: projectStore, trackEvent: { postHogEventTracker } } = useMobxStore();
const { project: projectStore, trackEvent: { postHogEventTracker }, workspace: { currentWorkspace } } = useMobxStore();
// toast
const { setToastAlert } = useToast();
// form data
@ -63,8 +63,13 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
.updateProject(workspaceSlug.toString(), project.id, payload)
.then((res) => {
postHogEventTracker(
'PROJECT_UPDATE',
{...res, state: "SUCCESS"}
'PROJECT_UPDATED',
{ ...res, state: "SUCCESS" },
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: res.workspace
}
);
setToastAlert({
type: "success",
@ -74,9 +79,14 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
})
.catch((error) => {
postHogEventTracker(
'PROJECT_UPDATE',
'PROJECT_UPDATED',
{
state: "FAILED"
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
setToastAlert({

View file

@ -57,6 +57,7 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
user: { currentProjectRole },
workspaceMember: { workspaceMembers },
trackEvent: { postHogEventTracker },
workspace: { currentWorkspace }
} = useMobxStore();
const {
@ -92,16 +93,30 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
type: "success",
message: "Member added successfully",
});
postHogEventTracker("PROJECT_MEMBER_INVITE", {
...res,
state: "SUCCESS",
});
postHogEventTracker("MEMBER_ADDED",
{
...res,
state: "SUCCESS",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.catch((error) => {
console.log(error);
postHogEventTracker("PROJECT_MEMBER_INVITE", {
state: "FAILED",
});
postHogEventTracker("MEMBER_ADDED",
{
state: "FAILED",
},
{
isGrouping: true,
groupType: "Workspace_metrics",
gorupId: currentWorkspace?.id!
}
);
})
.finally(() => {
reset(defaultValues);

View file

@ -72,7 +72,7 @@ export const CreateWorkspaceForm: FC<Props> = observer((props) => {
.createWorkspace(formData)
.then(async (res) => {
postHogEventTracker(
"WORKSPACE_CREATE",
"WORKSPACE_CREATED",
{
...res,
state: "SUCCESS"
@ -94,7 +94,7 @@ export const CreateWorkspaceForm: FC<Props> = observer((props) => {
message: "Workspace could not be created. Please try again.",
})
postHogEventTracker(
"WORKSPACE_CREATE",
"WORKSPACE_CREATED",
{
state: "FAILED"
},
@ -110,7 +110,7 @@ export const CreateWorkspaceForm: FC<Props> = observer((props) => {
message: "Some error occurred while creating workspace. Please try again.",
});
postHogEventTracker(
"WORKSPACE_CREATE",
"WORKSPACE_CREATED",
{
state: "FAILED"
},

View file

@ -63,7 +63,7 @@ export const DeleteWorkspaceModal: React.FC<Props> = observer((props) => {
.then((res) => {
handleClose();
router.push("/");
postHogEventTracker("WORKSPACE_DELETE", {
postHogEventTracker("WORKSPACE_DELETED", {
res,
state: "SUCCESS",
});
@ -79,7 +79,7 @@ export const DeleteWorkspaceModal: React.FC<Props> = observer((props) => {
title: "Error!",
message: "Something went wrong. Please try again later.",
});
postHogEventTracker("WORKSPACE_DELETE", {
postHogEventTracker("WORKSPACE_DELETED", {
state: "FAILED",
});
});

View file

@ -67,7 +67,7 @@ export const WorkspaceDetails: FC = observer(() => {
await updateWorkspace(currentWorkspace.slug, payload)
.then((res) => {
postHogEventTracker("WORKSPACE_UPDATE", {
postHogEventTracker("WORKSPACE_UPDATED", {
...res,
state: "SUCCESS",
});
@ -78,7 +78,7 @@ export const WorkspaceDetails: FC = observer(() => {
});
})
.catch((err) => {
postHogEventTracker("WORKSPACE_UPDATE", {
postHogEventTracker("WORKSPACE_UPDATED", {
state: "FAILED",
});
console.error(err);