refactor: renamed issueEvent prop path name

This commit is contained in:
LAKHAN BAHETI 2024-05-27 12:00:33 +05:30
parent 7a47ce9d1d
commit 379a4de533
18 changed files with 100 additions and 88 deletions

View File

@ -87,7 +87,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: Object.values(data).join(","), change_details: Object.values(data).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -102,7 +102,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: Object.values(data).join(","), change_details: Object.values(data).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },

View File

@ -98,7 +98,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: Object.values(data).join(","), change_details: Object.values(data).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -108,7 +108,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: Object.values(data).join(","), change_details: Object.values(data).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
title: "Error!", title: "Error!",
@ -129,7 +129,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" }, payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -140,7 +140,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: issueId, state: "FAILED", element: "Issue detail page" }, payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -150,13 +150,13 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_ARCHIVED, eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "SUCCESS", element: "Issue details page" }, payload: { id: issueId, state: "SUCCESS", element: "Issue details page" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_ARCHIVED, eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "FAILED", element: "Issue details page" }, payload: { id: issueId, state: "FAILED", element: "Issue details page" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -170,7 +170,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -185,7 +185,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -199,7 +199,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -214,7 +214,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -240,7 +240,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -250,7 +250,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -264,7 +264,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: moduleIds, change_details: moduleIds,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -279,7 +279,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: moduleIds, change_details: moduleIds,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -305,7 +305,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -315,7 +315,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },

View File

@ -156,14 +156,14 @@ export const CalendarQuickAddIssueForm: React.FC<Props> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...res, state: "SUCCESS", element: "Calendar quick add" }, payload: { ...res, state: "SUCCESS", element: "Calendar quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch(() => { .catch(() => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED", element: "Calendar quick add" }, payload: { ...payload, state: "FAILED", element: "Calendar quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
} }

View File

@ -129,14 +129,14 @@ export const GanttQuickAddIssueForm: React.FC<IGanttQuickAddIssueForm> = observe
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...res, state: "SUCCESS", element: "Gantt quick add" }, payload: { ...res, state: "SUCCESS", element: "Gantt quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch(() => { .catch(() => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED", element: "Gantt quick add" }, payload: { ...payload, state: "FAILED", element: "Gantt quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
} }

View File

@ -176,7 +176,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: draggedIssueId, state: "FAILED", element: "Kanban layout drag & drop" }, payload: { id: draggedIssueId, state: "FAILED", element: "Kanban layout drag & drop" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
}; };

View File

@ -123,14 +123,14 @@ export const KanBanQuickAddIssueForm: React.FC<IKanBanQuickAddIssueForm> = obser
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...res, state: "SUCCESS", element: "Kanban quick add" }, payload: { ...res, state: "SUCCESS", element: "Kanban quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch(() => { .catch(() => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED", element: "Kanban quick add" }, payload: { ...payload, state: "FAILED", element: "Kanban quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
} }

View File

@ -120,14 +120,14 @@ export const ListQuickAddIssueForm: FC<IListQuickAddIssueForm> = observer((props
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...res, state: "SUCCESS", element: "List quick add" }, payload: { ...res, state: "SUCCESS", element: "List quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch(() => { .catch(() => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED", element: "List quick add" }, payload: { ...payload, state: "FAILED", element: "List quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
} }

View File

@ -93,7 +93,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "state", changed_property: "state",
change_details: stateId, change_details: stateId,
@ -108,7 +108,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "priority", changed_property: "priority",
change_details: value, change_details: value,
@ -123,7 +123,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "labels", changed_property: "labels",
change_details: ids, change_details: ids,
@ -138,7 +138,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "assignees", changed_property: "assignees",
change_details: ids, change_details: ids,
@ -163,7 +163,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } }, updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } },
}); });
}, },
@ -179,7 +179,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } }, updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } },
}); });
}, },
@ -193,7 +193,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "start_date", changed_property: "start_date",
change_details: date ? renderFormattedPayloadDate(date) : null, change_details: date ? renderFormattedPayloadDate(date) : null,
@ -210,7 +210,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "target_date", changed_property: "target_date",
change_details: date ? renderFormattedPayloadDate(date) : null, change_details: date ? renderFormattedPayloadDate(date) : null,
@ -226,7 +226,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...issue, state: "SUCCESS", element: currentLayout }, payload: { ...issue, state: "SUCCESS", element: currentLayout },
path: router.asPath, routePath: router.asPath,
updates: { updates: {
changed_property: "estimate_point", changed_property: "estimate_point",
change_details: value, change_details: value,

View File

@ -13,7 +13,7 @@ import {
import { ListLayoutLoader } from "@/components/ui"; import { ListLayoutLoader } from "@/components/ui";
import { EIssuesStoreType } from "@/constants/issue"; import { EIssuesStoreType } from "@/constants/issue";
// ui // ui
import { useIssues } from "@/hooks/store"; import { useIssues, useEventTracker } from "@/hooks/store";
export const ArchivedIssueLayoutRoot: React.FC = observer(() => { export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
// router // router
@ -21,12 +21,14 @@ export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;
// hooks // hooks
const { issues, issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED); const { issues, issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED);
const { captureIssuesListOpenedEvent } = useEventTracker();
useSWR( useSWR(
workspaceSlug && projectId ? `ARCHIVED_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null, workspaceSlug && projectId ? `ARCHIVED_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null,
async () => { async () => {
if (workspaceSlug && projectId) { if (workspaceSlug && projectId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString());
captureIssuesListOpenedEvent(router.asPath, issuesFilter?.issueFilters?.filters);
await issues?.fetchIssues( await issues?.fetchIssues(
workspaceSlug.toString(), workspaceSlug.toString(),
projectId.toString(), projectId.toString(),

View File

@ -41,7 +41,7 @@ export const SpreadsheetCycleColumn: React.FC<Props> = observer((props) => {
element: "Spreadsheet layout", element: "Spreadsheet layout",
}, },
updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } }, updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } },
path: router.asPath, routePath: router.asPath,
}); });
}, },
[workspaceSlug, issue, addCycleToIssue, removeCycleFromIssue, captureIssueEvent, router.asPath] [workspaceSlug, issue, addCycleToIssue, removeCycleFromIssue, captureIssueEvent, router.asPath]

View File

@ -50,7 +50,7 @@ export const SpreadsheetModuleColumn: React.FC<Props> = observer((props) => {
element: "Spreadsheet layout", element: "Spreadsheet layout",
}, },
updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } }, updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } },
path: router.asPath, routePath: router.asPath,
}); });
}, },
[workspaceSlug, issue, changeModulesInIssue, captureIssueEvent, router.asPath] [workspaceSlug, issue, changeModulesInIssue, captureIssueEvent, router.asPath]

View File

@ -53,7 +53,7 @@ export const IssueColumn = observer((props: Props) => {
element: "Spreadsheet layout", element: "Spreadsheet layout",
}, },
updates: updates, updates: updates,
path: router.asPath, routePath: router.asPath,
}); });
}) })
} }

View File

@ -183,14 +183,14 @@ export const SpreadsheetQuickAddIssueForm: React.FC<Props> = observer((props) =>
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...res, state: "SUCCESS", element: "Spreadsheet quick add" }, payload: { ...res, state: "SUCCESS", element: "Spreadsheet quick add" },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch((err) => { .catch((err) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED", element: "Spreadsheet quick add" }, payload: { ...payload, state: "FAILED", element: "Spreadsheet quick add" },
path: router.asPath, routePath: router.asPath,
}); });
console.error(err); console.error(err);
}); });

View File

@ -98,7 +98,7 @@ export const DraftIssueLayout: React.FC<DraftIssueProps> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: "Draft issue created", eventName: "Draft issue created",
payload: { ...res, state: "SUCCESS" }, payload: { ...res, state: "SUCCESS" },
path: router.asPath, routePath: router.asPath,
}); });
onChange(null); onChange(null);
setIssueDiscardModal(false); setIssueDiscardModal(false);
@ -113,7 +113,7 @@ export const DraftIssueLayout: React.FC<DraftIssueProps> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: "Draft issue created", eventName: "Draft issue created",
payload: { ...payload, state: "FAILED" }, payload: { ...payload, state: "FAILED" },
path: router.asPath, routePath: router.asPath,
}); });
}); });
}; };

View File

@ -167,7 +167,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...response, state: "SUCCESS" }, payload: { ...response, state: "SUCCESS" },
path: router.asPath, routePath: router.asPath,
}); });
!createMore && handleClose(); !createMore && handleClose();
if (createMore) issueTitleRef && issueTitleRef?.current?.focus(); if (createMore) issueTitleRef && issueTitleRef?.current?.focus();
@ -183,7 +183,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_CREATED, eventName: ISSUE_CREATED,
payload: { ...payload, state: "FAILED" }, payload: { ...payload, state: "FAILED" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}; };
@ -204,7 +204,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...payload, issueId: data.id, state: "SUCCESS" }, payload: { ...payload, issueId: data.id, state: "SUCCESS" },
path: router.asPath, routePath: router.asPath,
}); });
handleClose(); handleClose();
} catch (error) { } catch (error) {
@ -216,7 +216,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { ...payload, state: "FAILED" }, payload: { ...payload, state: "FAILED" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}; };

View File

@ -95,14 +95,14 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: Object.values(data).join(","), change_details: Object.values(data).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
}) })
.catch(() => { .catch(() => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_UPDATED, eventName: ISSUE_UPDATED,
payload: { state: "FAILED", element: "Issue peek-overview" }, payload: { state: "FAILED", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
title: "Error!", title: "Error!",
@ -122,7 +122,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -133,7 +133,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -143,13 +143,13 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_ARCHIVED, eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_ARCHIVED, eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -164,7 +164,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_RESTORED, eventName: ISSUE_RESTORED,
payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -175,7 +175,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_RESTORED, eventName: ISSUE_RESTORED,
payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -190,7 +190,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -205,7 +205,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -219,7 +219,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -234,7 +234,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: cycleId, change_details: cycleId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -260,7 +260,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -270,7 +270,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "cycle_id", changed_property: "cycle_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -284,7 +284,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: moduleIds, change_details: moduleIds,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -299,7 +299,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: moduleIds, change_details: moduleIds,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -325,7 +325,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -335,7 +335,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
changed_property: "module_id", changed_property: "module_id",
change_details: "", change_details: "",
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },

View File

@ -185,7 +185,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
changed_property: Object.keys(issueData).join(","), changed_property: Object.keys(issueData).join(","),
change_details: Object.values(issueData).join(","), change_details: Object.values(issueData).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.SUCCESS, type: TOAST_TYPE.SUCCESS,
@ -201,7 +201,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
changed_property: Object.keys(issueData).join(","), changed_property: Object.keys(issueData).join(","),
change_details: Object.values(issueData).join(","), change_details: Object.values(issueData).join(","),
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
@ -226,7 +226,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
changed_property: "parent_id", changed_property: "parent_id",
change_details: parentIssueId, change_details: parentIssueId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
setSubIssueHelpers(parentIssueId, "issue_loader", issueId); setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
} catch (error) { } catch (error) {
@ -237,7 +237,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
changed_property: "parent_id", changed_property: "parent_id",
change_details: parentIssueId, change_details: parentIssueId,
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
@ -253,14 +253,14 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
captureIssueEvent({ captureIssueEvent({
eventName: "Sub-issue deleted", eventName: "Sub-issue deleted",
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" }, payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
path: router.asPath, routePath: router.asPath,
}); });
setSubIssueHelpers(parentIssueId, "issue_loader", issueId); setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
eventName: "Sub-issue removed", eventName: "Sub-issue removed",
payload: { id: issueId, state: "FAILED", element: "Issue detail page" }, payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,

View File

@ -2,7 +2,7 @@ export type IssueEventProps = {
eventName: string; eventName: string;
payload: any; payload: any;
updates?: any; updates?: any;
path?: string; routePath?: string;
}; };
export type EventProps = { export type EventProps = {
@ -77,7 +77,7 @@ export const getPageEventPayload = (payload: any) => ({
}); });
export const getIssueEventPayload = (props: IssueEventProps) => { export const getIssueEventPayload = (props: IssueEventProps) => {
const { eventName, payload, updates, path } = props; const { eventName, payload, updates, routePath } = props;
let eventPayload: any = { let eventPayload: any = {
issue_id: payload.id, issue_id: payload.id,
estimate_point: payload.estimate_point, estimate_point: payload.estimate_point,
@ -102,26 +102,14 @@ export const getIssueEventPayload = (props: IssueEventProps) => {
module_id: payload.module_id, module_id: payload.module_id,
archived_at: payload.archived_at, archived_at: payload.archived_at,
state: payload.state, state: payload.state,
view_id: path?.includes("workspace-views") || path?.includes("views") ? path.split("/").pop() : "", view_id: routePath?.includes("workspace-views") || routePath?.includes("views") ? routePath.split("/").pop() : "",
}; };
if (eventName === ISSUE_UPDATED) { if (eventName === ISSUE_UPDATED) {
eventPayload = { eventPayload = {
...eventPayload, ...eventPayload,
...updates, ...updates,
updated_from: props.path?.includes("workspace-views") updated_from: elementFromPath(routePath),
? "All views"
: props.path?.includes("cycles")
? "Cycle"
: props.path?.includes("modules")
? "Module"
: props.path?.includes("views")
? "Project view"
: props.path?.includes("inbox")
? "Inbox"
: props.path?.includes("draft")
? "Draft"
: "Project",
}; };
} }
return eventPayload; return eventPayload;
@ -140,6 +128,26 @@ export const getProjectStateEventPayload = (payload: any) => ({
element: payload.element, element: payload.element,
}); });
export const getIssuesListOpenedPayload = (payload: any) => ({
element: elementFromPath(payload.routePath),
type: payload.project_id ? "Project" : "Workspace",
layout: payload?.displayFilters?.layout,
filters: payload?.filters,
display_properties: payload?.displayProperties,
});
// Returns the element based on the path
const elementFromPath = (routePath?: string) => {
if (routePath?.includes("workspace-views")) return "Workspace view";
if (routePath?.includes("cycles")) return "Cycle";
if (routePath?.includes("modules")) return "Module";
if (routePath?.includes("views")) return "Project view";
if (routePath?.includes("inbox")) return "Inbox";
if (routePath?.includes("draft")) return "Draft";
if (routePath?.includes("archived")) return "Archive";
return "";
};
// Workspace crud Events // Workspace crud Events
export const WORKSPACE_CREATED = "Workspace created"; export const WORKSPACE_CREATED = "Workspace created";
export const WORKSPACE_UPDATED = "Workspace updated"; export const WORKSPACE_UPDATED = "Workspace updated";
@ -169,6 +177,8 @@ export const ISSUE_UPDATED = "Issue updated";
export const ISSUE_DELETED = "Issue deleted"; export const ISSUE_DELETED = "Issue deleted";
export const ISSUE_ARCHIVED = "Issue archived"; export const ISSUE_ARCHIVED = "Issue archived";
export const ISSUE_RESTORED = "Issue restored"; export const ISSUE_RESTORED = "Issue restored";
// Issue Checkout Events
export const ISSUES_LIST_OPENED = "Issues list opened";
export const ISSUE_OPENED = "Issue opened"; export const ISSUE_OPENED = "Issue opened";
// Project State Events // Project State Events
export const STATE_CREATED = "State created"; export const STATE_CREATED = "State created";