UNPKG

2.73 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { AnalyticsCollector } from './analytics-collector';
9export declare const AnalyticsProperties: {
10 AngularCliProd: string;
11 AngularCliStaging: string;
12 readonly AngularCliDefault: string;
13};
14/**
15 * This is the ultimate safelist for checking if a package name is safe to report to analytics.
16 */
17export declare const analyticsPackageSafelist: (string | RegExp)[];
18export declare function isPackageNameSafeForAnalytics(name: string): boolean;
19/**
20 * Set analytics settings. This does not work if the user is not inside a project.
21 * @param level Which config to use. "global" for user-level, and "local" for project-level.
22 * @param value Either a user ID, true to generate a new User ID, or false to disable analytics.
23 */
24export declare function setAnalyticsConfig(level: 'global' | 'local', value: string | boolean): void;
25/**
26 * Prompt the user for usage gathering permission.
27 * @param force Whether to ask regardless of whether or not the user is using an interactive shell.
28 * @return Whether or not the user was shown a prompt.
29 */
30export declare function promptGlobalAnalytics(force?: boolean): Promise<boolean>;
31/**
32 * Prompt the user for usage gathering permission for the local project. Fails if there is no
33 * local workspace.
34 * @param force Whether to ask regardless of whether or not the user is using an interactive shell.
35 * @return Whether or not the user was shown a prompt.
36 */
37export declare function promptProjectAnalytics(force?: boolean): Promise<boolean>;
38export declare function hasGlobalAnalyticsConfiguration(): Promise<boolean>;
39/**
40 * Get the global analytics object for the user. This returns an instance of UniversalAnalytics,
41 * or undefined if analytics are disabled.
42 *
43 * If any problem happens, it is considered the user has been opting out of analytics.
44 */
45export declare function getGlobalAnalytics(): Promise<AnalyticsCollector | undefined>;
46export declare function hasWorkspaceAnalyticsConfiguration(): Promise<boolean>;
47/**
48 * Get the workspace analytics object for the user. This returns an instance of AnalyticsCollector,
49 * or undefined if analytics are disabled.
50 *
51 * If any problem happens, it is considered the user has been opting out of analytics.
52 */
53export declare function getWorkspaceAnalytics(): Promise<AnalyticsCollector | undefined>;
54/**
55 * Return the usage analytics sharing setting, which is either a property string (GA-XXXXXXX-XX),
56 * or undefined if no sharing.
57 */
58export declare function getSharedAnalytics(): Promise<AnalyticsCollector | undefined>;