mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: telemetery fields in new instance type defination
This commit is contained in:
parent
0d7f4761c7
commit
a28cca29d5
1
packages/types/src/instance/base.d.ts
vendored
1
packages/types/src/instance/base.d.ts
vendored
@ -20,6 +20,7 @@ export interface IInstance {
|
|||||||
last_checked_at: string | undefined;
|
last_checked_at: string | undefined;
|
||||||
namespace: string | undefined;
|
namespace: string | undefined;
|
||||||
is_telemetry_enabled: boolean;
|
is_telemetry_enabled: boolean;
|
||||||
|
is_telemetry_anonymous: boolean;
|
||||||
is_support_required: boolean;
|
is_support_required: boolean;
|
||||||
is_activated: boolean;
|
is_activated: boolean;
|
||||||
is_setup_done: boolean;
|
is_setup_done: boolean;
|
||||||
|
@ -25,7 +25,7 @@ import { EUserWorkspaceRoles, ROLE } from "@/constants/workspace";
|
|||||||
// helpers
|
// helpers
|
||||||
import { getUserRole } from "@/helpers/user.helper";
|
import { getUserRole } from "@/helpers/user.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useEventTracker, useApplication } from "@/hooks/store";
|
import { useEventTracker, useInstance } from "@/hooks/store";
|
||||||
import useDynamicDropdownPosition from "@/hooks/use-dynamic-dropdown";
|
import useDynamicDropdownPosition from "@/hooks/use-dynamic-dropdown";
|
||||||
// services
|
// services
|
||||||
import { WorkspaceService } from "@/services/workspace.service";
|
import { WorkspaceService } from "@/services/workspace.service";
|
||||||
@ -273,9 +273,7 @@ export const InviteMembers: React.FC<Props> = (props) => {
|
|||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
// store hooks
|
// store hooks
|
||||||
const { captureEvent } = useEventTracker();
|
const { captureEvent } = useEventTracker();
|
||||||
const {
|
const { instance } = useInstance();
|
||||||
instance: { instance },
|
|
||||||
} = useApplication();
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
@ -315,7 +313,7 @@ export const InviteMembers: React.FC<Props> = (props) => {
|
|||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
captureEvent(MEMBER_INVITED, {
|
captureEvent(MEMBER_INVITED, {
|
||||||
emails: !instance?.is_telemetry_anonymous
|
emails: !instance?.instance?.is_telemetry_anonymous
|
||||||
? [
|
? [
|
||||||
...payload.emails.map((email) => ({
|
...payload.emails.map((email) => ({
|
||||||
email: email.email,
|
email: email.email,
|
||||||
|
@ -33,7 +33,10 @@ export const AppProvider: FC<IAppProvider> = observer((props) => {
|
|||||||
const { children } = props;
|
const { children } = props;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { instance } = useInstance();
|
const { instance } = useInstance();
|
||||||
const { data: currentUser } = useUser();
|
const {
|
||||||
|
data: currentUser,
|
||||||
|
profile: { data: profile },
|
||||||
|
} = useUser();
|
||||||
const { currentWorkspace, workspaces } = useWorkspace();
|
const { currentWorkspace, workspaces } = useWorkspace();
|
||||||
// themes
|
// themes
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
@ -47,10 +50,11 @@ export const AppProvider: FC<IAppProvider> = observer((props) => {
|
|||||||
<CrispWrapper user={currentUser}>
|
<CrispWrapper user={currentUser}>
|
||||||
<PostHogProvider
|
<PostHogProvider
|
||||||
user={currentUser}
|
user={currentUser}
|
||||||
|
profile={profile}
|
||||||
currentWorkspaceId={currentWorkspace?.id}
|
currentWorkspaceId={currentWorkspace?.id}
|
||||||
workspaceIds={Object.keys(workspaces)}
|
workspaceIds={Object.keys(workspaces)}
|
||||||
isCloud={!instance?.is_telemetry_anonymous || false}
|
isCloud={!instance?.instance?.is_telemetry_anonymous || false}
|
||||||
telemetryEnabled={instance?.is_telemetry_enabled || false}
|
telemetryEnabled={instance?.instance?.is_telemetry_enabled || false}
|
||||||
posthogAPIKey={instance?.config?.posthog_api_key || undefined}
|
posthogAPIKey={instance?.config?.posthog_api_key || undefined}
|
||||||
posthogHost={instance?.config.posthog_host || undefined}
|
posthogHost={instance?.config.posthog_host || undefined}
|
||||||
>
|
>
|
||||||
|
@ -2,7 +2,7 @@ import { FC, ReactNode, useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import posthog from "posthog-js";
|
import posthog from "posthog-js";
|
||||||
import { PostHogProvider as PHProvider } from "posthog-js/react";
|
import { PostHogProvider as PHProvider } from "posthog-js/react";
|
||||||
import { IUser } from "@plane/types";
|
import { IUser, TUserProfile } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { GROUP_WORKSPACE } from "@/constants/event-tracker";
|
import { GROUP_WORKSPACE } from "@/constants/event-tracker";
|
||||||
// types
|
// types
|
||||||
@ -10,6 +10,7 @@ import { GROUP_WORKSPACE } from "@/constants/event-tracker";
|
|||||||
export interface IPosthogWrapper {
|
export interface IPosthogWrapper {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
user: IUser | undefined;
|
user: IUser | undefined;
|
||||||
|
profile: TUserProfile | undefined;
|
||||||
workspaceIds: string[];
|
workspaceIds: string[];
|
||||||
currentWorkspaceId: string | undefined;
|
currentWorkspaceId: string | undefined;
|
||||||
posthogAPIKey: string | undefined;
|
posthogAPIKey: string | undefined;
|
||||||
@ -19,8 +20,17 @@ export interface IPosthogWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const PostHogProvider: FC<IPosthogWrapper> = (props) => {
|
const PostHogProvider: FC<IPosthogWrapper> = (props) => {
|
||||||
const { children, user, workspaceIds, currentWorkspaceId, posthogAPIKey, posthogHost, isCloud, telemetryEnabled } =
|
const {
|
||||||
props;
|
children,
|
||||||
|
user,
|
||||||
|
profile,
|
||||||
|
workspaceIds,
|
||||||
|
currentWorkspaceId,
|
||||||
|
posthogAPIKey,
|
||||||
|
posthogHost,
|
||||||
|
isCloud,
|
||||||
|
telemetryEnabled,
|
||||||
|
} = props;
|
||||||
// states
|
// states
|
||||||
const [lastWorkspaceId, setLastWorkspaceId] = useState(currentWorkspaceId);
|
const [lastWorkspaceId, setLastWorkspaceId] = useState(currentWorkspaceId);
|
||||||
// router
|
// router
|
||||||
@ -34,11 +44,11 @@ const PostHogProvider: FC<IPosthogWrapper> = (props) => {
|
|||||||
first_name: isCloud ? user.first_name : undefined,
|
first_name: isCloud ? user.first_name : undefined,
|
||||||
last_name: isCloud ? user.last_name : undefined,
|
last_name: isCloud ? user.last_name : undefined,
|
||||||
email: isCloud ? user.email : undefined,
|
email: isCloud ? user.email : undefined,
|
||||||
use_case: user?.use_case,
|
use_case: profile?.use_case,
|
||||||
workspaces: workspaceIds,
|
workspaces: workspaceIds,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [user, workspaceIds, isCloud]);
|
}, [user, workspaceIds, isCloud, profile]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user