From 379a4de53315eb80e79f0ee68358b372f7939468 Mon Sep 17 00:00:00 2001 From: LAKHAN BAHETI Date: Mon, 27 May 2024 12:00:33 +0530 Subject: [PATCH] refactor: renamed issueEvent prop path name --- web/components/inbox/content/issue-root.tsx | 4 +- web/components/issues/issue-detail/root.tsx | 32 +++++++------- .../calendar/quick-add-issue-form.tsx | 4 +- .../gantt/quick-add-issue-form.tsx | 4 +- .../issue-layouts/kanban/base-kanban-root.tsx | 2 +- .../kanban/quick-add-issue-form.tsx | 4 +- .../list/quick-add-issue-form.tsx | 4 +- .../properties/all-properties.tsx | 18 ++++---- .../roots/archived-issue-layout-root.tsx | 4 +- .../spreadsheet/columns/cycle-column.tsx | 2 +- .../spreadsheet/columns/module-column.tsx | 2 +- .../spreadsheet/issue-column.tsx | 2 +- .../spreadsheet/quick-add-issue-form.tsx | 4 +- .../issues/issue-modal/draft-issue-layout.tsx | 4 +- web/components/issues/issue-modal/modal.tsx | 8 ++-- web/components/issues/peek-overview/root.tsx | 36 ++++++++-------- web/components/issues/sub-issues/root.tsx | 12 +++--- web/constants/event-tracker.ts | 42 ++++++++++++------- 18 files changed, 100 insertions(+), 88 deletions(-) diff --git a/web/components/inbox/content/issue-root.tsx b/web/components/inbox/content/issue-root.tsx index 3d078bb2f..412a0b2de 100644 --- a/web/components/inbox/content/issue-root.tsx +++ b/web/components/inbox/content/issue-root.tsx @@ -87,7 +87,7 @@ export const InboxIssueMainContent: React.FC = observer((props) => { changed_property: Object.keys(data).join(","), change_details: Object.values(data).join(","), }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -102,7 +102,7 @@ export const InboxIssueMainContent: React.FC = observer((props) => { changed_property: Object.keys(data).join(","), change_details: Object.values(data).join(","), }, - path: router.asPath, + routePath: router.asPath, }); } }, diff --git a/web/components/issues/issue-detail/root.tsx b/web/components/issues/issue-detail/root.tsx index 6fff55aa8..d8194cb18 100644 --- a/web/components/issues/issue-detail/root.tsx +++ b/web/components/issues/issue-detail/root.tsx @@ -98,7 +98,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: Object.keys(data).join(","), change_details: Object.values(data).join(","), }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ @@ -108,7 +108,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: Object.keys(data).join(","), change_details: Object.values(data).join(","), }, - path: router.asPath, + routePath: router.asPath, }); setToast({ title: "Error!", @@ -129,7 +129,7 @@ export const IssueDetailRoot: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_DELETED, payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -140,7 +140,7 @@ export const IssueDetailRoot: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_DELETED, payload: { id: issueId, state: "FAILED", element: "Issue detail page" }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -150,13 +150,13 @@ export const IssueDetailRoot: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "SUCCESS", element: "Issue details page" }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "FAILED", element: "Issue details page" }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -170,7 +170,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -185,7 +185,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -199,7 +199,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -214,7 +214,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -240,7 +240,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ @@ -250,7 +250,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "cycle_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -264,7 +264,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "module_id", change_details: moduleIds, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -279,7 +279,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "module_id", change_details: moduleIds, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -305,7 +305,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "module_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ @@ -315,7 +315,7 @@ export const IssueDetailRoot: FC = observer((props) => { changed_property: "module_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } }, diff --git a/web/components/issues/issue-layouts/calendar/quick-add-issue-form.tsx b/web/components/issues/issue-layouts/calendar/quick-add-issue-form.tsx index 2585467ab..ddc8d4de1 100644 --- a/web/components/issues/issue-layouts/calendar/quick-add-issue-form.tsx +++ b/web/components/issues/issue-layouts/calendar/quick-add-issue-form.tsx @@ -156,14 +156,14 @@ export const CalendarQuickAddIssueForm: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...res, state: "SUCCESS", element: "Calendar quick add" }, - path: router.asPath, + routePath: router.asPath, }); }) .catch(() => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED", element: "Calendar quick add" }, - path: router.asPath, + routePath: router.asPath, }); }); } diff --git a/web/components/issues/issue-layouts/gantt/quick-add-issue-form.tsx b/web/components/issues/issue-layouts/gantt/quick-add-issue-form.tsx index db3a38813..964eb47a0 100644 --- a/web/components/issues/issue-layouts/gantt/quick-add-issue-form.tsx +++ b/web/components/issues/issue-layouts/gantt/quick-add-issue-form.tsx @@ -129,14 +129,14 @@ export const GanttQuickAddIssueForm: React.FC = observe captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...res, state: "SUCCESS", element: "Gantt quick add" }, - path: router.asPath, + routePath: router.asPath, }); }) .catch(() => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED", element: "Gantt quick add" }, - path: router.asPath, + routePath: router.asPath, }); }); } diff --git a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx index b8060d7cf..56994f708 100644 --- a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx +++ b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx @@ -176,7 +176,7 @@ export const BaseKanBanRoot: React.FC = observer((props: IBas captureIssueEvent({ eventName: ISSUE_DELETED, payload: { id: draggedIssueId, state: "FAILED", element: "Kanban layout drag & drop" }, - path: router.asPath, + routePath: router.asPath, }); }); }; diff --git a/web/components/issues/issue-layouts/kanban/quick-add-issue-form.tsx b/web/components/issues/issue-layouts/kanban/quick-add-issue-form.tsx index df2c4a31f..e832323a7 100644 --- a/web/components/issues/issue-layouts/kanban/quick-add-issue-form.tsx +++ b/web/components/issues/issue-layouts/kanban/quick-add-issue-form.tsx @@ -123,14 +123,14 @@ export const KanBanQuickAddIssueForm: React.FC = obser captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...res, state: "SUCCESS", element: "Kanban quick add" }, - path: router.asPath, + routePath: router.asPath, }); }) .catch(() => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED", element: "Kanban quick add" }, - path: router.asPath, + routePath: router.asPath, }); }); } diff --git a/web/components/issues/issue-layouts/list/quick-add-issue-form.tsx b/web/components/issues/issue-layouts/list/quick-add-issue-form.tsx index 4f3ebf731..98092d1e6 100644 --- a/web/components/issues/issue-layouts/list/quick-add-issue-form.tsx +++ b/web/components/issues/issue-layouts/list/quick-add-issue-form.tsx @@ -120,14 +120,14 @@ export const ListQuickAddIssueForm: FC = observer((props captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...res, state: "SUCCESS", element: "List quick add" }, - path: router.asPath, + routePath: router.asPath, }); }) .catch(() => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED", element: "List quick add" }, - path: router.asPath, + routePath: router.asPath, }); }); } diff --git a/web/components/issues/issue-layouts/properties/all-properties.tsx b/web/components/issues/issue-layouts/properties/all-properties.tsx index 79f2fca70..cab3f917f 100644 --- a/web/components/issues/issue-layouts/properties/all-properties.tsx +++ b/web/components/issues/issue-layouts/properties/all-properties.tsx @@ -93,7 +93,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "state", change_details: stateId, @@ -108,7 +108,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "priority", change_details: value, @@ -123,7 +123,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "labels", change_details: ids, @@ -138,7 +138,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "assignees", change_details: ids, @@ -163,7 +163,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } }, }); }, @@ -179,7 +179,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } }, }); }, @@ -193,7 +193,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "start_date", change_details: date ? renderFormattedPayloadDate(date) : null, @@ -210,7 +210,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "target_date", change_details: date ? renderFormattedPayloadDate(date) : null, @@ -226,7 +226,7 @@ export const IssueProperties: React.FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...issue, state: "SUCCESS", element: currentLayout }, - path: router.asPath, + routePath: router.asPath, updates: { changed_property: "estimate_point", change_details: value, diff --git a/web/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx b/web/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx index 359de202f..98a4e060b 100644 --- a/web/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx @@ -13,7 +13,7 @@ import { import { ListLayoutLoader } from "@/components/ui"; import { EIssuesStoreType } from "@/constants/issue"; // ui -import { useIssues } from "@/hooks/store"; +import { useIssues, useEventTracker } from "@/hooks/store"; export const ArchivedIssueLayoutRoot: React.FC = observer(() => { // router @@ -21,12 +21,14 @@ export const ArchivedIssueLayoutRoot: React.FC = observer(() => { const { workspaceSlug, projectId } = router.query; // hooks const { issues, issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED); + const { captureIssuesListOpenedEvent } = useEventTracker(); useSWR( workspaceSlug && projectId ? `ARCHIVED_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null, async () => { if (workspaceSlug && projectId) { await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString()); + captureIssuesListOpenedEvent(router.asPath, issuesFilter?.issueFilters?.filters); await issues?.fetchIssues( workspaceSlug.toString(), projectId.toString(), diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/cycle-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/cycle-column.tsx index 8cb2f43fb..bd80c5c7d 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/cycle-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/cycle-column.tsx @@ -41,7 +41,7 @@ export const SpreadsheetCycleColumn: React.FC = observer((props) => { element: "Spreadsheet layout", }, updates: { changed_property: "cycle", change_details: { cycle_id: cycleId } }, - path: router.asPath, + routePath: router.asPath, }); }, [workspaceSlug, issue, addCycleToIssue, removeCycleFromIssue, captureIssueEvent, router.asPath] diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/module-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/module-column.tsx index efae44e84..83f19ec5a 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/module-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/module-column.tsx @@ -50,7 +50,7 @@ export const SpreadsheetModuleColumn: React.FC = observer((props) => { element: "Spreadsheet layout", }, updates: { changed_property: "module_ids", change_details: { module_ids: moduleIds } }, - path: router.asPath, + routePath: router.asPath, }); }, [workspaceSlug, issue, changeModulesInIssue, captureIssueEvent, router.asPath] diff --git a/web/components/issues/issue-layouts/spreadsheet/issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/issue-column.tsx index 161dd6514..fd1656160 100644 --- a/web/components/issues/issue-layouts/spreadsheet/issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/issue-column.tsx @@ -53,7 +53,7 @@ export const IssueColumn = observer((props: Props) => { element: "Spreadsheet layout", }, updates: updates, - path: router.asPath, + routePath: router.asPath, }); }) } diff --git a/web/components/issues/issue-layouts/spreadsheet/quick-add-issue-form.tsx b/web/components/issues/issue-layouts/spreadsheet/quick-add-issue-form.tsx index 692363494..4f053b2dd 100644 --- a/web/components/issues/issue-layouts/spreadsheet/quick-add-issue-form.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/quick-add-issue-form.tsx @@ -183,14 +183,14 @@ export const SpreadsheetQuickAddIssueForm: React.FC = observer((props) => captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...res, state: "SUCCESS", element: "Spreadsheet quick add" }, - path: router.asPath, + routePath: router.asPath, }); }) .catch((err) => { captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED", element: "Spreadsheet quick add" }, - path: router.asPath, + routePath: router.asPath, }); console.error(err); }); diff --git a/web/components/issues/issue-modal/draft-issue-layout.tsx b/web/components/issues/issue-modal/draft-issue-layout.tsx index df89d363e..b91c2fdbb 100644 --- a/web/components/issues/issue-modal/draft-issue-layout.tsx +++ b/web/components/issues/issue-modal/draft-issue-layout.tsx @@ -98,7 +98,7 @@ export const DraftIssueLayout: React.FC = observer((props) => { captureIssueEvent({ eventName: "Draft issue created", payload: { ...res, state: "SUCCESS" }, - path: router.asPath, + routePath: router.asPath, }); onChange(null); setIssueDiscardModal(false); @@ -113,7 +113,7 @@ export const DraftIssueLayout: React.FC = observer((props) => { captureIssueEvent({ eventName: "Draft issue created", payload: { ...payload, state: "FAILED" }, - path: router.asPath, + routePath: router.asPath, }); }); }; diff --git a/web/components/issues/issue-modal/modal.tsx b/web/components/issues/issue-modal/modal.tsx index 38b328df6..309486dfe 100644 --- a/web/components/issues/issue-modal/modal.tsx +++ b/web/components/issues/issue-modal/modal.tsx @@ -167,7 +167,7 @@ export const CreateUpdateIssueModal: React.FC = observer((prop captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...response, state: "SUCCESS" }, - path: router.asPath, + routePath: router.asPath, }); !createMore && handleClose(); if (createMore) issueTitleRef && issueTitleRef?.current?.focus(); @@ -183,7 +183,7 @@ export const CreateUpdateIssueModal: React.FC = observer((prop captureIssueEvent({ eventName: ISSUE_CREATED, payload: { ...payload, state: "FAILED" }, - path: router.asPath, + routePath: router.asPath, }); } }; @@ -204,7 +204,7 @@ export const CreateUpdateIssueModal: React.FC = observer((prop captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...payload, issueId: data.id, state: "SUCCESS" }, - path: router.asPath, + routePath: router.asPath, }); handleClose(); } catch (error) { @@ -216,7 +216,7 @@ export const CreateUpdateIssueModal: React.FC = observer((prop captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { ...payload, state: "FAILED" }, - path: router.asPath, + routePath: router.asPath, }); } }; diff --git a/web/components/issues/peek-overview/root.tsx b/web/components/issues/peek-overview/root.tsx index 5aa6d2e8a..8bf03b269 100644 --- a/web/components/issues/peek-overview/root.tsx +++ b/web/components/issues/peek-overview/root.tsx @@ -95,14 +95,14 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: Object.keys(data).join(","), change_details: Object.values(data).join(","), }, - path: router.asPath, + routePath: router.asPath, }); }) .catch(() => { captureIssueEvent({ eventName: ISSUE_UPDATED, payload: { state: "FAILED", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); setToast({ title: "Error!", @@ -122,7 +122,7 @@ export const IssuePeekOverview: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_DELETED, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -133,7 +133,7 @@ export const IssuePeekOverview: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_DELETED, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -143,13 +143,13 @@ export const IssuePeekOverview: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -164,7 +164,7 @@ export const IssuePeekOverview: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_RESTORED, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -175,7 +175,7 @@ export const IssuePeekOverview: FC = observer((props) => { captureIssueEvent({ eventName: ISSUE_RESTORED, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -190,7 +190,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -205,7 +205,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -219,7 +219,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -234,7 +234,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: cycleId, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -260,7 +260,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ @@ -270,7 +270,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "cycle_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -284,7 +284,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "module_id", change_details: moduleIds, }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { setToast({ @@ -299,7 +299,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "module_id", change_details: moduleIds, }, - path: router.asPath, + routePath: router.asPath, }); } }, @@ -325,7 +325,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "module_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } catch (error) { captureIssueEvent({ @@ -335,7 +335,7 @@ export const IssuePeekOverview: FC = observer((props) => { changed_property: "module_id", change_details: "", }, - path: router.asPath, + routePath: router.asPath, }); } }, diff --git a/web/components/issues/sub-issues/root.tsx b/web/components/issues/sub-issues/root.tsx index b697ff20a..a313527d6 100644 --- a/web/components/issues/sub-issues/root.tsx +++ b/web/components/issues/sub-issues/root.tsx @@ -185,7 +185,7 @@ export const SubIssuesRoot: FC = observer((props) => { changed_property: Object.keys(issueData).join(","), change_details: Object.values(issueData).join(","), }, - path: router.asPath, + routePath: router.asPath, }); setToast({ type: TOAST_TYPE.SUCCESS, @@ -201,7 +201,7 @@ export const SubIssuesRoot: FC = observer((props) => { changed_property: Object.keys(issueData).join(","), change_details: Object.values(issueData).join(","), }, - path: router.asPath, + routePath: router.asPath, }); setToast({ type: TOAST_TYPE.ERROR, @@ -226,7 +226,7 @@ export const SubIssuesRoot: FC = observer((props) => { changed_property: "parent_id", change_details: parentIssueId, }, - path: router.asPath, + routePath: router.asPath, }); setSubIssueHelpers(parentIssueId, "issue_loader", issueId); } catch (error) { @@ -237,7 +237,7 @@ export const SubIssuesRoot: FC = observer((props) => { changed_property: "parent_id", change_details: parentIssueId, }, - path: router.asPath, + routePath: router.asPath, }); setToast({ type: TOAST_TYPE.ERROR, @@ -253,14 +253,14 @@ export const SubIssuesRoot: FC = observer((props) => { captureIssueEvent({ eventName: "Sub-issue deleted", payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" }, - path: router.asPath, + routePath: router.asPath, }); setSubIssueHelpers(parentIssueId, "issue_loader", issueId); } catch (error) { captureIssueEvent({ eventName: "Sub-issue removed", payload: { id: issueId, state: "FAILED", element: "Issue detail page" }, - path: router.asPath, + routePath: router.asPath, }); setToast({ type: TOAST_TYPE.ERROR, diff --git a/web/constants/event-tracker.ts b/web/constants/event-tracker.ts index 7edfccba5..52bcbe694 100644 --- a/web/constants/event-tracker.ts +++ b/web/constants/event-tracker.ts @@ -2,7 +2,7 @@ export type IssueEventProps = { eventName: string; payload: any; updates?: any; - path?: string; + routePath?: string; }; export type EventProps = { @@ -77,7 +77,7 @@ export const getPageEventPayload = (payload: any) => ({ }); export const getIssueEventPayload = (props: IssueEventProps) => { - const { eventName, payload, updates, path } = props; + const { eventName, payload, updates, routePath } = props; let eventPayload: any = { issue_id: payload.id, estimate_point: payload.estimate_point, @@ -102,26 +102,14 @@ export const getIssueEventPayload = (props: IssueEventProps) => { module_id: payload.module_id, archived_at: payload.archived_at, 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) { eventPayload = { ...eventPayload, ...updates, - updated_from: props.path?.includes("workspace-views") - ? "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", + updated_from: elementFromPath(routePath), }; } return eventPayload; @@ -140,6 +128,26 @@ export const getProjectStateEventPayload = (payload: any) => ({ 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 export const WORKSPACE_CREATED = "Workspace created"; 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_ARCHIVED = "Issue archived"; export const ISSUE_RESTORED = "Issue restored"; +// Issue Checkout Events +export const ISSUES_LIST_OPENED = "Issues list opened"; export const ISSUE_OPENED = "Issue opened"; // Project State Events export const STATE_CREATED = "State created";