diff --git a/packages/types/src/instance/base.d.ts b/packages/types/src/instance/base.d.ts index 87f03c68f..b21d7fe3f 100644 --- a/packages/types/src/instance/base.d.ts +++ b/packages/types/src/instance/base.d.ts @@ -20,6 +20,7 @@ export interface IInstance { last_checked_at: string | undefined; namespace: string | undefined; is_telemetry_enabled: boolean; + is_telemetry_anonymous: boolean; is_support_required: boolean; is_activated: boolean; is_setup_done: boolean; diff --git a/web/components/onboarding/invite-members.tsx b/web/components/onboarding/invite-members.tsx index 3fbd79bd8..828018922 100644 --- a/web/components/onboarding/invite-members.tsx +++ b/web/components/onboarding/invite-members.tsx @@ -25,7 +25,7 @@ import { EUserWorkspaceRoles, ROLE } from "@/constants/workspace"; // helpers import { getUserRole } from "@/helpers/user.helper"; // hooks -import { useEventTracker, useApplication } from "@/hooks/store"; +import { useEventTracker, useInstance } from "@/hooks/store"; import useDynamicDropdownPosition from "@/hooks/use-dynamic-dropdown"; // services import { WorkspaceService } from "@/services/workspace.service"; @@ -273,9 +273,7 @@ export const InviteMembers: React.FC = (props) => { const { resolvedTheme } = useTheme(); // store hooks const { captureEvent } = useEventTracker(); - const { - instance: { instance }, - } = useApplication(); + const { instance } = useInstance(); const { control, @@ -315,7 +313,7 @@ export const InviteMembers: React.FC = (props) => { }) .then(async () => { captureEvent(MEMBER_INVITED, { - emails: !instance?.is_telemetry_anonymous + emails: !instance?.instance?.is_telemetry_anonymous ? [ ...payload.emails.map((email) => ({ email: email.email, diff --git a/web/lib/app-provider.tsx b/web/lib/app-provider.tsx index 44f9b5655..e94228188 100644 --- a/web/lib/app-provider.tsx +++ b/web/lib/app-provider.tsx @@ -33,7 +33,10 @@ export const AppProvider: FC = observer((props) => { const { children } = props; // store hooks const { instance } = useInstance(); - const { data: currentUser } = useUser(); + const { + data: currentUser, + profile: { data: profile }, + } = useUser(); const { currentWorkspace, workspaces } = useWorkspace(); // themes const { resolvedTheme } = useTheme(); @@ -47,10 +50,11 @@ export const AppProvider: FC = observer((props) => { diff --git a/web/lib/posthog-provider.tsx b/web/lib/posthog-provider.tsx index db3850086..da6a64719 100644 --- a/web/lib/posthog-provider.tsx +++ b/web/lib/posthog-provider.tsx @@ -2,7 +2,7 @@ import { FC, ReactNode, useEffect, useState } from "react"; import { useRouter } from "next/router"; import posthog from "posthog-js"; import { PostHogProvider as PHProvider } from "posthog-js/react"; -import { IUser } from "@plane/types"; +import { IUser, TUserProfile } from "@plane/types"; // constants import { GROUP_WORKSPACE } from "@/constants/event-tracker"; // types @@ -10,6 +10,7 @@ import { GROUP_WORKSPACE } from "@/constants/event-tracker"; export interface IPosthogWrapper { children: ReactNode; user: IUser | undefined; + profile: TUserProfile | undefined; workspaceIds: string[]; currentWorkspaceId: string | undefined; posthogAPIKey: string | undefined; @@ -19,8 +20,17 @@ export interface IPosthogWrapper { } const PostHogProvider: FC = (props) => { - const { children, user, workspaceIds, currentWorkspaceId, posthogAPIKey, posthogHost, isCloud, telemetryEnabled } = - props; + const { + children, + user, + profile, + workspaceIds, + currentWorkspaceId, + posthogAPIKey, + posthogHost, + isCloud, + telemetryEnabled, + } = props; // states const [lastWorkspaceId, setLastWorkspaceId] = useState(currentWorkspaceId); // router @@ -34,11 +44,11 @@ const PostHogProvider: FC = (props) => { first_name: isCloud ? user.first_name : undefined, last_name: isCloud ? user.last_name : undefined, email: isCloud ? user.email : undefined, - use_case: user?.use_case, + use_case: profile?.use_case, workspaces: workspaceIds, }); } - }, [user, workspaceIds, isCloud]); + }, [user, workspaceIds, isCloud, profile]); useEffect(() => { if (