diff --git a/packages/types/src/instance.d.ts b/packages/types/src/instance.d.ts index e11b6add8..10ebd4721 100644 --- a/packages/types/src/instance.d.ts +++ b/packages/types/src/instance.d.ts @@ -12,6 +12,7 @@ export interface IInstance { version: string; last_checked_at: string; namespace: string | null; + is_telemetry_anonymous: boolean; is_telemetry_enabled: boolean; is_support_required: boolean; created_by: string | null; diff --git a/web/lib/app-provider.tsx b/web/lib/app-provider.tsx index 6693b3398..51bc0df65 100644 --- a/web/lib/app-provider.tsx +++ b/web/lib/app-provider.tsx @@ -36,6 +36,7 @@ export const AppProvider: FC = observer((props) => { const { currentWorkspace, workspaces } = useWorkspace(); const { config: { envConfig }, + instance: { instance }, } = useApplication(); // themes const { resolvedTheme } = useTheme(); @@ -51,6 +52,8 @@ export const AppProvider: FC = observer((props) => { user={currentUser} currentWorkspaceId={currentWorkspace?.id} workspaceIds={Object.keys(workspaces)} + isCloud={!instance?.is_telemetry_anonymous || false} + telemetryEnabled={instance?.is_telemetry_enabled || false} posthogAPIKey={envConfig?.posthog_api_key || null} posthogHost={envConfig?.posthog_host || null} > diff --git a/web/lib/posthog-provider.tsx b/web/lib/posthog-provider.tsx index 83696f9e4..80f0cfd55 100644 --- a/web/lib/posthog-provider.tsx +++ b/web/lib/posthog-provider.tsx @@ -19,16 +19,8 @@ export interface IPosthogWrapper { } const PostHogProvider: FC = (props) => { - const { - children, - user, - workspaceIds, - currentWorkspaceId, - posthogAPIKey, - posthogHost, - isCloud = true, - telemetryEnabled = false, - } = props; + const { children, user, workspaceIds, currentWorkspaceId, posthogAPIKey, posthogHost, isCloud, telemetryEnabled } = + props; // states const [lastWorkspaceId, setLastWorkspaceId] = useState(currentWorkspaceId); // router