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
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue