chore: refactoring

This commit is contained in:
LAKHAN BAHETI 2024-03-08 18:57:12 +05:30
parent b98e0fef2b
commit f90e3172e6
33 changed files with 190 additions and 182 deletions

View File

@ -139,7 +139,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED, eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
filter_property: value, filter_property: value,
filter_type: key, filter_type: key,
@ -160,7 +160,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
payload: { payload: {
property_type: Object.keys(updatedDisplayFilter).join(","), property_type: Object.keys(updatedDisplayFilter).join(","),
property: Object.values(updatedDisplayFilter)?.[0], property: Object.values(updatedDisplayFilter)?.[0],
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -177,7 +177,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED, eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED,
payload: { payload: {
display_property: Object.keys(property).join(","), display_property: Object.keys(property).join(","),
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -280,7 +280,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: FILTER_SEARCHED, eventName: FILTER_SEARCHED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
current_filters: issueFilters?.filters, current_filters: issueFilters?.filters,
layout: issueFilters?.displayFilters?.layout, layout: issueFilters?.displayFilters?.layout,
}, },

View File

@ -86,7 +86,7 @@ export const GlobalIssuesHeader: React.FC<Props> = observer((props) => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED, eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
filter_property: value, filter_property: value,
filter_type: key, filter_type: key,
@ -112,7 +112,7 @@ export const GlobalIssuesHeader: React.FC<Props> = observer((props) => {
payload: { payload: {
property_type: Object.keys(updatedDisplayFilter).join(","), property_type: Object.keys(updatedDisplayFilter).join(","),
property: Object.values(updatedDisplayFilter)?.[0], property: Object.values(updatedDisplayFilter)?.[0],
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -135,7 +135,7 @@ export const GlobalIssuesHeader: React.FC<Props> = observer((props) => {
eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED, eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED,
payload: { payload: {
display_property: Object.keys(property).join(","), display_property: Object.keys(property).join(","),
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -206,7 +206,7 @@ export const GlobalIssuesHeader: React.FC<Props> = observer((props) => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: FILTER_SEARCHED, eventName: FILTER_SEARCHED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
current_filters: issueFilters?.filters, current_filters: issueFilters?.filters,
layout: issueFilters?.displayFilters?.layout, layout: issueFilters?.displayFilters?.layout,
}, },

View File

@ -140,7 +140,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED, eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
filter_property: value, filter_property: value,
filter_type: key, filter_type: key,
@ -160,7 +160,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
payload: { payload: {
property_type: Object.keys(updatedDisplayFilter).join(","), property_type: Object.keys(updatedDisplayFilter).join(","),
property: Object.values(updatedDisplayFilter)?.[0], property: Object.values(updatedDisplayFilter)?.[0],
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -177,7 +177,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED, eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED,
payload: { payload: {
display_property: Object.keys(property).join(","), display_property: Object.keys(property).join(","),
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -283,7 +283,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: FILTER_SEARCHED, eventName: FILTER_SEARCHED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
current_filters: issueFilters?.filters, current_filters: issueFilters?.filters,
layout: issueFilters?.displayFilters?.layout, layout: issueFilters?.displayFilters?.layout,
}, },

View File

@ -87,7 +87,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED, eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
filter_property: value, filter_property: value,
filter_type: key, filter_type: key,
@ -120,7 +120,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
payload: { payload: {
property_type: Object.keys(updatedDisplayFilter).join(","), property_type: Object.keys(updatedDisplayFilter).join(","),
property: Object.values(updatedDisplayFilter)?.[0], property: Object.values(updatedDisplayFilter)?.[0],
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -137,7 +137,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED, eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED,
payload: { payload: {
display_property: Object.keys(property).join(","), display_property: Object.keys(property).join(","),
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}); });
@ -227,7 +227,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: FILTER_SEARCHED, eventName: FILTER_SEARCHED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
current_filters: issueFilters?.filters, current_filters: issueFilters?.filters,
layout: issueFilters?.displayFilters?.layout, layout: issueFilters?.displayFilters?.layout,
}, },

View File

@ -113,7 +113,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED, eventName: isFilterRemoved ? FILTER_REMOVED : FILTER_APPLIED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
filter_property: value, filter_property: value,
filter_type: key, filter_type: key,
@ -139,7 +139,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
payload: { payload: {
property_type: Object.keys(updatedDisplayFilter).join(","), property_type: Object.keys(updatedDisplayFilter).join(","),
property: Object.values(updatedDisplayFilter)?.[0], property: Object.values(updatedDisplayFilter)?.[0],
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -162,7 +162,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED, eventName: Object.values(property)?.[0] === true ? DP_APPLIED : DP_REMOVED,
payload: { payload: {
display_property: Object.keys(property).join(","), display_property: Object.keys(property).join(","),
path: router.asPath, routePath: router.asPath,
filters: issueFilters, filters: issueFilters,
}, },
}) })
@ -263,7 +263,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
captureIssuesFilterEvent({ captureIssuesFilterEvent({
eventName: FILTER_SEARCHED, eventName: FILTER_SEARCHED,
payload: { payload: {
path: router.asPath, routePath: router.asPath,
current_filters: issueFilters?.filters, current_filters: issueFilters?.filters,
layout: issueFilters?.displayFilters?.layout, layout: issueFilters?.displayFilters?.layout,
}, },

View File

@ -99,7 +99,7 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
state: "SUCCESS", state: "SUCCESS",
element: "Inbox page", element: "Inbox page",
}, },
path: router.pathname, routePath: router.pathname,
}); });
}) })
.catch((error) => { .catch((error) => {
@ -111,7 +111,7 @@ export const CreateInboxIssueModal: React.FC<Props> = observer((props) => {
state: "FAILED", state: "FAILED",
element: "Inbox page", element: "Inbox page",
}, },
path: router.pathname, routePath: router.pathname,
}); });
}); });
}; };

View File

@ -57,7 +57,7 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined, change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
setToast({ setToast({
@ -72,7 +72,7 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined, change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} }
}, },
@ -87,13 +87,13 @@ export const InboxIssueDetailRoot: FC<TInboxIssueDetailRoot> = (props) => {
captureIssueEvent({ captureIssueEvent({
eventName: "Inbox issue deleted", eventName: "Inbox issue deleted",
payload: { id: issueId, state: "SUCCESS", element: "Inbox" }, payload: { id: issueId, state: "SUCCESS", element: "Inbox" },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
eventName: "Inbox issue deleted", eventName: "Inbox issue deleted",
payload: { id: issueId, state: "FAILED", element: "Inbox" }, payload: { id: issueId, state: "FAILED", element: "Inbox" },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
title: "Issue delete failed", title: "Issue delete failed",

View File

@ -95,7 +95,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined, change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
} catch (error) { } catch (error) {
captureIssueEvent({ captureIssueEvent({
@ -105,7 +105,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
changed_property: Object.keys(data).join(","), changed_property: Object.keys(data).join(","),
change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined, change_details: !data.name && !data.description_html ? Object.values(data).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
title: "Issue update failed", title: "Issue update failed",
@ -126,7 +126,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({
@ -137,7 +137,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,
}); });
} }
}, },
@ -152,7 +152,7 @@ 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) {
setToast({ setToast({
@ -163,7 +163,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
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,
}); });
} }
}, },
@ -189,7 +189,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) {
captureIssueEvent({ captureIssueEvent({
@ -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,
}); });
} }
}, },
@ -225,7 +225,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({
@ -235,7 +235,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,
}); });
} }
}, },
@ -261,7 +261,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) {
captureIssueEvent({ captureIssueEvent({
@ -271,7 +271,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,
}); });
} }
}, },
@ -297,7 +297,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({
@ -307,7 +307,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

@ -155,14 +155,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

@ -188,7 +188,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
captureIssueEvent({ captureIssueEvent({
eventName: ISSUE_DELETED, eventName: ISSUE_DELETED,
payload: { id: dragState.draggedIssueId!, state: "FAILED", element: "Kanban layout drag & drop" }, payload: { id: dragState.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

@ -85,7 +85,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,
@ -100,7 +100,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,
@ -115,7 +115,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,
@ -130,7 +130,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,
@ -155,7 +155,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 } },
}); });
}, },
@ -171,7 +171,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 } },
}); });
}, },
@ -185,7 +185,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,
@ -202,7 +202,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,
@ -218,7 +218,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

@ -93,7 +93,7 @@ export const AllIssueLayoutRoot: React.FC = observer(() => {
await fetchAllGlobalViews(workspaceSlug.toString()); await fetchAllGlobalViews(workspaceSlug.toString());
await fetchFilters(workspaceSlug.toString(), globalViewId.toString()); await fetchFilters(workspaceSlug.toString(), globalViewId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
}); });
await fetchIssues(workspaceSlug.toString(), globalViewId.toString(), issueIds ? "mutation" : "init-loader"); await fetchIssues(workspaceSlug.toString(), globalViewId.toString(), issueIds ? "mutation" : "init-loader");
routerFilterParams(); routerFilterParams();

View File

@ -29,7 +29,7 @@ export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
if (workspaceSlug && projectId) { if (workspaceSlug && projectId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}); });
await issues?.fetchIssues( await issues?.fetchIssues(

View File

@ -42,7 +42,7 @@ export const CycleLayoutRoot: React.FC = observer(() => {
if (workspaceSlug && projectId && cycleId) { if (workspaceSlug && projectId && cycleId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), cycleId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), cycleId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}); });
await issues?.fetchIssues( await issues?.fetchIssues(

View File

@ -29,7 +29,7 @@ export const DraftIssueLayoutRoot: React.FC = observer(() => {
if (workspaceSlug && projectId) { if (workspaceSlug && projectId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}); });
await issues?.fetchIssues( await issues?.fetchIssues(

View File

@ -38,7 +38,7 @@ export const ModuleLayoutRoot: React.FC = observer(() => {
if (workspaceSlug && projectId && moduleId) { if (workspaceSlug && projectId && moduleId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), moduleId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), moduleId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}) })
await issues?.fetchIssues( await issues?.fetchIssues(

View File

@ -36,7 +36,7 @@ export const ProjectLayoutRoot: FC = observer(() => {
if (workspaceSlug && projectId) { if (workspaceSlug && projectId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}); });
await issues?.fetchIssues( await issues?.fetchIssues(

View File

@ -34,7 +34,7 @@ export const ProjectViewLayoutRoot: React.FC = observer(() => {
if (workspaceSlug && projectId && viewId) { if (workspaceSlug && projectId && viewId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), viewId.toString()); await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), viewId.toString());
captureIssuesListOpenedEvent({ captureIssuesListOpenedEvent({
path: router.asPath, routePath: router.asPath,
filters: issuesFilter?.issueFilters?.filters, filters: issuesFilter?.issueFilters?.filters,
}); });
await issues?.fetchIssues( await issues?.fetchIssues(

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, addIssueToCycle, removeIssueFromCycle, captureIssueEvent, router.asPath] [workspaceSlug, issue, addIssueToCycle, removeIssueFromCycle, captureIssueEvent, router.asPath]

View File

@ -52,7 +52,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, addModulesToIssue, removeModulesFromIssue, captureIssueEvent, router.asPath] [workspaceSlug, issue, addModulesToIssue, removeModulesFromIssue, 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

@ -68,7 +68,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);
@ -83,7 +83,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

@ -166,7 +166,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();
return response; return response;
@ -179,7 +179,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,
}); });
} }
}; };
@ -200,7 +200,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) {
@ -212,7 +212,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

@ -99,14 +99,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: "Issue update failed", title: "Issue update failed",
@ -126,7 +126,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({
@ -137,7 +137,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,
}); });
} }
}, },
@ -152,7 +152,7 @@ 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) {
setToast({ setToast({
@ -163,7 +163,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
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,
}); });
} }
}, },
@ -178,7 +178,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({
@ -189,7 +189,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,
}); });
} }
}, },
@ -215,7 +215,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) {
captureIssueEvent({ captureIssueEvent({
@ -225,7 +225,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,
}); });
} }
}, },
@ -251,7 +251,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({
@ -261,7 +261,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,
}); });
} }
}, },
@ -287,7 +287,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) {
captureIssueEvent({ captureIssueEvent({
@ -297,7 +297,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,
}); });
} }
}, },
@ -323,7 +323,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({
@ -333,7 +333,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

@ -179,7 +179,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
change_details: change_details:
!issueData.name && !issueData.description_html ? Object.values(issueData).join(",") : undefined, !issueData.name && !issueData.description_html ? Object.values(issueData).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.SUCCESS, type: TOAST_TYPE.SUCCESS,
@ -196,7 +196,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
change_details: change_details:
!issueData.name && !issueData.description_html ? Object.values(issueData).join(",") : undefined, !issueData.name && !issueData.description_html ? Object.values(issueData).join(",") : undefined,
}, },
path: router.asPath, routePath: router.asPath,
}); });
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
@ -221,7 +221,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) {
@ -232,7 +232,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

@ -25,7 +25,6 @@ import { Button, Loader } from "@plane/ui";
// types // types
import { IIssueLabel } from "@plane/types"; import { IIssueLabel } from "@plane/types";
// constants // constants
import { LABEL_ADDED_G, LABEL_REMOVED_G } from "constants/event-tracker";
import { EmptyStateType } from "constants/empty-state"; import { EmptyStateType } from "constants/empty-state";
const LABELS_ROOT = "labels.root"; const LABELS_ROOT = "labels.root";
@ -43,7 +42,7 @@ export const ProjectSettingsLabelList: React.FC = observer(() => {
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;
// store hooks // store hooks
const { projectLabels, updateLabelPosition, projectLabelsTree, getLabelById } = useLabel(); const { projectLabels, updateLabelPosition, projectLabelsTree, getLabelById } = useLabel();
const { captureEvent } = useEventTracker(); const { captureLabelDragNDropEvent } = useEventTracker();
// portal // portal
const renderDraggable = useDraggableInPortal(); const renderDraggable = useDraggableInPortal();
@ -71,40 +70,18 @@ export const ProjectSettingsLabelList: React.FC = observer(() => {
if (result.reason == "DROP" && childLabel != parentLabel) { if (result.reason == "DROP" && childLabel != parentLabel) {
const childLabelData = getLabelById(childLabel); const childLabelData = getLabelById(childLabel);
if (childLabelData?.parent != parentLabel) { captureLabelDragNDropEvent(childLabelData?.parent, parentLabel, childLabel, projectLabelsTree);
if (childLabelData?.parent) {
captureEvent(LABEL_REMOVED_G, {
group_id: childLabelData?.parent,
child_id: childLabel,
child_count:
(projectLabelsTree?.find((label) => label.id === childLabelData?.parent)?.children?.length ?? 0) - 1,
});
parentLabel &&
captureEvent(LABEL_ADDED_G, {
group_id: parentLabel,
child_id: childLabel,
child_count: (projectLabelsTree?.find((label) => label.id === parentLabel)?.children?.length ?? 0) + 1,
});
} else {
captureEvent(LABEL_ADDED_G, {
group_id: parentLabel,
child_id: childLabel,
child_count: (projectLabelsTree?.find((label) => label.id === parentLabel)?.children?.length ?? 0) + 1,
});
}
}
updateLabelPosition(
workspaceSlug?.toString()!,
projectId?.toString()!,
childLabel,
parentLabel,
index,
prevParentLabel == parentLabel,
prevIndex
);
return;
} }
updateLabelPosition(
workspaceSlug?.toString()!,
projectId?.toString()!,
childLabel,
parentLabel,
index,
prevParentLabel == parentLabel,
prevIndex
);
return;
}; };
return ( return (

View File

@ -11,7 +11,7 @@ import { useEventTracker, useProjectView } from "hooks/store";
// types // types
import { IProjectView } from "@plane/types"; import { IProjectView } from "@plane/types";
// constants // constants
import { VIEW_CREATED, VIEW_UPDATED } from "constants/event-tracker"; import { VIEW_CREATED, VIEW_UPDATED, elementFromPath } from "constants/event-tracker";
type Props = { type Props = {
data?: IProjectView | null; data?: IProjectView | null;
@ -26,7 +26,6 @@ export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
const { data, isOpen, onClose, preLoadedData, workspaceSlug, projectId } = props; const { data, isOpen, onClose, preLoadedData, workspaceSlug, projectId } = props;
// router // router
const router = useRouter(); const router = useRouter();
const { cycleId, moduleId, viewId } = router.query;
// store hooks // store hooks
const { createView, updateView } = useProjectView(); const { createView, updateView } = useProjectView();
const { captureEvent, getTrackElement } = useEventTracker(); const { captureEvent, getTrackElement } = useEventTracker();
@ -39,19 +38,12 @@ export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
await createView(workspaceSlug, projectId, payload) await createView(workspaceSlug, projectId, payload)
.then((res) => { .then((res) => {
handleClose(); handleClose();
const element = elementFromPath(router.asPath);
captureEvent(VIEW_CREATED, { captureEvent(VIEW_CREATED, {
view_id: res.id, view_id: res.id,
filters: res.filters, filters: res.filters,
element_id: cycleId ?? moduleId ?? viewId ?? projectId, element: getTrackElement ?? element?.element,
element: getTrackElement element_id: element?.element_id,
? getTrackElement
: cycleId
? "Cycle issues page"
: moduleId
? "Module issues page"
: viewId
? "View issues page"
: "Project issues page",
state: "SUCCESS", state: "SUCCESS",
}); });
setToast({ setToast({

View File

@ -4,7 +4,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 = {
@ -72,7 +72,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,
@ -97,35 +97,33 @@ 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: elementFromPath(path), updated_from: elementFromPath(routePath),
}; };
} }
return eventPayload; return eventPayload;
}; };
export const getProjectStateEventPayload = (payload: any) => { export const getProjectStateEventPayload = (payload: any) => ({
return { state_id: payload.id,
state_id: payload.id, created_at: payload.created_at,
created_at: payload.created_at, updated_at: payload.updated_at,
updated_at: payload.updated_at, group: payload.group,
group: payload.group, color: payload.color,
color: payload.color, default: payload.default,
default: payload.default, state: payload.state,
state: payload.state, element: payload.element,
element: payload.element, change_details: payload.change_details,
change_details: payload.change_details, });
};
};
export const getIssuesListOpenedPayload = (payload: any) => ({ export const getIssuesListOpenedPayload = (payload: any) => ({
...elementFromPath(payload?.path), ...elementFromPath(payload?.routePath),
layout: payload?.displayFilters?.layout, layout: payload?.displayFilters?.layout,
filters: payload?.filters, filters: payload?.filters,
display_properties: payload?.displayProperties, display_properties: payload?.displayProperties,
@ -136,7 +134,7 @@ export const getIssuesFilterEventPayload = (payload: any) => ({
filter_property: payload?.filter_property, filter_property: payload?.filter_property,
layout: payload?.filters?.displayFilters?.layout, layout: payload?.filters?.displayFilters?.layout,
current_filters: payload?.filters?.filters, current_filters: payload?.filters?.filters,
...elementFromPath(payload?.path), ...elementFromPath(payload?.routePath),
}); });
export const getIssuesDisplayFilterPayload = (payload: any) => { export const getIssuesDisplayFilterPayload = (payload: any) => {
@ -149,32 +147,32 @@ export const getIssuesDisplayFilterPayload = (payload: any) => {
return { return {
layout: payload?.filters?.displayFilters?.layout, layout: payload?.filters?.displayFilters?.layout,
current_display_properties: payload?.filters?.displayProperties, current_display_properties: payload?.filters?.displayProperties,
...elementFromPath(payload?.path), ...elementFromPath(payload?.routePath),
display_property: payload.display_property, display_property: payload.display_property,
property: property, property: property,
property_type: payload.property_type, property_type: payload.property_type,
}; };
}; };
export const elementFromPath = (path?: string) => { export const elementFromPath = (routePath?: string) => {
path = path?.split("?")?.[0]; routePath = routePath?.split("?")?.[0];
if (!path) return; if (!routePath) return;
let element = "Dashboard"; let element = "Dashboard";
if (path.includes("workspace-views")) element = "Global view"; if (routePath.includes("workspace-views")) element = "Global view";
else if (path.includes("cycles")) element = "Cycle"; else if (routePath.includes("cycles")) element = "Cycle";
else if (path.includes("modules")) element = "Module"; else if (routePath.includes("modules")) element = "Module";
else if (path.includes("pages")) element = "Project page"; else if (routePath.includes("pages")) element = "Project page";
else if (path.includes("views")) element = "Project view"; else if (routePath.includes("views")) element = "Project view";
else if (path.includes("profile")) element = "Profile"; else if (routePath.includes("profile")) element = "Profile";
else if (path.includes("inbox")) element = "Inbox"; else if (routePath.includes("inbox")) element = "Inbox";
else if (path.includes("draft")) element = "Draft"; else if (routePath.includes("draft")) element = "Draft";
else if (path.includes("archived")) element = "Archive"; else if (routePath.includes("archived")) element = "Archive";
else if (path.includes("projects")) element = "Project"; else if (routePath.includes("projects")) element = "Project";
return { return {
element: element, element: element,
element_id: ["Project", "Draft", "Archive"].includes(element) ? path.split("/").at(-2) : path.split("/").at(-1), element_id: ["Project", "Draft", "Archive"].includes(element) ? routePath.split("/")?.at(-2) : routePath.split("/")?.at(-1),
}; };
}; };

View File

@ -6,8 +6,6 @@ import { RootStore } from "./root.store";
import { getUserRole } from "helpers/user.helper"; import { getUserRole } from "helpers/user.helper";
// constants // constants
import { import {
GROUP_WORKSPACE,
WORKSPACE_CREATED,
EventProps, EventProps,
IssueEventProps, IssueEventProps,
getCycleEventPayload, getCycleEventPayload,
@ -17,12 +15,17 @@ import {
getProjectStateEventPayload, getProjectStateEventPayload,
getWorkspaceEventPayload, getWorkspaceEventPayload,
getPageEventPayload, getPageEventPayload,
ISSUES_LIST_OPENED,
getIssuesListOpenedPayload, getIssuesListOpenedPayload,
getIssuesFilterEventPayload, getIssuesFilterEventPayload,
getIssuesDisplayFilterPayload, getIssuesDisplayFilterPayload,
LP_UPDATED, LP_UPDATED,
ISSUES_LIST_OPENED,
GROUP_WORKSPACE,
WORKSPACE_CREATED,
LABEL_REMOVED_G,
LABEL_ADDED_G,
} from "constants/event-tracker"; } from "constants/event-tracker";
import { IIssueLabelTree } from "@plane/types";
export interface IEventTrackerStore { export interface IEventTrackerStore {
// properties // properties
@ -45,6 +48,12 @@ export interface IEventTrackerStore {
captureIssuesListOpenedEvent: (payload: any) => void; captureIssuesListOpenedEvent: (payload: any) => void;
captureIssuesFilterEvent: (props: EventProps) => void; captureIssuesFilterEvent: (props: EventProps) => void;
captureIssuesDisplayFilterEvent: (props: EventProps) => void; captureIssuesDisplayFilterEvent: (props: EventProps) => void;
captureLabelDragNDropEvent: (
childLabelParent: string | null | undefined,
parentLabel: string | null | undefined,
childLabel: string | null | undefined,
projectLabelsTree: IIssueLabelTree[] | undefined
) => void;
} }
export class EventTrackerStore implements IEventTrackerStore { export class EventTrackerStore implements IEventTrackerStore {
@ -69,6 +78,7 @@ export class EventTrackerStore implements IEventTrackerStore {
captureProjectStateEvent: action, captureProjectStateEvent: action,
captureIssuesListOpenedEvent: action, captureIssuesListOpenedEvent: action,
joinWorkspaceMetricGroup: action, joinWorkspaceMetricGroup: action,
captureWorkspaceEvent: action,
}); });
// store // store
this.rootStore = _rootStore; this.rootStore = _rootStore;
@ -292,4 +302,35 @@ export class EventTrackerStore implements IEventTrackerStore {
posthog?.capture(eventName, eventPayload); posthog?.capture(eventName, eventPayload);
this.setTrackElement(undefined); this.setTrackElement(undefined);
}; };
captureLabelDragNDropEvent = (
childLabelParent: string | null | undefined,
parentLabel: string | null | undefined,
childLabel: string | null | undefined,
projectLabelsTree: IIssueLabelTree[] | undefined
) => {
if (childLabelParent != parentLabel) {
// if the child label has a parent, then remove it from the parent and add it to a new parent.
if (childLabelParent) {
this.captureEvent(LABEL_REMOVED_G, {
group_id: childLabelParent,
child_id: childLabel,
child_count: (projectLabelsTree?.find((label) => label.id === childLabelParent)?.children?.length ?? 0) - 1,
});
parentLabel &&
this.captureEvent(LABEL_ADDED_G, {
group_id: parentLabel,
child_id: childLabel,
child_count: (projectLabelsTree?.find((label) => label.id === parentLabel)?.children?.length ?? 0) + 1,
});
} else {
// if the child label has no parent, then add it to a new parent.
this.captureEvent(LABEL_ADDED_G, {
group_id: parentLabel,
child_id: childLabel,
child_count: (projectLabelsTree?.find((label) => label.id === parentLabel)?.children?.length ?? 0) + 1,
});
}
}
};
} }