feat: event tracking using posthog and created application provider to render multiple wrappers (#2757)
* fix: event tracker changes * fix: App provider implementation using wrappers * fix: updating packages * fix: handling warning * fix: wrapper fixes and minor optimization changes * fix: chore app-provider clearnup * fix: cleanup * fix: removing jitsu tracking * fix: minor updates * fix: adding event to posthog event tracker (#2802) * dev: posthog event tracker update intitiate * fix: adding events for posthog integration * fix: event payload --------- Co-authored-by: Ramesh Kumar Chandra <31303617+rameshkumarchandra@users.noreply.github.com>
This commit is contained in:
parent
33be52792f
commit
78fee22fec
114 changed files with 825 additions and 2768 deletions
|
|
@ -231,15 +231,10 @@ export const DraftIssueForm: FC<IssueFormProps> = (props) => {
|
|||
setIAmFeelingLucky(true);
|
||||
|
||||
aiService
|
||||
.createGptTask(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
prompt: issueName,
|
||||
task: "Generate a proper description for this issue.",
|
||||
},
|
||||
user
|
||||
)
|
||||
.createGptTask(workspaceSlug as string, projectId as string, {
|
||||
prompt: issueName,
|
||||
task: "Generate a proper description for this issue.",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.response === "")
|
||||
setToastAlert({
|
||||
|
|
|
|||
|
|
@ -226,36 +226,24 @@ export const CreateUpdateDraftIssueModal: React.FC<IssuesModalProps> = observer(
|
|||
const addIssueToCycle = async (issueId: string, cycleId: string) => {
|
||||
if (!workspaceSlug || !activeProject || !user) return;
|
||||
|
||||
await issueService.addIssueToCycle(
|
||||
workspaceSlug as string,
|
||||
activeProject ?? "",
|
||||
cycleId,
|
||||
{
|
||||
issues: [issueId],
|
||||
},
|
||||
user
|
||||
);
|
||||
await issueService.addIssueToCycle(workspaceSlug as string, activeProject ?? "", cycleId, {
|
||||
issues: [issueId],
|
||||
});
|
||||
};
|
||||
|
||||
const addIssueToModule = async (issueId: string, moduleId: string) => {
|
||||
if (!workspaceSlug || !activeProject || !user) return;
|
||||
|
||||
await moduleService.addIssuesToModule(
|
||||
workspaceSlug as string,
|
||||
activeProject ?? "",
|
||||
moduleId as string,
|
||||
{
|
||||
issues: [issueId],
|
||||
},
|
||||
user
|
||||
);
|
||||
await moduleService.addIssuesToModule(workspaceSlug as string, activeProject ?? "", moduleId as string, {
|
||||
issues: [issueId],
|
||||
});
|
||||
};
|
||||
|
||||
const createIssue = async (payload: Partial<IIssue>) => {
|
||||
if (!workspaceSlug || !activeProject || !user) return;
|
||||
|
||||
await issueService
|
||||
.createIssue(workspaceSlug.toString(), activeProject, payload, user)
|
||||
.createIssue(workspaceSlug.toString(), activeProject, payload)
|
||||
.then(async (res) => {
|
||||
if (payload.cycle && payload.cycle !== "") await addIssueToCycle(res.id, payload.cycle);
|
||||
if (payload.module && payload.module !== "") await addIssueToModule(res.id, payload.module);
|
||||
|
|
|
|||
|
|
@ -188,15 +188,10 @@ export const IssueForm: FC<IssueFormProps> = observer((props) => {
|
|||
setIAmFeelingLucky(true);
|
||||
|
||||
aiService
|
||||
.createGptTask(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
prompt: issueName,
|
||||
task: "Generate a proper description for this issue.",
|
||||
},
|
||||
user
|
||||
)
|
||||
.createGptTask(workspaceSlug as string, projectId as string, {
|
||||
prompt: issueName,
|
||||
task: "Generate a proper description for this issue.",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.response === "")
|
||||
setToastAlert({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import React, { FC } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
// services
|
||||
import { ModuleService } from "services/module.service";
|
||||
import { IssueService } from "services/issue";
|
||||
|
|
@ -11,7 +10,6 @@ import { ExistingIssuesListModal } from "components/core";
|
|||
// lucide icons
|
||||
import { Minimize2, Maximize2, Circle, Plus } from "lucide-react";
|
||||
// hooks
|
||||
import useUser from "hooks/use-user";
|
||||
import useToast from "hooks/use-toast";
|
||||
// mobx
|
||||
import { observer } from "mobx-react-lite";
|
||||
|
|
@ -43,8 +41,6 @@ export const HeaderGroupByCard: FC<IHeaderGroupByCard> = observer((props) => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, moduleId, cycleId } = router.query;
|
||||
|
||||
const { user } = useUser();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const renderExistingIssueModal = moduleId || cycleId;
|
||||
|
|
@ -58,7 +54,7 @@ export const HeaderGroupByCard: FC<IHeaderGroupByCard> = observer((props) => {
|
|||
};
|
||||
|
||||
await moduleService
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, payload, user)
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, payload)
|
||||
.catch(() =>
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -76,7 +72,7 @@ export const HeaderGroupByCard: FC<IHeaderGroupByCard> = observer((props) => {
|
|||
};
|
||||
|
||||
await issueService
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, payload, user)
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, payload)
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import React from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
// services
|
||||
import { ModuleService } from "services/module.service";
|
||||
import { IssueService } from "services/issue";
|
||||
|
|
@ -11,7 +10,6 @@ import { CreateUpdateIssueModal } from "components/issues/modal";
|
|||
import { ExistingIssuesListModal } from "components/core";
|
||||
import { CustomMenu } from "@plane/ui";
|
||||
// hooks
|
||||
import useUser from "hooks/use-user";
|
||||
import useToast from "hooks/use-toast";
|
||||
// mobx
|
||||
import { observer } from "mobx-react-lite";
|
||||
|
|
@ -34,8 +32,6 @@ export const HeaderGroupByCard = observer(({ icon, title, count, issuePayload }:
|
|||
const [isOpen, setIsOpen] = React.useState(false);
|
||||
const [openExistingIssueListModal, setOpenExistingIssueListModal] = React.useState(false);
|
||||
|
||||
const { user } = useUser();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const verticalAlignPosition = false;
|
||||
|
|
@ -51,7 +47,7 @@ export const HeaderGroupByCard = observer(({ icon, title, count, issuePayload }:
|
|||
};
|
||||
|
||||
await moduleService
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, payload, user)
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, payload)
|
||||
.catch(() =>
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -69,7 +65,7 @@ export const HeaderGroupByCard = observer(({ icon, title, count, issuePayload }:
|
|||
};
|
||||
|
||||
await issueService
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, payload, user)
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId as string, payload)
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||
if (!workspaceSlug || !projectId || !issueId) return;
|
||||
|
||||
await issueCommentService
|
||||
.patchIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, data, user)
|
||||
.patchIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, data)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||
mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false);
|
||||
|
||||
await issueCommentService
|
||||
.deleteIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId, user)
|
||||
.deleteIssueComment(workspaceSlug as string, projectId as string, issueId as string, commentId)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
|||
if (!workspaceSlug || !issueDetails || !user) return;
|
||||
|
||||
await issueCommentService
|
||||
.createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData, user)
|
||||
.createIssueComment(workspaceSlug.toString(), issueDetails.project, issueDetails.id, formData)
|
||||
.then(() => {
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueDetails.id));
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import useSWR, { mutate } from "swr";
|
|||
// services
|
||||
import { IssueCommentService, IssueService } from "services/issue";
|
||||
// hooks
|
||||
import useUser from "hooks/use-user";
|
||||
import useToast from "hooks/use-toast";
|
||||
import useProjectDetails from "hooks/use-project-details";
|
||||
// components
|
||||
|
|
@ -26,7 +25,6 @@ export const PeekOverviewIssueActivity: React.FC<Props> = (props) => {
|
|||
// toast
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { user } = useUser();
|
||||
const { projectDetails } = useProjectDetails();
|
||||
|
||||
const { data: issueActivity, mutate: mutateIssueActivity } = useSWR(
|
||||
|
|
@ -40,7 +38,7 @@ export const PeekOverviewIssueActivity: React.FC<Props> = (props) => {
|
|||
if (!workspaceSlug || !issue) return;
|
||||
|
||||
await issueCommentService
|
||||
.patchIssueComment(workspaceSlug as string, issue.project, issue.id, commentId, data, user)
|
||||
.patchIssueComment(workspaceSlug as string, issue.project, issue.id, commentId, data)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -50,7 +48,7 @@ export const PeekOverviewIssueActivity: React.FC<Props> = (props) => {
|
|||
mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false);
|
||||
|
||||
await issueCommentService
|
||||
.deleteIssueComment(workspaceSlug as string, issue.project, issue.id, commentId, user)
|
||||
.deleteIssueComment(workspaceSlug as string, issue.project, issue.id, commentId)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -58,7 +56,7 @@ export const PeekOverviewIssueActivity: React.FC<Props> = (props) => {
|
|||
if (!workspaceSlug || !issue) return;
|
||||
|
||||
await issueCommentService
|
||||
.createIssueComment(workspaceSlug.toString(), issue.project, issue.id, formData, user)
|
||||
.createIssueComment(workspaceSlug.toString(), issue.project, issue.id, formData)
|
||||
.then(() => {
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issue.id));
|
||||
})
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export const SidebarBlockedSelect: React.FC<Props> = ({ issueId, submitChanges,
|
|||
if (!user) return;
|
||||
|
||||
issueService
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, {
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, {
|
||||
related_list: [
|
||||
...selectedIssues.map((issue) => ({
|
||||
issue: issueId as string,
|
||||
|
|
@ -134,8 +134,7 @@ export const SidebarBlockedSelect: React.FC<Props> = ({ issueId, submitChanges,
|
|||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
issueId as string,
|
||||
relation.id,
|
||||
user
|
||||
relation.id
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export const SidebarBlockerSelect: React.FC<Props> = ({ issueId, submitChanges,
|
|||
if (!user) return;
|
||||
|
||||
issueService
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, {
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, {
|
||||
related_list: [
|
||||
...selectedIssues.map((issue) => ({
|
||||
issue: issue.blocker_issue_detail.id,
|
||||
|
|
@ -144,8 +144,7 @@ export const SidebarBlockerSelect: React.FC<Props> = ({ issueId, submitChanges,
|
|||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
relation.issue_detail?.id as string,
|
||||
relation.id,
|
||||
user
|
||||
relation.id
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export const SidebarDuplicateSelect: React.FC<Props> = (props) => {
|
|||
if (!user) return;
|
||||
|
||||
issueService
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, {
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, {
|
||||
related_list: [
|
||||
...selectedIssues.map((issue) => ({
|
||||
issue: issueId as string,
|
||||
|
|
@ -137,8 +137,7 @@ export const SidebarDuplicateSelect: React.FC<Props> = (props) => {
|
|||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
issueId as string,
|
||||
relation.id,
|
||||
user
|
||||
relation.id
|
||||
)
|
||||
.then(() => {
|
||||
submitChanges();
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import { TwitterPicker } from "react-color";
|
|||
import { Popover, Transition } from "@headlessui/react";
|
||||
// services
|
||||
import { IssueLabelService } from "services/issue";
|
||||
// hooks
|
||||
import useUser from "hooks/use-user";
|
||||
// ui
|
||||
import { Input } from "@plane/ui";
|
||||
import { IssueLabelSelect } from "../select";
|
||||
|
|
@ -61,8 +59,6 @@ export const SidebarLabelSelect: React.FC<Props> = ({
|
|||
defaultValues,
|
||||
});
|
||||
|
||||
const { user } = useUser();
|
||||
|
||||
const { data: issueLabels, mutate: issueLabelMutate } = useSWR<IIssueLabel[]>(
|
||||
workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
|
|
@ -74,7 +70,7 @@ export const SidebarLabelSelect: React.FC<Props> = ({
|
|||
if (!workspaceSlug || !projectId || isSubmitting) return;
|
||||
|
||||
await issueLabelService
|
||||
.createIssueLabel(workspaceSlug as string, projectId as string, formData, user)
|
||||
.createIssueLabel(workspaceSlug as string, projectId as string, formData)
|
||||
.then((res) => {
|
||||
reset(defaultValues);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export const SidebarRelatesSelect: React.FC<Props> = (props) => {
|
|||
if (!user) return;
|
||||
|
||||
issueService
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, user, {
|
||||
.createIssueRelation(workspaceSlug as string, projectId as string, issueId as string, {
|
||||
related_list: [
|
||||
...selectedIssues.map((issue) => ({
|
||||
issue: issueId as string,
|
||||
|
|
@ -138,8 +138,7 @@ export const SidebarRelatesSelect: React.FC<Props> = (props) => {
|
|||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
issueId as string,
|
||||
relation.id,
|
||||
user
|
||||
relation.id
|
||||
)
|
||||
.then(() => {
|
||||
submitChanges();
|
||||
|
|
|
|||
|
|
@ -101,15 +101,9 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
if (!workspaceSlug || !projectId || !issueDetail || !user) return;
|
||||
|
||||
issueService
|
||||
.addIssueToCycle(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
cycleId,
|
||||
{
|
||||
issues: [issueDetail.id],
|
||||
},
|
||||
user
|
||||
)
|
||||
.addIssueToCycle(workspaceSlug as string, projectId as string, cycleId, {
|
||||
issues: [issueDetail.id],
|
||||
})
|
||||
.then(() => {
|
||||
mutate(ISSUE_DETAILS(issueId as string));
|
||||
});
|
||||
|
|
@ -122,15 +116,9 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
if (!workspaceSlug || !projectId || !issueDetail || !user) return;
|
||||
|
||||
moduleService
|
||||
.addIssuesToModule(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
moduleId,
|
||||
{
|
||||
issues: [issueDetail.id],
|
||||
},
|
||||
user
|
||||
)
|
||||
.addIssuesToModule(workspaceSlug as string, projectId as string, moduleId, {
|
||||
issues: [issueDetail.id],
|
||||
})
|
||||
.then(() => {
|
||||
mutate(ISSUE_DETAILS(issueId as string));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { mutate } from "swr";
|
|||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// services
|
||||
import { IssueService } from "services/issue";
|
||||
import { TrackEventService } from "services/track_event.service";
|
||||
// components
|
||||
import { ViewDueDateSelect, ViewStartDateSelect } from "components/issues";
|
||||
import { PrioritySelect } from "components/project";
|
||||
|
|
@ -25,7 +24,6 @@ export interface IIssueProperty {
|
|||
|
||||
// services
|
||||
const issueService = new IssueService();
|
||||
const trackEventService = new TrackEventService();
|
||||
|
||||
export const IssueProperty: React.FC<IIssueProperty> = observer((props) => {
|
||||
const { workspaceSlug, parentIssue, issue, user, editable } = props;
|
||||
|
|
@ -36,18 +34,6 @@ export const IssueProperty: React.FC<IIssueProperty> = observer((props) => {
|
|||
|
||||
const handlePriorityChange = (data: any) => {
|
||||
partialUpdateIssue({ priority: data });
|
||||
trackEventService.trackIssuePartialPropertyUpdateEvent(
|
||||
{
|
||||
workspaceSlug,
|
||||
workspaceId: issue.workspace,
|
||||
projectId: issue.project_detail.id,
|
||||
projectIdentifier: issue.project_detail.identifier,
|
||||
projectName: issue.project_detail.name,
|
||||
issueId: issue.id,
|
||||
},
|
||||
"ISSUE_PROPERTY_UPDATE_PRIORITY",
|
||||
user as IUser
|
||||
);
|
||||
};
|
||||
|
||||
const handleStateChange = (data: IState) => {
|
||||
|
|
@ -55,35 +41,10 @@ export const IssueProperty: React.FC<IIssueProperty> = observer((props) => {
|
|||
state: data.id,
|
||||
state_detail: data,
|
||||
});
|
||||
trackEventService.trackIssuePartialPropertyUpdateEvent(
|
||||
{
|
||||
workspaceSlug,
|
||||
workspaceId: issue.workspace,
|
||||
projectId: issue.project_detail.id,
|
||||
projectIdentifier: issue.project_detail.identifier,
|
||||
projectName: issue.project_detail.name,
|
||||
issueId: issue.id,
|
||||
},
|
||||
"ISSUE_PROPERTY_UPDATE_STATE",
|
||||
user as IUser
|
||||
);
|
||||
};
|
||||
|
||||
const handleAssigneeChange = (data: string[]) => {
|
||||
partialUpdateIssue({ assignees: data });
|
||||
|
||||
trackEventService.trackIssuePartialPropertyUpdateEvent(
|
||||
{
|
||||
workspaceSlug,
|
||||
workspaceId: issue.workspace,
|
||||
projectId: issue.project_detail.id,
|
||||
projectIdentifier: issue.project_detail.identifier,
|
||||
projectName: issue.project_detail.name,
|
||||
issueId: issue.id,
|
||||
},
|
||||
"ISSUE_PROPERTY_UPDATE_ASSIGNEE",
|
||||
user as IUser
|
||||
);
|
||||
};
|
||||
|
||||
const partialUpdateIssue = async (data: Partial<IIssue>) => {
|
||||
|
|
@ -100,7 +61,7 @@ export const IssueProperty: React.FC<IIssueProperty> = observer((props) => {
|
|||
false
|
||||
);
|
||||
|
||||
const issueResponse = await issueService.patchIssue(workspaceSlug as string, issue.project, issue.id, data, user);
|
||||
const issueResponse = await issueService.patchIssue(workspaceSlug as string, issue.project, issue.id, data);
|
||||
|
||||
mutate(
|
||||
SUB_ISSUES(parentIssue.id),
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export const SubIssuesRoot: React.FC<ISubIssuesRoot> = observer((props) => {
|
|||
const removeIssueFromSubIssues = async (parentIssueId: string, issue: IIssue) => {
|
||||
if (!workspaceSlug || !projectId || !parentIssue || !issue?.id) return;
|
||||
issueService
|
||||
.patchIssue(workspaceSlug.toString(), projectId.toString(), issue.id, { parent: null }, user)
|
||||
.patchIssue(workspaceSlug.toString(), projectId.toString(), issue.id, { parent: null })
|
||||
.then(async () => {
|
||||
if (parentIssueId) await mutate(SUB_ISSUES(parentIssueId));
|
||||
handleIssuesLoader({ key: "delete", issueId: issue?.id });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue