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
|
|
@ -4,7 +4,6 @@ import { observer } from "mobx-react-lite";
|
|||
import { mutate } from "swr";
|
||||
// services
|
||||
import { AnalyticsService } from "services/analytics.service";
|
||||
import { TrackEventService } from "services/track_event.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
|
|
@ -29,7 +28,6 @@ type Props = {
|
|||
};
|
||||
|
||||
const analyticsService = new AnalyticsService();
|
||||
const trackEventService = new TrackEventService();
|
||||
|
||||
export const CustomAnalyticsSidebar: React.FC<Props> = observer(
|
||||
({ analytics, params, fullScreen, isProjectLevel = false }) => {
|
||||
|
|
@ -90,18 +88,6 @@ export const CustomAnalyticsSidebar: React.FC<Props> = observer(
|
|||
eventPayload.moduleId = moduleDetails.id;
|
||||
eventPayload.moduleName = moduleDetails.name;
|
||||
}
|
||||
|
||||
trackEventService.trackAnalyticsEvent(
|
||||
eventPayload,
|
||||
cycleId
|
||||
? "CYCLE_ANALYTICS_EXPORT"
|
||||
: moduleId
|
||||
? "MODULE_ANALYTICS_EXPORT"
|
||||
: projectId
|
||||
? "PROJECT_ANALYTICS_EXPORT"
|
||||
: "WORKSPACE_ANALYTICS_EXPORT",
|
||||
user
|
||||
);
|
||||
};
|
||||
|
||||
const exportAnalytics = () => {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
import React from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Tab } from "@headlessui/react";
|
||||
// mobx store
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// services
|
||||
import { TrackEventService } from "services/track_event.service";
|
||||
// components
|
||||
import { CustomAnalytics, ScopeAndDemand } from "components/analytics";
|
||||
// types
|
||||
import { ICycle, IModule, IProject, IWorkspace } from "types";
|
||||
import { ICycle, IModule, IProject } from "types";
|
||||
// constants
|
||||
import { ANALYTICS_TABS } from "constants/analytics";
|
||||
|
||||
|
|
@ -20,63 +15,8 @@ type Props = {
|
|||
projectDetails: IProject | undefined;
|
||||
};
|
||||
|
||||
const trackEventService = new TrackEventService();
|
||||
|
||||
export const ProjectAnalyticsModalMainContent: React.FC<Props> = observer((props) => {
|
||||
const { fullScreen, cycleDetails, moduleDetails, projectDetails } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const { user: userStore } = useMobxStore();
|
||||
|
||||
const user = userStore.currentUser;
|
||||
|
||||
const trackAnalyticsEvent = (tab: string) => {
|
||||
if (!workspaceSlug || !user) return;
|
||||
|
||||
const eventPayload: any = {
|
||||
workspaceSlug: workspaceSlug.toString(),
|
||||
};
|
||||
|
||||
if (projectDetails) {
|
||||
const workspaceDetails = projectDetails.workspace as IWorkspace;
|
||||
|
||||
eventPayload.workspaceId = workspaceDetails.id;
|
||||
eventPayload.workspaceName = workspaceDetails.name;
|
||||
eventPayload.projectId = projectDetails.id;
|
||||
eventPayload.projectIdentifier = projectDetails.identifier;
|
||||
eventPayload.projectName = projectDetails.name;
|
||||
}
|
||||
|
||||
if (cycleDetails || moduleDetails) {
|
||||
const details = cycleDetails || moduleDetails;
|
||||
|
||||
eventPayload.workspaceId = details?.workspace_detail?.id;
|
||||
eventPayload.workspaceName = details?.workspace_detail?.name;
|
||||
eventPayload.projectId = details?.project_detail.id;
|
||||
eventPayload.projectIdentifier = details?.project_detail.identifier;
|
||||
eventPayload.projectName = details?.project_detail.name;
|
||||
}
|
||||
|
||||
if (cycleDetails) {
|
||||
eventPayload.cycleId = cycleDetails.id;
|
||||
eventPayload.cycleName = cycleDetails.name;
|
||||
}
|
||||
|
||||
if (moduleDetails) {
|
||||
eventPayload.moduleId = moduleDetails.id;
|
||||
eventPayload.moduleName = moduleDetails.name;
|
||||
}
|
||||
|
||||
const eventType = tab === "scope_and_demand" ? "SCOPE_AND_DEMAND_ANALYTICS" : "CUSTOM_ANALYTICS";
|
||||
|
||||
trackEventService.trackAnalyticsEvent(
|
||||
eventPayload,
|
||||
cycleDetails ? `CYCLE_${eventType}` : moduleDetails ? `MODULE_${eventType}` : `PROJECT_${eventType}`,
|
||||
user
|
||||
);
|
||||
};
|
||||
const { fullScreen, cycleDetails, moduleDetails } = props;
|
||||
|
||||
return (
|
||||
<Tab.Group as={React.Fragment}>
|
||||
|
|
@ -89,7 +29,7 @@ export const ProjectAnalyticsModalMainContent: React.FC<Props> = observer((props
|
|||
selected ? "bg-custom-background-80" : ""
|
||||
}`
|
||||
}
|
||||
onClick={() => trackAnalyticsEvent(tab.key)}
|
||||
onClick={() => {}}
|
||||
>
|
||||
{tab.title}
|
||||
</Tab>
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export const CommandModal: React.FC<Props> = observer((props) => {
|
|||
|
||||
const payload = { ...formData };
|
||||
await issueService
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload)
|
||||
.then(() => {
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
mutate(ISSUE_DETAILS(issueId as string));
|
||||
|
|
@ -134,7 +134,7 @@ export const CommandModal: React.FC<Props> = observer((props) => {
|
|||
console.error(e);
|
||||
});
|
||||
},
|
||||
[workspaceSlug, issueId, projectId, user]
|
||||
[workspaceSlug, issueId, projectId]
|
||||
);
|
||||
|
||||
const handleIssueAssignees = (assignee: string) => {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type Props = {
|
|||
const issueService = new IssueService();
|
||||
|
||||
export const ChangeIssueAssignee: FC<Props> = observer((props) => {
|
||||
const { setIsPaletteOpen, issue, user } = props;
|
||||
const { setIsPaletteOpen, issue } = props;
|
||||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, issueId } = router.query;
|
||||
|
|
@ -71,7 +71,7 @@ export const ChangeIssueAssignee: FC<Props> = observer((props) => {
|
|||
|
||||
const payload = { ...formData };
|
||||
await issueService
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload)
|
||||
.then(() => {
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
})
|
||||
|
|
@ -79,7 +79,7 @@ export const ChangeIssueAssignee: FC<Props> = observer((props) => {
|
|||
console.error(e);
|
||||
});
|
||||
},
|
||||
[workspaceSlug, issueId, projectId, user]
|
||||
[workspaceSlug, issueId, projectId]
|
||||
);
|
||||
|
||||
const handleIssueAssignees = (assignee: string) => {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
import React, { Dispatch, SetStateAction, useCallback } from "react";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import { mutate } from "swr";
|
||||
|
||||
// cmdk
|
||||
import { Command } from "cmdk";
|
||||
// services
|
||||
|
|
@ -26,7 +23,7 @@ type Props = {
|
|||
// services
|
||||
const issueService = new IssueService();
|
||||
|
||||
export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue, user }) => {
|
||||
export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue }) => {
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, issueId } = router.query;
|
||||
|
||||
|
|
@ -49,7 +46,7 @@ export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue,
|
|||
|
||||
const payload = { ...formData };
|
||||
await issueService
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload)
|
||||
.then(() => {
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
})
|
||||
|
|
@ -57,7 +54,7 @@ export const ChangeIssuePriority: React.FC<Props> = ({ setIsPaletteOpen, issue,
|
|||
console.error(e);
|
||||
});
|
||||
},
|
||||
[workspaceSlug, issueId, projectId, user]
|
||||
[workspaceSlug, issueId, projectId]
|
||||
);
|
||||
|
||||
const handleIssueState = (priority: TIssuePriorities) => {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type Props = {
|
|||
const issueService = new IssueService();
|
||||
const stateService = new ProjectStateService();
|
||||
|
||||
export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue, user }) => {
|
||||
export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue }) => {
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, issueId } = router.query;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue, use
|
|||
|
||||
const payload = { ...formData };
|
||||
await issueService
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload, user)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, issueId as string, payload)
|
||||
.then(() => {
|
||||
mutateStates();
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
|
|
@ -61,7 +61,7 @@ export const ChangeIssueState: React.FC<Props> = ({ setIsPaletteOpen, issue, use
|
|||
console.error(e);
|
||||
});
|
||||
},
|
||||
[workspaceSlug, issueId, projectId, mutateStates, user]
|
||||
[workspaceSlug, issueId, projectId, mutateStates]
|
||||
);
|
||||
|
||||
const handleIssueState = (stateId: string) => {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ type Props = {
|
|||
const issueService = new IssueService();
|
||||
|
||||
export const BulkDeleteIssuesModal: React.FC<Props> = (props) => {
|
||||
const { isOpen, onClose, user } = props;
|
||||
const { isOpen, onClose } = props;
|
||||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
|
@ -78,14 +78,9 @@ export const BulkDeleteIssuesModal: React.FC<Props> = (props) => {
|
|||
if (!Array.isArray(data.delete_issue_ids)) data.delete_issue_ids = [data.delete_issue_ids];
|
||||
|
||||
await issueService
|
||||
.bulkDeleteIssues(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
issue_ids: data.delete_issue_ids,
|
||||
},
|
||||
user
|
||||
)
|
||||
.bulkDeleteIssues(workspaceSlug as string, projectId as string, {
|
||||
issue_ids: data.delete_issue_ids,
|
||||
})
|
||||
.then(() => {
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ import { useRouter } from "next/router";
|
|||
import { Controller, useForm } from "react-hook-form";
|
||||
// services
|
||||
import { AIService } from "services/ai.service";
|
||||
import { TrackEventService } from "services/track_event.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
// ui
|
||||
import { Button, Input } from "@plane/ui";
|
||||
// components
|
||||
|
|
@ -34,27 +32,15 @@ type FormData = {
|
|||
|
||||
// services
|
||||
const aiService = new AIService();
|
||||
const trackEventService = new TrackEventService();
|
||||
|
||||
export const GptAssistantModal: React.FC<Props> = ({
|
||||
isOpen,
|
||||
handleClose,
|
||||
inset = "top-0 left-0",
|
||||
content,
|
||||
htmlContent,
|
||||
onResponse,
|
||||
projectId,
|
||||
block,
|
||||
issue,
|
||||
}) => {
|
||||
export const GptAssistantModal: React.FC<Props> = (props) => {
|
||||
const { isOpen, handleClose, inset = "top-0 left-0", content, htmlContent, onResponse, projectId } = props;
|
||||
const [response, setResponse] = useState("");
|
||||
const [invalidResponse, setInvalidResponse] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const editorRef = useRef<any>(null);
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
|
@ -92,15 +78,10 @@ export const GptAssistantModal: React.FC<Props> = ({
|
|||
}
|
||||
|
||||
await aiService
|
||||
.createGptTask(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
prompt: content && content !== "" ? content : htmlContent ?? "",
|
||||
task: formData.task,
|
||||
},
|
||||
user
|
||||
)
|
||||
.createGptTask(workspaceSlug as string, projectId as string, {
|
||||
prompt: content && content !== "" ? content : htmlContent ?? "",
|
||||
task: formData.task,
|
||||
})
|
||||
.then((res) => {
|
||||
setResponse(res.response_html);
|
||||
setFocus("task");
|
||||
|
|
@ -193,10 +174,6 @@ export const GptAssistantModal: React.FC<Props> = ({
|
|||
onClick={() => {
|
||||
onResponse(response);
|
||||
onClose();
|
||||
if (block && user)
|
||||
trackEventService.trackUseGPTResponseEvent(block, "USE_GPT_RESPONSE_IN_PAGE_BLOCK", user);
|
||||
else if (issue && user)
|
||||
trackEventService.trackUseGPTResponseEvent(issue, "USE_GPT_RESPONSE_IN_ISSUE", user);
|
||||
}}
|
||||
>
|
||||
Use this response
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import useUser from "hooks/use-user";
|
|||
import useProjectDetails from "hooks/use-project-details";
|
||||
// components
|
||||
import { GanttChartRoot, IBlockUpdateData, CycleGanttSidebar } from "components/gantt-chart";
|
||||
import { CycleGanttBlock, CycleGanttSidebarBlock } from "components/cycles";
|
||||
import { CycleGanttBlock } from "components/cycles";
|
||||
// types
|
||||
import { ICycle } from "types";
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export const CyclesListGanttChartView: FC<Props> = ({ cycles, mutateCycles }) =>
|
|||
|
||||
if (newPayload.sort_order && payload.sort_order) newPayload.sort_order = payload.sort_order.newSortOrder;
|
||||
|
||||
cycleService.patchCycle(workspaceSlug.toString(), cycle.project, cycle.id, newPayload, user);
|
||||
cycleService.patchCycle(workspaceSlug.toString(), cycle.project, cycle.id, newPayload);
|
||||
};
|
||||
|
||||
const blockFormat = (blocks: ICycle[]) =>
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, peekCycle } = router.query;
|
||||
|
||||
const { user: userStore, cycle: cycleDetailsStore } = useMobxStore();
|
||||
const { cycle: cycleDetailsStore } = useMobxStore();
|
||||
|
||||
const user = userStore.currentUser ?? undefined;
|
||||
const cycleDetails = cycleDetailsStore.cycle_details[cycleId] ?? undefined;
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
|
@ -74,7 +73,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
mutate<ICycle>(CYCLE_DETAILS(cycleId as string), (prevData) => ({ ...(prevData as ICycle), ...data }), false);
|
||||
|
||||
cycleService
|
||||
.patchCycle(workspaceSlug as string, projectId as string, cycleId as string, data, user)
|
||||
.patchCycle(workspaceSlug as string, projectId as string, cycleId as string, data)
|
||||
.then(() => mutate(CYCLE_DETAILS(cycleId as string)))
|
||||
.catch((e) => console.log(e));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export const Exporter: React.FC<Props> = observer((props) => {
|
|||
multiple: multiple,
|
||||
};
|
||||
await projectExportService
|
||||
.csvExport(workspaceSlug as string, payload, user)
|
||||
.csvExport(workspaceSlug as string, payload)
|
||||
.then(() => {
|
||||
mutateServices();
|
||||
router.push(`/${workspaceSlug}/settings/exports`);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
|
|||
if (!workspaceSlug || !projectId || !inboxIssueId || !user) return;
|
||||
|
||||
await issueCommentService
|
||||
.patchIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, data, user)
|
||||
.patchIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, data)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
|
|||
mutateIssueActivity((prevData: any) => prevData?.filter((p: any) => p.id !== commentId), false);
|
||||
|
||||
await issueCommentService
|
||||
.deleteIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId, user)
|
||||
.deleteIssueComment(workspaceSlug as string, projectId as string, inboxIssueId as string, commentId)
|
||||
.then(() => mutateIssueActivity());
|
||||
};
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ export const InboxIssueActivity: React.FC<Props> = observer(({ issueDetails }) =
|
|||
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));
|
||||
})
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type Props = {
|
|||
// services
|
||||
const integrationService = new IntegrationService();
|
||||
|
||||
export const DeleteImportModal: React.FC<Props> = ({ isOpen, handleClose, data, user }) => {
|
||||
export const DeleteImportModal: React.FC<Props> = ({ isOpen, handleClose, data }) => {
|
||||
const [deleteLoading, setDeleteLoading] = useState(false);
|
||||
const [confirmDeleteImport, setConfirmDeleteImport] = useState(false);
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ export const DeleteImportModal: React.FC<Props> = ({ isOpen, handleClose, data,
|
|||
);
|
||||
|
||||
integrationService
|
||||
.deleteImporterService(workspaceSlug as string, data.service, data.id, user)
|
||||
.deleteImporterService(workspaceSlug as string, data.service, data.id)
|
||||
.catch(() =>
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ type Props = {
|
|||
const integrationService = new IntegrationService();
|
||||
const githubIntegrationService = new GithubIntegrationService();
|
||||
|
||||
export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
export const GithubImporterRoot: React.FC<Props> = () => {
|
||||
const [currentStep, setCurrentStep] = useState<IIntegrationData>({
|
||||
state: "import-configure",
|
||||
});
|
||||
|
|
@ -147,7 +147,7 @@ export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
|||
};
|
||||
|
||||
await githubIntegrationService
|
||||
.createGithubServiceImport(workspaceSlug as string, payload, user)
|
||||
.createGithubServiceImport(workspaceSlug as string, payload)
|
||||
.then(() => {
|
||||
router.push(`/${workspaceSlug}/settings/imports`);
|
||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string));
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ type Props = {
|
|||
// services
|
||||
const jiraImporterService = new JiraImporterService();
|
||||
|
||||
export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
export const JiraImporterRoot: React.FC<Props> = () => {
|
||||
const [currentStep, setCurrentStep] = useState<IJiraIntegrationData>({
|
||||
state: "import-configure",
|
||||
});
|
||||
|
|
@ -81,7 +81,7 @@ export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
|||
if (!workspaceSlug) return;
|
||||
|
||||
await jiraImporterService
|
||||
.createJiraImporter(workspaceSlug.toString(), data, user)
|
||||
.createJiraImporter(workspaceSlug.toString(), data)
|
||||
.then(() => {
|
||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug.toString()));
|
||||
router.push(`/${workspaceSlug}/settings/imports`);
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
|
||||
const { module: moduleStore, user: userStore } = useMobxStore();
|
||||
|
||||
const user = userStore.currentUser ?? undefined;
|
||||
const userRole = userStore.currentProjectRole;
|
||||
const moduleDetails = moduleStore.moduleDetails[moduleId] ?? undefined;
|
||||
|
||||
|
|
@ -80,7 +79,7 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
);
|
||||
|
||||
moduleService
|
||||
.patchModule(workspaceSlug as string, projectId as string, moduleId as string, data, user)
|
||||
.patchModule(workspaceSlug as string, projectId as string, moduleId as string, data)
|
||||
.then(() => mutate(MODULE_DETAILS(moduleId as string)))
|
||||
.catch((e) => console.log(e));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ const InviteMemberForm: React.FC<InviteMemberFormProps> = (props) => {
|
|||
};
|
||||
|
||||
export const InviteMembers: React.FC<Props> = (props) => {
|
||||
const { finishOnboarding, stepChange, user, workspace } = props;
|
||||
const { finishOnboarding, stepChange, workspace } = props;
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ export const InviteMembers: React.FC<Props> = (props) => {
|
|||
const payload = { ...formData };
|
||||
|
||||
await workspaceService
|
||||
.inviteWorkspace(workspace.slug, payload, user)
|
||||
.inviteWorkspace(workspace.slug, payload)
|
||||
.then(async () => {
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { IWorkspaceMemberInvitation, TOnboardingSteps } from "types";
|
|||
import { USER_WORKSPACES, USER_WORKSPACE_INVITATIONS } from "constants/fetch-keys";
|
||||
// constants
|
||||
import { ROLE } from "constants/workspace";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
finishOnboarding: () => Promise<void>;
|
||||
|
|
@ -61,7 +62,11 @@ export const JoinWorkspaces: React.FC<Props> = ({ finishOnboarding, stepChange,
|
|||
|
||||
await workspaceService
|
||||
.joinWorkspaces({ invitations: invitationsRespond })
|
||||
.then(async () => {
|
||||
.then(async (res) => {
|
||||
trackEvent(
|
||||
'WORKSPACE_USER_INVITE_ACCEPT',
|
||||
res
|
||||
)
|
||||
await mutateInvitations();
|
||||
await mutate(USER_WORKSPACES);
|
||||
await updateLastWorkspace();
|
||||
|
|
@ -83,9 +88,8 @@ export const JoinWorkspaces: React.FC<Props> = ({ finishOnboarding, stepChange,
|
|||
return (
|
||||
<div
|
||||
key={invitation.id}
|
||||
className={`flex cursor-pointer items-center gap-2 border py-5 px-3.5 rounded ${
|
||||
isSelected ? "border-custom-primary-100" : "border-custom-border-200 hover:bg-custom-background-80"
|
||||
}`}
|
||||
className={`flex cursor-pointer items-center gap-2 border py-5 px-3.5 rounded ${isSelected ? "border-custom-primary-100" : "border-custom-border-200 hover:bg-custom-background-80"
|
||||
}`}
|
||||
onClick={() => handleInvitation(invitation, isSelected ? "withdraw" : "accepted")}
|
||||
>
|
||||
<div className="flex-shrink-0">
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type Props = {
|
|||
|
||||
const pageService = new PageService();
|
||||
|
||||
export const CreateBlock: FC<Props> = ({ user }) => {
|
||||
export const CreateBlock: FC<Props> = () => {
|
||||
// const [blockTitle, setBlockTitle] = useState("");
|
||||
// router
|
||||
const router = useRouter();
|
||||
|
|
@ -46,15 +46,9 @@ export const CreateBlock: FC<Props> = ({ user }) => {
|
|||
if (!workspaceSlug || !projectId || !pageId) return;
|
||||
|
||||
await pageService
|
||||
.createPageBlock(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
pageId as string,
|
||||
{
|
||||
name: watch("name"),
|
||||
},
|
||||
user
|
||||
)
|
||||
.createPageBlock(workspaceSlug as string, projectId as string, pageId as string, {
|
||||
name: watch("name"),
|
||||
})
|
||||
.then((res) => {
|
||||
mutate<IPageBlock[]>(
|
||||
PAGE_BLOCKS_LIST(pageId as string),
|
||||
|
|
|
|||
|
|
@ -40,14 +40,7 @@ const pagesService = new PageService();
|
|||
const issueService = new IssueService();
|
||||
const fileService = new FileService();
|
||||
|
||||
export const CreateUpdateBlockInline: FC<Props> = ({
|
||||
handleClose,
|
||||
data,
|
||||
handleAiAssistance,
|
||||
setIsSyncing,
|
||||
focus,
|
||||
user,
|
||||
}) => {
|
||||
export const CreateUpdateBlockInline: FC<Props> = ({ handleClose, data, handleAiAssistance, setIsSyncing, focus }) => {
|
||||
const [iAmFeelingLucky, setIAmFeelingLucky] = useState(false);
|
||||
const [gptAssistantModal, setGptAssistantModal] = useState(false);
|
||||
|
||||
|
|
@ -83,17 +76,11 @@ export const CreateUpdateBlockInline: FC<Props> = ({
|
|||
if (!workspaceSlug || !projectId || !pageId) return;
|
||||
|
||||
await pagesService
|
||||
.createPageBlock(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
pageId as string,
|
||||
{
|
||||
name: formData.name,
|
||||
description: formData.description ?? "",
|
||||
description_html: formData.description_html ?? "<p></p>",
|
||||
},
|
||||
user
|
||||
)
|
||||
.createPageBlock(workspaceSlug as string, projectId as string, pageId as string, {
|
||||
name: formData.name,
|
||||
description: formData.description ?? "",
|
||||
description_html: formData.description_html ?? "<p></p>",
|
||||
})
|
||||
.then((res) => {
|
||||
mutate<IPageBlock[]>(
|
||||
PAGE_BLOCKS_LIST(pageId as string),
|
||||
|
|
@ -111,7 +98,7 @@ export const CreateUpdateBlockInline: FC<Props> = ({
|
|||
})
|
||||
.finally(() => onClose());
|
||||
},
|
||||
[workspaceSlug, projectId, pageId, onClose, setToastAlert, user]
|
||||
[workspaceSlug, projectId, pageId, onClose, setToastAlert]
|
||||
);
|
||||
|
||||
const updatePageBlock = useCallback(
|
||||
|
|
@ -132,41 +119,28 @@ export const CreateUpdateBlockInline: FC<Props> = ({
|
|||
);
|
||||
|
||||
await pagesService
|
||||
.patchPageBlock(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
pageId as string,
|
||||
data.id,
|
||||
{
|
||||
name: formData.name,
|
||||
description: formData.description,
|
||||
description_html: formData.description_html,
|
||||
},
|
||||
user
|
||||
)
|
||||
.patchPageBlock(workspaceSlug as string, projectId as string, pageId as string, data.id, {
|
||||
name: formData.name,
|
||||
description: formData.description,
|
||||
description_html: formData.description_html,
|
||||
})
|
||||
.then((res) => {
|
||||
mutate(PAGE_BLOCKS_LIST(pageId as string));
|
||||
editorRef.current?.setEditorValue(res.description_html);
|
||||
if (data.issue && data.sync)
|
||||
issueService
|
||||
.patchIssue(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
data.issue,
|
||||
{
|
||||
name: res.name,
|
||||
description: res.description,
|
||||
description_html: res.description_html,
|
||||
},
|
||||
user
|
||||
)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, data.issue, {
|
||||
name: res.name,
|
||||
description: res.description,
|
||||
description_html: res.description_html,
|
||||
})
|
||||
.finally(() => {
|
||||
if (setIsSyncing) setIsSyncing(false);
|
||||
});
|
||||
})
|
||||
.finally(() => onClose());
|
||||
},
|
||||
[workspaceSlug, projectId, pageId, data, onClose, setIsSyncing, user]
|
||||
[workspaceSlug, projectId, pageId, data, onClose, setIsSyncing]
|
||||
);
|
||||
|
||||
const handleAutoGenerateDescription = async () => {
|
||||
|
|
@ -175,15 +149,10 @@ export const CreateUpdateBlockInline: FC<Props> = ({
|
|||
setIAmFeelingLucky(true);
|
||||
|
||||
aiService
|
||||
.createGptTask(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
prompt: watch("name"),
|
||||
task: "Generate a proper description for this issue.",
|
||||
},
|
||||
user
|
||||
)
|
||||
.createGptTask(workspaceSlug as string, projectId as string, {
|
||||
prompt: watch("name"),
|
||||
task: "Generate a proper description for this issue.",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.response === "")
|
||||
setToastAlert({
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
import React from "react";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import { mutate } from "swr";
|
||||
|
||||
// headless ui
|
||||
import { Dialog, Transition } from "@headlessui/react";
|
||||
// services
|
||||
import { PageService } from "services/page.service";
|
||||
|
|
@ -16,6 +12,7 @@ import { PageForm } from "./page-form";
|
|||
import { IUser, IPage } from "types";
|
||||
// fetch-keys
|
||||
import { ALL_PAGES_LIST, FAVORITE_PAGES_LIST, MY_PAGES_LIST, RECENT_PAGES_LIST } from "constants/fetch-keys";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -30,7 +27,7 @@ type Props = {
|
|||
const pageService = new PageService();
|
||||
|
||||
export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
||||
const { isOpen, handleClose, data, user, workspaceSlug, projectId } = props;
|
||||
const { isOpen, handleClose, data, workspaceSlug, projectId } = props;
|
||||
// router
|
||||
const router = useRouter();
|
||||
|
||||
|
|
@ -42,7 +39,7 @@ export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
|||
|
||||
const createPage = async (payload: IPage) => {
|
||||
await pageService
|
||||
.createPage(workspaceSlug as string, projectId as string, payload, user)
|
||||
.createPage(workspaceSlug as string, projectId as string, payload)
|
||||
.then((res) => {
|
||||
mutate(RECENT_PAGES_LIST(projectId as string));
|
||||
mutate<IPage[]>(
|
||||
|
|
@ -64,14 +61,19 @@ export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
|||
false
|
||||
);
|
||||
onClose();
|
||||
|
||||
router.push(`/${workspaceSlug}/projects/${projectId}/pages/${res.id}`);
|
||||
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
message: "Page created successfully.",
|
||||
});
|
||||
trackEvent(
|
||||
'PAGE_CREATE',
|
||||
{
|
||||
...res,
|
||||
caase: "SUCCES"
|
||||
}
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
|
|
@ -79,12 +81,18 @@ export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
|||
title: "Error!",
|
||||
message: "Page could not be created. Please try again.",
|
||||
});
|
||||
trackEvent(
|
||||
'PAGE_CREATE',
|
||||
{
|
||||
case: "FAILED"
|
||||
}
|
||||
)
|
||||
});
|
||||
};
|
||||
|
||||
const updatePage = async (payload: IPage) => {
|
||||
await pageService
|
||||
.patchPage(workspaceSlug as string, projectId as string, data?.id ?? "", payload, user)
|
||||
.patchPage(workspaceSlug as string, projectId as string, data?.id ?? "", payload)
|
||||
.then((res) => {
|
||||
mutate(RECENT_PAGES_LIST(projectId as string));
|
||||
mutate<IPage[]>(
|
||||
|
|
@ -124,6 +132,13 @@ export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
|||
title: "Success!",
|
||||
message: "Page updated successfully.",
|
||||
});
|
||||
trackEvent(
|
||||
'PAGE_UPDATE',
|
||||
{
|
||||
...res,
|
||||
case: "SUCCESS"
|
||||
}
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
|
|
@ -131,6 +146,12 @@ export const CreateUpdatePageModal: React.FC<Props> = (props) => {
|
|||
title: "Error!",
|
||||
message: "Page could not be updated. Please try again.",
|
||||
});
|
||||
trackEvent(
|
||||
'PAGE_UPDATE',
|
||||
{
|
||||
case: "FAILED"
|
||||
}
|
||||
)
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type TConfirmPageDeletionProps = {
|
|||
// services
|
||||
const pageService = new PageService();
|
||||
|
||||
export const DeletePageModal: React.FC<TConfirmPageDeletionProps> = ({ isOpen, setIsOpen, data, user }) => {
|
||||
export const DeletePageModal: React.FC<TConfirmPageDeletionProps> = ({ isOpen, setIsOpen, data }) => {
|
||||
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
|
|
@ -47,7 +47,7 @@ export const DeletePageModal: React.FC<TConfirmPageDeletionProps> = ({ isOpen, s
|
|||
if (!data || !workspaceSlug || !projectId) return;
|
||||
|
||||
await pageService
|
||||
.deletePage(workspaceSlug as string, data.project, data.id, user)
|
||||
.deletePage(workspaceSlug as string, data.project, data.id)
|
||||
.then(() => {
|
||||
mutate(RECENT_PAGES_LIST(projectId as string));
|
||||
mutate<IPage[]>(
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export const PagesView: React.FC<Props> = observer(({ pages, viewType }) => {
|
|||
false
|
||||
);
|
||||
|
||||
pageService.patchPage(workspaceSlug.toString(), projectId.toString(), page.id, formData, user).then(() => {
|
||||
pageService.patchPage(workspaceSlug.toString(), projectId.toString(), page.id, formData).then(() => {
|
||||
mutate(RECENT_PAGES_LIST(projectId.toString()));
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -85,33 +85,20 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, showBl
|
|||
);
|
||||
|
||||
await pageService
|
||||
.patchPageBlock(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
pageId as string,
|
||||
block.id,
|
||||
{
|
||||
name: formData.name,
|
||||
description: formData.description,
|
||||
description_html: formData.description_html,
|
||||
},
|
||||
user
|
||||
)
|
||||
.patchPageBlock(workspaceSlug as string, projectId as string, pageId as string, block.id, {
|
||||
name: formData.name,
|
||||
description: formData.description,
|
||||
description_html: formData.description_html,
|
||||
})
|
||||
.then((res) => {
|
||||
mutate(PAGE_BLOCKS_LIST(pageId as string));
|
||||
if (block.issue && block.sync)
|
||||
issueService
|
||||
.patchIssue(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
block.issue,
|
||||
{
|
||||
name: res.name,
|
||||
description: res.description,
|
||||
description_html: res.description_html,
|
||||
},
|
||||
user
|
||||
)
|
||||
.patchIssue(workspaceSlug as string, projectId as string, block.issue, {
|
||||
name: res.name,
|
||||
description: res.description,
|
||||
description_html: res.description_html,
|
||||
})
|
||||
.finally(() => setIsSyncing(false));
|
||||
});
|
||||
};
|
||||
|
|
@ -120,7 +107,7 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, showBl
|
|||
if (!workspaceSlug || !projectId || !pageId) return;
|
||||
|
||||
await pageService
|
||||
.convertPageBlockToIssue(workspaceSlug as string, projectId as string, pageId as string, block.id, user)
|
||||
.convertPageBlockToIssue(workspaceSlug as string, projectId as string, pageId as string, block.id)
|
||||
.then((res: IIssue) => {
|
||||
mutate<IPageBlock[]>(
|
||||
PAGE_BLOCKS_LIST(pageId as string),
|
||||
|
|
@ -158,7 +145,7 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, showBl
|
|||
);
|
||||
|
||||
await pageService
|
||||
.deletePageBlock(workspaceSlug as string, projectId as string, pageId as string, block.id, user)
|
||||
.deletePageBlock(workspaceSlug as string, projectId as string, pageId as string, block.id)
|
||||
.catch(() => {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -174,15 +161,10 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, showBl
|
|||
setIAmFeelingLucky(true);
|
||||
|
||||
aiService
|
||||
.createGptTask(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
{
|
||||
prompt: block.name,
|
||||
task: "Generate a proper description for this issue.",
|
||||
},
|
||||
user
|
||||
)
|
||||
.createGptTask(workspaceSlug as string, projectId as string, {
|
||||
prompt: block.name,
|
||||
task: "Generate a proper description for this issue.",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.response === "")
|
||||
setToastAlert({
|
||||
|
|
@ -246,16 +228,9 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, showBl
|
|||
false
|
||||
);
|
||||
|
||||
pageService.patchPageBlock(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
pageId as string,
|
||||
block.id,
|
||||
{
|
||||
sync: !block.sync,
|
||||
},
|
||||
user
|
||||
);
|
||||
pageService.patchPageBlock(workspaceSlug as string, projectId as string, pageId as string, block.id, {
|
||||
sync: !block.sync,
|
||||
});
|
||||
};
|
||||
|
||||
const handleCopyText = () => {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import { getRandomEmoji, renderEmoji } from "helpers/emoji.helper";
|
|||
import { IWorkspaceMember } from "types";
|
||||
// constants
|
||||
import { NETWORK_CHOICES, PROJECT_UNSPLASH_COVERS } from "constants/project";
|
||||
// track events
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -129,6 +131,14 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
|
|||
return projectStore
|
||||
.createProject(workspaceSlug.toString(), payload)
|
||||
.then((res) => {
|
||||
const newPayload = {
|
||||
...payload,
|
||||
id: res.id
|
||||
}
|
||||
trackEvent(
|
||||
"CREATE_PROJECT",
|
||||
newPayload,
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -211,7 +221,7 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
|
|||
)}
|
||||
|
||||
<div className="absolute right-2 top-2 p-2">
|
||||
<button type="button" onClick={handleClose}>
|
||||
<button data-posthog="PROJECT_MODAL_CLOSE" type="button" onClick={handleClose}>
|
||||
<X className="h-5 w-5 text-white" />
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Button, Input } from "@plane/ui";
|
|||
import type { IProject } from "types";
|
||||
// fetch-keys
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type DeleteProjectModal = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -62,6 +63,9 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
|
|||
if (projectId && projectId.toString() === project.id) router.push(`/${workspaceSlug}/projects`);
|
||||
|
||||
handleClose();
|
||||
trackEvent(
|
||||
'DELETE_PROJECT'
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -69,6 +73,9 @@ export const DeleteProjectModal: React.FC<DeleteProjectModal> = (props) => {
|
|||
});
|
||||
})
|
||||
.catch(() => {
|
||||
trackEvent(
|
||||
'DELETE_PROJECT/FAIL'
|
||||
)
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { ProjectService } from "services/project";
|
|||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
export interface IProjectDetailsForm {
|
||||
project: IProject;
|
||||
|
|
@ -61,7 +62,11 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
|
|||
|
||||
return projectStore
|
||||
.updateProject(workspaceSlug.toString(), project.id, payload)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
trackEvent(
|
||||
'UPDATE_PROJECT',
|
||||
res
|
||||
);
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -69,6 +74,9 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
|
|||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
trackEvent(
|
||||
'UPDATE_PROJECT/FAIL',
|
||||
);
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { IUser, TUserProjectRole } from "types";
|
|||
import { WORKSPACE_MEMBERS } from "constants/fetch-keys";
|
||||
// constants
|
||||
import { ROLE } from "constants/workspace";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -52,7 +53,7 @@ const projectMemberService = new ProjectMemberService();
|
|||
const workspaceService = new WorkspaceService();
|
||||
|
||||
export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
|
||||
const { isOpen, setIsOpen, members, user, onSuccess } = props;
|
||||
const { isOpen, setIsOpen, members, onSuccess } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
|
@ -91,9 +92,12 @@ export const SendProjectInvitationModal: React.FC<Props> = observer((props) => {
|
|||
const payload = { ...formData };
|
||||
|
||||
await projectMemberService
|
||||
.bulkAddMembersToProject(workspaceSlug.toString(), projectId.toString(), payload, user)
|
||||
.then(() => {
|
||||
.bulkAddMembersToProject(workspaceSlug.toString(), projectId.toString(), payload)
|
||||
.then((res) => {
|
||||
setIsOpen(false);
|
||||
trackEvent(
|
||||
'PROJECT_MEMBER_INVITE',
|
||||
)
|
||||
setToastAlert({
|
||||
title: "Success",
|
||||
type: "success",
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import { ContrastIcon, FileText, Inbox, Layers } from "lucide-react";
|
|||
import { DiceIcon, ToggleSwitch } from "@plane/ui";
|
||||
// mobx store
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// services
|
||||
import { MiscellaneousEventType, TrackEventService } from "services/track_event.service";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
// types
|
||||
|
|
@ -47,26 +45,6 @@ const PROJECT_FEATURES_LIST = [
|
|||
},
|
||||
];
|
||||
|
||||
const getEventType = (feature: string, toggle: boolean): MiscellaneousEventType => {
|
||||
switch (feature) {
|
||||
case "Cycles":
|
||||
return toggle ? "TOGGLE_CYCLE_ON" : "TOGGLE_CYCLE_OFF";
|
||||
case "Modules":
|
||||
return toggle ? "TOGGLE_MODULE_ON" : "TOGGLE_MODULE_OFF";
|
||||
case "Views":
|
||||
return toggle ? "TOGGLE_VIEW_ON" : "TOGGLE_VIEW_OFF";
|
||||
case "Pages":
|
||||
return toggle ? "TOGGLE_PAGES_ON" : "TOGGLE_PAGES_OFF";
|
||||
case "Inbox":
|
||||
return toggle ? "TOGGLE_INBOX_ON" : "TOGGLE_INBOX_OFF";
|
||||
default:
|
||||
throw new Error("Invalid feature");
|
||||
}
|
||||
};
|
||||
|
||||
// services
|
||||
const trackEventService = new TrackEventService();
|
||||
|
||||
export const ProjectFeaturesList: FC<Props> = observer(() => {
|
||||
// router
|
||||
const router = useRouter();
|
||||
|
|
@ -109,17 +87,6 @@ export const ProjectFeaturesList: FC<Props> = observer(() => {
|
|||
<ToggleSwitch
|
||||
value={currentProjectDetails?.[feature.property as keyof IProject]}
|
||||
onChange={() => {
|
||||
trackEventService.trackMiscellaneousEvent(
|
||||
{
|
||||
workspaceId: (currentProjectDetails?.workspace as any)?.id,
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
projectIdentifier: currentProjectDetails?.identifier,
|
||||
projectName: currentProjectDetails?.name,
|
||||
},
|
||||
getEventType(feature.title, !currentProjectDetails?.[feature.property as keyof IProject]),
|
||||
currentUser
|
||||
);
|
||||
handleSubmit({
|
||||
[feature.property]: !currentProjectDetails?.[feature.property as keyof IProject],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import type { IState } from "types";
|
|||
import { STATES_LIST } from "constants/fetch-keys";
|
||||
// constants
|
||||
import { GROUP_CHOICES } from "constants/project";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
data: IState | null;
|
||||
|
|
@ -87,8 +88,12 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
|||
|
||||
await projectStateStore
|
||||
.createState(workspaceSlug.toString(), projectId.toString(), formData)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
handleClose();
|
||||
trackEvent(
|
||||
'STATE_CREATE',
|
||||
res
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -116,10 +121,13 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
|||
|
||||
await projectStateStore
|
||||
.updateState(workspaceSlug.toString(), projectId.toString(), data.id, formData)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
mutate(STATES_LIST(projectId.toString()));
|
||||
handleClose();
|
||||
|
||||
trackEvent(
|
||||
'STATE_UPDATE',
|
||||
res
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -161,9 +169,8 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
|||
{({ open }) => (
|
||||
<>
|
||||
<Popover.Button
|
||||
className={`group inline-flex items-center text-base font-medium focus:outline-none ${
|
||||
open ? "text-custom-text-100" : "text-custom-text-200"
|
||||
}`}
|
||||
className={`group inline-flex items-center text-base font-medium focus:outline-none ${open ? "text-custom-text-100" : "text-custom-text-200"
|
||||
}`}
|
||||
>
|
||||
{watch("color") && watch("color") !== "" && (
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import useToast from "hooks/use-toast";
|
|||
import { Button } from "@plane/ui";
|
||||
// types
|
||||
import type { IState } from "types";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -47,7 +48,10 @@ export const DeleteStateModal: React.FC<Props> = observer((props) => {
|
|||
|
||||
await projectStateStore
|
||||
.deleteState(workspaceSlug.toString(), data.project, data.id)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
trackEvent(
|
||||
'STATE_DELETE',
|
||||
)
|
||||
handleClose();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import { Button, CustomSelect, Input } from "@plane/ui";
|
|||
import { IWorkspace } from "types";
|
||||
// constants
|
||||
import { ORGANIZATION_SIZE, RESTRICTED_URLS } from "constants/workspace";
|
||||
// events
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
onSubmit?: (res: IWorkspace) => Promise<void>;
|
||||
|
|
@ -71,6 +73,16 @@ export const CreateWorkspaceForm: FC<Props> = observer((props) => {
|
|||
await workspaceStore
|
||||
.createWorkspace(formData)
|
||||
.then(async (res) => {
|
||||
const payload = {
|
||||
name: formData.name,
|
||||
slug: formData.slug,
|
||||
workspace_url: formData.url,
|
||||
organization_size: formData.organization_size
|
||||
};
|
||||
trackEvent(
|
||||
"CREATE_WORKSPACE",
|
||||
payload
|
||||
)
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import useToast from "hooks/use-toast";
|
|||
import { Button, Input } from "@plane/ui";
|
||||
// types
|
||||
import type { IWorkspace } from "types";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
|
|
@ -57,11 +58,17 @@ export const DeleteWorkspaceModal: React.FC<Props> = observer((props) => {
|
|||
|
||||
await workspaceStore
|
||||
.deleteWorkspace(data.slug)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
handleClose();
|
||||
|
||||
console.log('DELETE WORKPSACE', res);
|
||||
router.push("/");
|
||||
|
||||
const payload = {
|
||||
slug: data.slug
|
||||
};
|
||||
trackEvent(
|
||||
'DELETE_WORKSPACE',
|
||||
payload
|
||||
);
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { Button, CustomSelect, Input, Spinner } from "@plane/ui";
|
|||
import { IWorkspace } from "types";
|
||||
// constants
|
||||
import { ORGANIZATION_SIZE } from "constants/workspace";
|
||||
import { trackEvent } from "helpers/event-tracker.helper";
|
||||
|
||||
const defaultValues: Partial<IWorkspace> = {
|
||||
name: "",
|
||||
|
|
@ -66,12 +67,17 @@ export const WorkspaceDetails: FC = observer(() => {
|
|||
};
|
||||
|
||||
await updateWorkspace(currentWorkspace.slug, payload)
|
||||
.then(() =>
|
||||
.then((res) => {
|
||||
trackEvent(
|
||||
'UPDATE_WORKSPACE',
|
||||
res
|
||||
)
|
||||
setToastAlert({
|
||||
title: "Success",
|
||||
type: "success",
|
||||
message: "Workspace updated successfully",
|
||||
})
|
||||
}
|
||||
)
|
||||
.catch((err) => console.error(err));
|
||||
};
|
||||
|
|
@ -83,7 +89,7 @@ export const WorkspaceDetails: FC = observer(() => {
|
|||
|
||||
fileService.deleteFile(currentWorkspace.id, url).then(() => {
|
||||
updateWorkspace(currentWorkspace.slug, { logo: "" })
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue