chore: added getter for track-element

This commit is contained in:
LAKHAN BAHETI 2024-02-21 15:39:18 +05:30
parent c237effa75
commit dd54f6bd77
2 changed files with 12 additions and 3 deletions

View File

@ -28,7 +28,7 @@ export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
const { cycleId, moduleId, viewId } = router.query;
// store hooks
const { createView, updateView } = useProjectView();
const { captureEvent, trackElement } = useEventTracker();
const { captureEvent, getTrackElement } = useEventTracker();
// toast alert
const { setToastAlert } = useToast();
@ -44,8 +44,8 @@ export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
view_id: res.id,
filters: res.filters,
element_id: cycleId ?? moduleId ?? viewId ?? projectId,
element: trackElement
? trackElement
element: getTrackElement
? getTrackElement
: cycleId
? "Cycle issues page"
: moduleId

View File

@ -24,6 +24,7 @@ export interface IEventTrackerStore {
trackElement: string | undefined;
// computed
getRequiredProperties: any;
getTrackElement: string | undefined;
// actions
resetSession: () => void;
setTrackElement: (element: string) => void;
@ -47,6 +48,7 @@ export class EventTrackerStore implements IEventTrackerStore {
trackElement: observable,
// computed
getRequiredProperties: computed,
getTrackElement: computed,
// actions
resetSession: action,
setTrackElement: action,
@ -58,6 +60,13 @@ export class EventTrackerStore implements IEventTrackerStore {
this.rootStore = _rootStore;
}
/**
* @description: Returns the current track element.
*/
get getTrackElement() {
return this.trackElement;
}
/**
* @description: Returns the necessary property for the event tracking
*/