jira/apps/web/core/components/project-states/root.tsx
sriram veeraghanta e093a22094
chore: remove posthog integration and analytics scaffold (#9634)
* chore: remove posthog integration and analytics scaffold

Removes the PostHog integration end to end, plus the inert autocapture
scaffold left behind by an earlier partial removal (d61b157929,
"chore: remove posthog events (#8465)").

Backend:
- delete bgtasks/event_tracking_task.py and utils/analytics_events.py
- drop all 6 track_event.delay call sites
- drop POSTHOG_API_KEY / POSTHOG_HOST settings
- stop returning posthog_api_key / posthog_host from GET /api/instances/
- drop the posthog==3.5.0 dependency

Frontend:
- delete packages/constants/src/event-tracker (all 40 exports were unused)
- remove 42 data-ph-element attributes across 36 files
- remove the dead shouldTrackEvents and trackerElements prop chains
- remove the Microsoft Clarity session-recording tag

Note: GET /api/instances/ no longer returns posthog_api_key/posthog_host.
Nothing in this repo read them and neither do plane-ee or plane-commercial,
but the endpoint is AllowAny and cached for 2h.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HD7dTidmtWWRRiFv3nmW3s

* chore: apply oxfmt formatting

Collapse JSX elements and import statements that were left multi-line
after the tracker props and specifiers were removed. Whitespace only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HD7dTidmtWWRRiFv3nmW3s

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 21:07:34 +05:30

76 lines
2.6 KiB
TypeScript

/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { useMemo } from "react";
import { observer } from "mobx-react";
import useSWR from "swr";
// components
import { EUserPermissionsLevel } from "@plane/constants";
import type { IState, TStateOperationsCallbacks } from "@plane/types";
import { EUserProjectRoles } from "@plane/types";
import { ProjectStateLoader, GroupList } from "@/components/project-states";
// hooks
import { useProjectState } from "@/hooks/store/use-project-state";
import { useUserPermissions } from "@/hooks/store/user";
type TProjectState = {
workspaceSlug: string;
projectId: string;
};
export const ProjectStateRoot = observer(function ProjectStateRoot(props: TProjectState) {
const { workspaceSlug, projectId } = props;
// hooks
const {
groupedProjectStates,
fetchProjectStates,
createState,
moveStatePosition,
updateState,
deleteState,
markStateAsDefault,
} = useProjectState();
const { allowPermissions } = useUserPermissions();
// derived values
const isEditable = allowPermissions(
[EUserProjectRoles.ADMIN],
EUserPermissionsLevel.PROJECT,
workspaceSlug,
projectId
);
// Fetching all project states
useSWR(
workspaceSlug && projectId ? `PROJECT_STATES_${workspaceSlug}_${projectId}` : null,
workspaceSlug && projectId ? () => fetchProjectStates(workspaceSlug.toString(), projectId.toString()) : null,
{ revalidateIfStale: false, revalidateOnFocus: false }
);
// State operations callbacks
const stateOperationsCallbacks: TStateOperationsCallbacks = useMemo(
() => ({
createState: async (data: Partial<IState>) => createState(workspaceSlug, projectId, data),
updateState: async (stateId: string, data: Partial<IState>) =>
updateState(workspaceSlug, projectId, stateId, data),
deleteState: async (stateId: string) => deleteState(workspaceSlug, projectId, stateId),
moveStatePosition: async (stateId: string, data: Partial<IState>) =>
moveStatePosition(workspaceSlug, projectId, stateId, data),
markStateAsDefault: async (stateId: string) => markStateAsDefault(workspaceSlug, projectId, stateId),
}),
[workspaceSlug, projectId, createState, moveStatePosition, updateState, deleteState, markStateAsDefault]
);
// Loader
if (!groupedProjectStates) return <ProjectStateLoader />;
return (
<GroupList
groupedStates={groupedProjectStates}
stateOperationsCallbacks={stateOperationsCallbacks}
isEditable={isEditable}
/>
);
});