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

View File

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