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:
parent
37c03ff239
commit
b35874e294
25 changed files with 441 additions and 120 deletions
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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()}>
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue