posthog-react-native 3.13.2 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs.js +4677 -0
- package/lib/index.cjs.js.map +1 -0
- package/lib/index.d.ts +875 -0
- package/lib/index.esm.js +4659 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/posthog-core/src/eventemitter.d.ts +8 -8
- package/lib/posthog-core/src/featureFlagUtils.d.ts +34 -34
- package/lib/posthog-core/src/index.d.ts +239 -239
- package/lib/posthog-core/src/lz-string.d.ts +8 -8
- package/lib/posthog-core/src/types.d.ts +423 -422
- package/lib/posthog-core/src/utils.d.ts +19 -16
- package/lib/posthog-core/src/vendor/uuidv7.d.ts +179 -179
- package/lib/posthog-react-native/index.d.ts +10 -10
- package/lib/posthog-react-native/src/PostHogContext.d.ts +5 -5
- package/lib/posthog-react-native/src/PostHogProvider.d.ts +14 -14
- package/lib/posthog-react-native/src/autocapture.d.ts +4 -4
- package/lib/posthog-react-native/src/frameworks/wix-navigation.d.ts +3 -3
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.d.ts +5 -5
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.d.ts +3 -3
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.d.ts +6 -6
- package/lib/posthog-react-native/src/hooks/usePostHog.d.ts +2 -2
- package/lib/posthog-react-native/src/legacy.d.ts +4 -4
- package/lib/posthog-react-native/src/native-deps.d.ts +4 -4
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.d.ts +13 -13
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.d.ts +2 -2
- package/lib/posthog-react-native/src/posthog-rn.d.ts +71 -71
- package/lib/posthog-react-native/src/storage.d.ts +21 -21
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.d.ts +16 -16
- package/lib/posthog-react-native/src/surveys/components/BottomSection.d.ts +9 -9
- package/lib/posthog-react-native/src/surveys/components/Cancel.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.d.ts +7 -7
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.d.ts +27 -27
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.d.ts +10 -10
- package/lib/posthog-react-native/src/surveys/components/Surveys.d.ts +14 -14
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.d.ts +2 -2
- package/lib/posthog-react-native/src/surveys/icons.d.ts +10 -8
- package/lib/posthog-react-native/src/surveys/index.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/surveys-utils.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.d.ts +3 -3
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.d.ts +8 -8
- package/lib/posthog-react-native/src/types.d.ts +112 -112
- package/lib/posthog-react-native/src/version.d.ts +1 -1
- package/lib/posthog-react-native/test/test-utils.d.ts +2 -0
- package/package.json +9 -8
- package/lib/posthog-core/src/eventemitter.js +0 -1
- package/lib/posthog-core/src/eventemitter.js.map +0 -1
- package/lib/posthog-core/src/featureFlagUtils.js +0 -1
- package/lib/posthog-core/src/featureFlagUtils.js.map +0 -1
- package/lib/posthog-core/src/index.js +0 -1
- package/lib/posthog-core/src/index.js.map +0 -1
- package/lib/posthog-core/src/lz-string.js +0 -1
- package/lib/posthog-core/src/lz-string.js.map +0 -1
- package/lib/posthog-core/src/types.js +0 -1
- package/lib/posthog-core/src/types.js.map +0 -1
- package/lib/posthog-core/src/utils.js +0 -1
- package/lib/posthog-core/src/utils.js.map +0 -1
- package/lib/posthog-core/src/vendor/uuidv7.js +0 -7
- package/lib/posthog-core/src/vendor/uuidv7.js.map +0 -1
- package/lib/posthog-react-native/index.js +0 -1
- package/lib/posthog-react-native/index.js.map +0 -1
- package/lib/posthog-react-native/src/PostHogContext.js +0 -1
- package/lib/posthog-react-native/src/PostHogContext.js.map +0 -1
- package/lib/posthog-react-native/src/PostHogProvider.js +0 -1
- package/lib/posthog-react-native/src/PostHogProvider.js.map +0 -1
- package/lib/posthog-react-native/src/autocapture.js +0 -1
- package/lib/posthog-react-native/src/autocapture.js.map +0 -1
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js +0 -1
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js +0 -1
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/usePostHog.js +0 -1
- package/lib/posthog-react-native/src/hooks/usePostHog.js.map +0 -1
- package/lib/posthog-react-native/src/legacy.js +0 -1
- package/lib/posthog-react-native/src/legacy.js.map +0 -1
- package/lib/posthog-react-native/src/native-deps.js +0 -1
- package/lib/posthog-react-native/src/native-deps.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js +0 -1
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js.map +0 -1
- package/lib/posthog-react-native/src/posthog-rn.js +0 -1
- package/lib/posthog-react-native/src/posthog-rn.js.map +0 -1
- package/lib/posthog-react-native/src/storage.js +0 -1
- package/lib/posthog-react-native/src/storage.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js +0 -1
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/Cancel.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/Cancel.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/Surveys.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/Surveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js +0 -1
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/icons.js +0 -1
- package/lib/posthog-react-native/src/surveys/icons.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/index.js +0 -1
- package/lib/posthog-react-native/src/surveys/index.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/surveys-utils.js +0 -1
- package/lib/posthog-react-native/src/surveys/surveys-utils.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js +0 -1
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js +0 -1
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js.map +0 -1
- package/lib/posthog-react-native/src/types.js +0 -1
- package/lib/posthog-react-native/src/types.js.map +0 -1
- package/lib/posthog-react-native/src/version.js +0 -1
- package/lib/posthog-react-native/src/version.js.map +0 -1
- package/lib/posthog-react-native/tsconfig.tsbuildinfo +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare class SimpleEventEmitter {
|
|
2
|
-
events: {
|
|
3
|
-
[key: string]: ((...args: any[]) => void)[];
|
|
4
|
-
};
|
|
5
|
-
constructor();
|
|
6
|
-
on(event: string, listener: (...args: any[]) => void): () => void;
|
|
7
|
-
emit(event: string, payload: any): void;
|
|
8
|
-
}
|
|
1
|
+
export declare class SimpleEventEmitter {
|
|
2
|
+
events: {
|
|
3
|
+
[key: string]: ((...args: any[]) => void)[];
|
|
4
|
+
};
|
|
5
|
+
constructor();
|
|
6
|
+
on(event: string, listener: (...args: any[]) => void): () => void;
|
|
7
|
+
emit(event: string, payload: any): void;
|
|
8
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { FeatureFlagDetail, FeatureFlagValue, PostHogDecideResponse, PostHogV3DecideResponse, PostHogV4DecideResponse, PartialWithRequired, PostHogFeatureFlagsResponse } from './types';
|
|
2
|
-
export declare const normalizeDecideResponse: (decideResponse: PartialWithRequired<PostHogV4DecideResponse, 'flags'> | PartialWithRequired<PostHogV3DecideResponse, 'featureFlags' | 'featureFlagPayloads'>) => PostHogFeatureFlagsResponse;
|
|
3
|
-
/**
|
|
4
|
-
* Get the flag values from the flags v4 response.
|
|
5
|
-
* @param flags - The flags
|
|
6
|
-
* @returns The flag values
|
|
7
|
-
*/
|
|
8
|
-
export declare const getFlagValuesFromFlags: (flags: PostHogDecideResponse['flags']) => PostHogDecideResponse['featureFlags'];
|
|
9
|
-
/**
|
|
10
|
-
* Get the payloads from the flags v4 response.
|
|
11
|
-
* @param flags - The flags
|
|
12
|
-
* @returns The payloads
|
|
13
|
-
*/
|
|
14
|
-
export declare const getPayloadsFromFlags: (flags: PostHogDecideResponse['flags']) => PostHogDecideResponse['featureFlagPayloads'];
|
|
15
|
-
/**
|
|
16
|
-
* Get the flag details from the legacy v3 flags and payloads. As such, it will lack the reason, id, version, and description.
|
|
17
|
-
* @param decideResponse - The decide response
|
|
18
|
-
* @returns The flag details
|
|
19
|
-
*/
|
|
20
|
-
export declare const getFlagDetailsFromFlagsAndPayloads: (decideResponse: PostHogFeatureFlagsResponse) => PostHogDecideResponse['flags'];
|
|
21
|
-
export declare const getFeatureFlagValue: (detail: FeatureFlagDetail | undefined) => FeatureFlagValue | undefined;
|
|
22
|
-
export declare const parsePayload: (response: any) => any;
|
|
23
|
-
/**
|
|
24
|
-
* Get the normalized flag details from the flags and payloads.
|
|
25
|
-
* This is used to convert things like boostrap and stored feature flags and payloads to the v4 format.
|
|
26
|
-
* This helps us ensure backwards compatibility.
|
|
27
|
-
* If a key exists in the featureFlagPayloads that is not in the featureFlags, we treat it as a true feature flag.
|
|
28
|
-
*
|
|
29
|
-
* @param featureFlags - The feature flags
|
|
30
|
-
* @param featureFlagPayloads - The feature flag payloads
|
|
31
|
-
* @returns The normalized flag details
|
|
32
|
-
*/
|
|
33
|
-
export declare const createDecideResponseFromFlagsAndPayloads: (featureFlags: PostHogV3DecideResponse['featureFlags'], featureFlagPayloads: PostHogV3DecideResponse['featureFlagPayloads']) => PostHogFeatureFlagsResponse;
|
|
34
|
-
export declare const updateFlagValue: (flag: FeatureFlagDetail, value: FeatureFlagValue) => FeatureFlagDetail;
|
|
1
|
+
import { FeatureFlagDetail, FeatureFlagValue, PostHogDecideResponse, PostHogV3DecideResponse, PostHogV4DecideResponse, PartialWithRequired, PostHogFeatureFlagsResponse } from './types';
|
|
2
|
+
export declare const normalizeDecideResponse: (decideResponse: PartialWithRequired<PostHogV4DecideResponse, 'flags'> | PartialWithRequired<PostHogV3DecideResponse, 'featureFlags' | 'featureFlagPayloads'>) => PostHogFeatureFlagsResponse;
|
|
3
|
+
/**
|
|
4
|
+
* Get the flag values from the flags v4 response.
|
|
5
|
+
* @param flags - The flags
|
|
6
|
+
* @returns The flag values
|
|
7
|
+
*/
|
|
8
|
+
export declare const getFlagValuesFromFlags: (flags: PostHogDecideResponse['flags']) => PostHogDecideResponse['featureFlags'];
|
|
9
|
+
/**
|
|
10
|
+
* Get the payloads from the flags v4 response.
|
|
11
|
+
* @param flags - The flags
|
|
12
|
+
* @returns The payloads
|
|
13
|
+
*/
|
|
14
|
+
export declare const getPayloadsFromFlags: (flags: PostHogDecideResponse['flags']) => PostHogDecideResponse['featureFlagPayloads'];
|
|
15
|
+
/**
|
|
16
|
+
* Get the flag details from the legacy v3 flags and payloads. As such, it will lack the reason, id, version, and description.
|
|
17
|
+
* @param decideResponse - The decide response
|
|
18
|
+
* @returns The flag details
|
|
19
|
+
*/
|
|
20
|
+
export declare const getFlagDetailsFromFlagsAndPayloads: (decideResponse: PostHogFeatureFlagsResponse) => PostHogDecideResponse['flags'];
|
|
21
|
+
export declare const getFeatureFlagValue: (detail: FeatureFlagDetail | undefined) => FeatureFlagValue | undefined;
|
|
22
|
+
export declare const parsePayload: (response: any) => any;
|
|
23
|
+
/**
|
|
24
|
+
* Get the normalized flag details from the flags and payloads.
|
|
25
|
+
* This is used to convert things like boostrap and stored feature flags and payloads to the v4 format.
|
|
26
|
+
* This helps us ensure backwards compatibility.
|
|
27
|
+
* If a key exists in the featureFlagPayloads that is not in the featureFlags, we treat it as a true feature flag.
|
|
28
|
+
*
|
|
29
|
+
* @param featureFlags - The feature flags
|
|
30
|
+
* @param featureFlagPayloads - The feature flag payloads
|
|
31
|
+
* @returns The normalized flag details
|
|
32
|
+
*/
|
|
33
|
+
export declare const createDecideResponseFromFlagsAndPayloads: (featureFlags: PostHogV3DecideResponse['featureFlags'], featureFlagPayloads: PostHogV3DecideResponse['featureFlagPayloads']) => PostHogFeatureFlagsResponse;
|
|
34
|
+
export declare const updateFlagValue: (flag: FeatureFlagDetail, value: FeatureFlagValue) => FeatureFlagDetail;
|
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
import { PostHogFetchOptions, PostHogFetchResponse, PostHogAutocaptureElement, PostHogDecideResponse, PostHogCoreOptions, PostHogEventProperties, PostHogPersistedProperty, PostHogCaptureOptions, JsonType, PostHogRemoteConfig, FeatureFlagValue, PostHogFeatureFlagDetails, FeatureFlagDetail, SurveyResponse } from './types';
|
|
2
|
-
import { RetriableOptions } from './utils';
|
|
3
|
-
import { LZString } from './lz-string';
|
|
4
|
-
import { SimpleEventEmitter } from './eventemitter';
|
|
5
|
-
export * as utils from './utils';
|
|
6
|
-
export declare abstract class PostHogCoreStateless {
|
|
7
|
-
readonly apiKey: string;
|
|
8
|
-
readonly host: string;
|
|
9
|
-
readonly flushAt: number;
|
|
10
|
-
readonly preloadFeatureFlags: boolean;
|
|
11
|
-
readonly disableSurveys: boolean;
|
|
12
|
-
private maxBatchSize;
|
|
13
|
-
private maxQueueSize;
|
|
14
|
-
private flushInterval;
|
|
15
|
-
private flushPromise;
|
|
16
|
-
private requestTimeout;
|
|
17
|
-
private featureFlagsRequestTimeoutMs;
|
|
18
|
-
private remoteConfigRequestTimeoutMs;
|
|
19
|
-
private captureMode;
|
|
20
|
-
private removeDebugCallback?;
|
|
21
|
-
private disableGeoip;
|
|
22
|
-
private historicalMigration;
|
|
23
|
-
protected disabled: boolean;
|
|
24
|
-
private defaultOptIn;
|
|
25
|
-
private pendingPromises;
|
|
26
|
-
protected _events: SimpleEventEmitter;
|
|
27
|
-
protected _flushTimer?: any;
|
|
28
|
-
protected _retryOptions: RetriableOptions;
|
|
29
|
-
protected _initPromise: Promise<void>;
|
|
30
|
-
protected _isInitialized: boolean;
|
|
31
|
-
protected _remoteConfigResponsePromise?: Promise<PostHogRemoteConfig | undefined>;
|
|
32
|
-
abstract fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
33
|
-
abstract getLibraryId(): string;
|
|
34
|
-
abstract getLibraryVersion(): string;
|
|
35
|
-
abstract getCustomUserAgent(): string | void;
|
|
36
|
-
abstract getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
37
|
-
abstract setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
38
|
-
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
39
|
-
protected logMsgIfDebug(fn: () => void): void;
|
|
40
|
-
protected wrap(fn: () => void): void;
|
|
41
|
-
protected getCommonEventProperties(): any;
|
|
42
|
-
get optedOut(): boolean;
|
|
43
|
-
optIn(): Promise<void>;
|
|
44
|
-
optOut(): Promise<void>;
|
|
45
|
-
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
46
|
-
debug(enabled?: boolean): void;
|
|
47
|
-
get isDebug(): boolean;
|
|
48
|
-
get isDisabled(): boolean;
|
|
49
|
-
private buildPayload;
|
|
50
|
-
protected addPendingPromise<T>(promise: Promise<T>): Promise<T>;
|
|
51
|
-
/***
|
|
52
|
-
*** TRACKING
|
|
53
|
-
***/
|
|
54
|
-
protected identifyStateless(distinctId: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
55
|
-
protected captureStateless(distinctId: string, event: string, properties?: {
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
}, options?: PostHogCaptureOptions): void;
|
|
58
|
-
protected aliasStateless(alias: string, distinctId: string, properties?: {
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
}, options?: PostHogCaptureOptions): void;
|
|
61
|
-
/***
|
|
62
|
-
*** GROUPS
|
|
63
|
-
***/
|
|
64
|
-
protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): void;
|
|
65
|
-
protected getRemoteConfig(): Promise<PostHogRemoteConfig | undefined>;
|
|
66
|
-
/***
|
|
67
|
-
*** FEATURE FLAGS
|
|
68
|
-
***/
|
|
69
|
-
protected getDecide(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, extraPayload?: Record<string, any>): Promise<PostHogDecideResponse | undefined>;
|
|
70
|
-
protected getFeatureFlagStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
71
|
-
response: FeatureFlagValue | undefined;
|
|
72
|
-
requestId: string | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
protected getFeatureFlagDetailStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
75
|
-
response: FeatureFlagDetail | undefined;
|
|
76
|
-
requestId: string | undefined;
|
|
77
|
-
} | undefined>;
|
|
78
|
-
protected getFeatureFlagPayloadStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<JsonType | undefined>;
|
|
79
|
-
protected getFeatureFlagPayloadsStateless(distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<PostHogDecideResponse['featureFlagPayloads'] | undefined>;
|
|
80
|
-
protected getFeatureFlagsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
81
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
82
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
83
|
-
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
84
|
-
}>;
|
|
85
|
-
protected getFeatureFlagsAndPayloadsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
86
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
87
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
88
|
-
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
89
|
-
}>;
|
|
90
|
-
protected getFeatureFlagDetailsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<PostHogFeatureFlagDetails | undefined>;
|
|
91
|
-
/***
|
|
92
|
-
*** SURVEYS
|
|
93
|
-
***/
|
|
94
|
-
getSurveysStateless(): Promise<SurveyResponse['surveys']>;
|
|
95
|
-
/***
|
|
96
|
-
*** QUEUEING AND FLUSHING
|
|
97
|
-
***/
|
|
98
|
-
protected enqueue(type: string, _message: any, options?: PostHogCaptureOptions): void;
|
|
99
|
-
private clearFlushTimer;
|
|
100
|
-
/**
|
|
101
|
-
* Helper for flushing the queue in the background
|
|
102
|
-
* Avoids unnecessary promise errors
|
|
103
|
-
*/
|
|
104
|
-
private flushBackground;
|
|
105
|
-
flush(): Promise<any[]>;
|
|
106
|
-
protected getCustomHeaders(): {
|
|
107
|
-
[key: string]: string;
|
|
108
|
-
};
|
|
109
|
-
private _flush;
|
|
110
|
-
private fetchWithRetry;
|
|
111
|
-
shutdown(shutdownTimeoutMs?: number): Promise<void>;
|
|
112
|
-
}
|
|
113
|
-
export declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
114
|
-
private sendFeatureFlagEvent;
|
|
115
|
-
private flagCallReported;
|
|
116
|
-
protected _decideResponsePromise?: Promise<PostHogDecideResponse | undefined>;
|
|
117
|
-
protected _sessionExpirationTimeSeconds: number;
|
|
118
|
-
protected sessionProps: PostHogEventProperties;
|
|
119
|
-
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
120
|
-
protected setupBootstrap(options?: Partial<PostHogCoreOptions>): void;
|
|
121
|
-
private get props();
|
|
122
|
-
private set props(value);
|
|
123
|
-
private clearProps;
|
|
124
|
-
private _props;
|
|
125
|
-
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
126
|
-
reset(propertiesToKeep?: PostHogPersistedProperty[]): void;
|
|
127
|
-
protected getCommonEventProperties(): any;
|
|
128
|
-
private enrichProperties;
|
|
129
|
-
/**
|
|
130
|
-
* * @returns {string} The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.
|
|
131
|
-
*/
|
|
132
|
-
getSessionId(): string;
|
|
133
|
-
resetSessionId(): void;
|
|
134
|
-
/**
|
|
135
|
-
* * @returns {string} The stored anonymous ID. This may be an empty string if the client is not yet fully initialized.
|
|
136
|
-
*/
|
|
137
|
-
getAnonymousId(): string;
|
|
138
|
-
/**
|
|
139
|
-
* * @returns {string} The stored distinct ID. This may be an empty string if the client is not yet fully initialized.
|
|
140
|
-
*/
|
|
141
|
-
getDistinctId(): string;
|
|
142
|
-
unregister(property: string): Promise<void>;
|
|
143
|
-
register(properties: {
|
|
144
|
-
[key: string]: any;
|
|
145
|
-
}): Promise<void>;
|
|
146
|
-
registerForSession(properties: {
|
|
147
|
-
[key: string]: any;
|
|
148
|
-
}): void;
|
|
149
|
-
unregisterForSession(property: string): void;
|
|
150
|
-
/***
|
|
151
|
-
*** TRACKING
|
|
152
|
-
***/
|
|
153
|
-
identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
154
|
-
capture(event: string, properties?: {
|
|
155
|
-
[key: string]: any;
|
|
156
|
-
}, options?: PostHogCaptureOptions): void;
|
|
157
|
-
alias(alias: string): void;
|
|
158
|
-
autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
159
|
-
/***
|
|
160
|
-
*** GROUPS
|
|
161
|
-
***/
|
|
162
|
-
groups(groups: {
|
|
163
|
-
[type: string]: string | number;
|
|
164
|
-
}): void;
|
|
165
|
-
group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
166
|
-
groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
167
|
-
/***
|
|
168
|
-
* PROPERTIES
|
|
169
|
-
***/
|
|
170
|
-
setPersonPropertiesForFlags(properties: {
|
|
171
|
-
[type: string]: string;
|
|
172
|
-
}): void;
|
|
173
|
-
resetPersonPropertiesForFlags(): void;
|
|
174
|
-
/** @deprecated - Renamed to setPersonPropertiesForFlags */
|
|
175
|
-
personProperties(properties: {
|
|
176
|
-
[type: string]: string;
|
|
177
|
-
}): void;
|
|
178
|
-
setGroupPropertiesForFlags(properties: {
|
|
179
|
-
[type: string]: Record<string, string>;
|
|
180
|
-
}): void;
|
|
181
|
-
resetGroupPropertiesForFlags(): void;
|
|
182
|
-
/** @deprecated - Renamed to setGroupPropertiesForFlags */
|
|
183
|
-
groupProperties(properties: {
|
|
184
|
-
[type: string]: Record<string, string>;
|
|
185
|
-
}): void;
|
|
186
|
-
private remoteConfigAsync;
|
|
187
|
-
/***
|
|
188
|
-
*** FEATURE FLAGS
|
|
189
|
-
***/
|
|
190
|
-
private decideAsync;
|
|
191
|
-
private cacheSessionReplay;
|
|
192
|
-
private _remoteConfigAsync;
|
|
193
|
-
private _decideAsync;
|
|
194
|
-
private setKnownFeatureFlagDetails;
|
|
195
|
-
private getKnownFeatureFlagDetails;
|
|
196
|
-
private getKnownFeatureFlags;
|
|
197
|
-
private getKnownFeatureFlagPayloads;
|
|
198
|
-
private getBootstrappedFeatureFlagDetails;
|
|
199
|
-
private setBootstrappedFeatureFlagDetails;
|
|
200
|
-
private getBootstrappedFeatureFlags;
|
|
201
|
-
private getBootstrappedFeatureFlagPayloads;
|
|
202
|
-
getFeatureFlag(key: string): FeatureFlagValue | undefined;
|
|
203
|
-
getFeatureFlagPayload(key: string): JsonType | undefined;
|
|
204
|
-
getFeatureFlagPayloads(): PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
205
|
-
getFeatureFlags(): PostHogDecideResponse['featureFlags'] | undefined;
|
|
206
|
-
getFeatureFlagDetails(): PostHogFeatureFlagDetails | undefined;
|
|
207
|
-
getFeatureFlagsAndPayloads(): {
|
|
208
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
209
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
210
|
-
};
|
|
211
|
-
isFeatureEnabled(key: string): boolean | undefined;
|
|
212
|
-
reloadFeatureFlags(cb?: (err?: Error, flags?: PostHogDecideResponse['featureFlags']) => void): void;
|
|
213
|
-
reloadRemoteConfigAsync(): Promise<PostHogRemoteConfig | undefined>;
|
|
214
|
-
reloadFeatureFlagsAsync(sendAnonDistinctId?: boolean): Promise<PostHogDecideResponse['featureFlags'] | undefined>;
|
|
215
|
-
onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
|
|
216
|
-
onFeatureFlag(key: string, cb: (value: FeatureFlagValue) => void): () => void;
|
|
217
|
-
overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): Promise<void>;
|
|
218
|
-
/***
|
|
219
|
-
*** ERROR TRACKING
|
|
220
|
-
***/
|
|
221
|
-
captureException(error: unknown, additionalProperties?: {
|
|
222
|
-
[key: string]: any;
|
|
223
|
-
}): void;
|
|
224
|
-
/**
|
|
225
|
-
* Capture written user feedback for a LLM trace. Numeric values are converted to strings.
|
|
226
|
-
* @param traceId The trace ID to capture feedback for.
|
|
227
|
-
* @param userFeedback The feedback to capture.
|
|
228
|
-
*/
|
|
229
|
-
captureTraceFeedback(traceId: string | number, userFeedback: string): void;
|
|
230
|
-
/**
|
|
231
|
-
* Capture a metric for a LLM trace. Numeric values are converted to strings.
|
|
232
|
-
* @param traceId The trace ID to capture the metric for.
|
|
233
|
-
* @param metricName The name of the metric to capture.
|
|
234
|
-
* @param metricValue The value of the metric to capture.
|
|
235
|
-
*/
|
|
236
|
-
captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void;
|
|
237
|
-
}
|
|
238
|
-
export * from './types';
|
|
239
|
-
export { LZString };
|
|
1
|
+
import { PostHogFetchOptions, PostHogFetchResponse, PostHogAutocaptureElement, PostHogDecideResponse, PostHogCoreOptions, PostHogEventProperties, PostHogPersistedProperty, PostHogCaptureOptions, JsonType, PostHogRemoteConfig, FeatureFlagValue, PostHogFeatureFlagDetails, FeatureFlagDetail, SurveyResponse } from './types';
|
|
2
|
+
import { RetriableOptions } from './utils';
|
|
3
|
+
import { LZString } from './lz-string';
|
|
4
|
+
import { SimpleEventEmitter } from './eventemitter';
|
|
5
|
+
export * as utils from './utils';
|
|
6
|
+
export declare abstract class PostHogCoreStateless {
|
|
7
|
+
readonly apiKey: string;
|
|
8
|
+
readonly host: string;
|
|
9
|
+
readonly flushAt: number;
|
|
10
|
+
readonly preloadFeatureFlags: boolean;
|
|
11
|
+
readonly disableSurveys: boolean;
|
|
12
|
+
private maxBatchSize;
|
|
13
|
+
private maxQueueSize;
|
|
14
|
+
private flushInterval;
|
|
15
|
+
private flushPromise;
|
|
16
|
+
private requestTimeout;
|
|
17
|
+
private featureFlagsRequestTimeoutMs;
|
|
18
|
+
private remoteConfigRequestTimeoutMs;
|
|
19
|
+
private captureMode;
|
|
20
|
+
private removeDebugCallback?;
|
|
21
|
+
private disableGeoip;
|
|
22
|
+
private historicalMigration;
|
|
23
|
+
protected disabled: boolean;
|
|
24
|
+
private defaultOptIn;
|
|
25
|
+
private pendingPromises;
|
|
26
|
+
protected _events: SimpleEventEmitter;
|
|
27
|
+
protected _flushTimer?: any;
|
|
28
|
+
protected _retryOptions: RetriableOptions;
|
|
29
|
+
protected _initPromise: Promise<void>;
|
|
30
|
+
protected _isInitialized: boolean;
|
|
31
|
+
protected _remoteConfigResponsePromise?: Promise<PostHogRemoteConfig | undefined>;
|
|
32
|
+
abstract fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
33
|
+
abstract getLibraryId(): string;
|
|
34
|
+
abstract getLibraryVersion(): string;
|
|
35
|
+
abstract getCustomUserAgent(): string | void;
|
|
36
|
+
abstract getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
37
|
+
abstract setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
38
|
+
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
39
|
+
protected logMsgIfDebug(fn: () => void): void;
|
|
40
|
+
protected wrap(fn: () => void): void;
|
|
41
|
+
protected getCommonEventProperties(): any;
|
|
42
|
+
get optedOut(): boolean;
|
|
43
|
+
optIn(): Promise<void>;
|
|
44
|
+
optOut(): Promise<void>;
|
|
45
|
+
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
46
|
+
debug(enabled?: boolean): void;
|
|
47
|
+
get isDebug(): boolean;
|
|
48
|
+
get isDisabled(): boolean;
|
|
49
|
+
private buildPayload;
|
|
50
|
+
protected addPendingPromise<T>(promise: Promise<T>): Promise<T>;
|
|
51
|
+
/***
|
|
52
|
+
*** TRACKING
|
|
53
|
+
***/
|
|
54
|
+
protected identifyStateless(distinctId: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
55
|
+
protected captureStateless(distinctId: string, event: string, properties?: {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}, options?: PostHogCaptureOptions): void;
|
|
58
|
+
protected aliasStateless(alias: string, distinctId: string, properties?: {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}, options?: PostHogCaptureOptions): void;
|
|
61
|
+
/***
|
|
62
|
+
*** GROUPS
|
|
63
|
+
***/
|
|
64
|
+
protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): void;
|
|
65
|
+
protected getRemoteConfig(): Promise<PostHogRemoteConfig | undefined>;
|
|
66
|
+
/***
|
|
67
|
+
*** FEATURE FLAGS
|
|
68
|
+
***/
|
|
69
|
+
protected getDecide(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, extraPayload?: Record<string, any>): Promise<PostHogDecideResponse | undefined>;
|
|
70
|
+
protected getFeatureFlagStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
71
|
+
response: FeatureFlagValue | undefined;
|
|
72
|
+
requestId: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
protected getFeatureFlagDetailStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
75
|
+
response: FeatureFlagDetail | undefined;
|
|
76
|
+
requestId: string | undefined;
|
|
77
|
+
} | undefined>;
|
|
78
|
+
protected getFeatureFlagPayloadStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<JsonType | undefined>;
|
|
79
|
+
protected getFeatureFlagPayloadsStateless(distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<PostHogDecideResponse['featureFlagPayloads'] | undefined>;
|
|
80
|
+
protected getFeatureFlagsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
81
|
+
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
82
|
+
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
83
|
+
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
protected getFeatureFlagsAndPayloadsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
86
|
+
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
87
|
+
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
88
|
+
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
protected getFeatureFlagDetailsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<PostHogFeatureFlagDetails | undefined>;
|
|
91
|
+
/***
|
|
92
|
+
*** SURVEYS
|
|
93
|
+
***/
|
|
94
|
+
getSurveysStateless(): Promise<SurveyResponse['surveys']>;
|
|
95
|
+
/***
|
|
96
|
+
*** QUEUEING AND FLUSHING
|
|
97
|
+
***/
|
|
98
|
+
protected enqueue(type: string, _message: any, options?: PostHogCaptureOptions): void;
|
|
99
|
+
private clearFlushTimer;
|
|
100
|
+
/**
|
|
101
|
+
* Helper for flushing the queue in the background
|
|
102
|
+
* Avoids unnecessary promise errors
|
|
103
|
+
*/
|
|
104
|
+
private flushBackground;
|
|
105
|
+
flush(): Promise<any[]>;
|
|
106
|
+
protected getCustomHeaders(): {
|
|
107
|
+
[key: string]: string;
|
|
108
|
+
};
|
|
109
|
+
private _flush;
|
|
110
|
+
private fetchWithRetry;
|
|
111
|
+
shutdown(shutdownTimeoutMs?: number): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
export declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
114
|
+
private sendFeatureFlagEvent;
|
|
115
|
+
private flagCallReported;
|
|
116
|
+
protected _decideResponsePromise?: Promise<PostHogDecideResponse | undefined>;
|
|
117
|
+
protected _sessionExpirationTimeSeconds: number;
|
|
118
|
+
protected sessionProps: PostHogEventProperties;
|
|
119
|
+
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
120
|
+
protected setupBootstrap(options?: Partial<PostHogCoreOptions>): void;
|
|
121
|
+
private get props();
|
|
122
|
+
private set props(value);
|
|
123
|
+
private clearProps;
|
|
124
|
+
private _props;
|
|
125
|
+
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
126
|
+
reset(propertiesToKeep?: PostHogPersistedProperty[]): void;
|
|
127
|
+
protected getCommonEventProperties(): any;
|
|
128
|
+
private enrichProperties;
|
|
129
|
+
/**
|
|
130
|
+
* * @returns {string} The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.
|
|
131
|
+
*/
|
|
132
|
+
getSessionId(): string;
|
|
133
|
+
resetSessionId(): void;
|
|
134
|
+
/**
|
|
135
|
+
* * @returns {string} The stored anonymous ID. This may be an empty string if the client is not yet fully initialized.
|
|
136
|
+
*/
|
|
137
|
+
getAnonymousId(): string;
|
|
138
|
+
/**
|
|
139
|
+
* * @returns {string} The stored distinct ID. This may be an empty string if the client is not yet fully initialized.
|
|
140
|
+
*/
|
|
141
|
+
getDistinctId(): string;
|
|
142
|
+
unregister(property: string): Promise<void>;
|
|
143
|
+
register(properties: {
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
registerForSession(properties: {
|
|
147
|
+
[key: string]: any;
|
|
148
|
+
}): void;
|
|
149
|
+
unregisterForSession(property: string): void;
|
|
150
|
+
/***
|
|
151
|
+
*** TRACKING
|
|
152
|
+
***/
|
|
153
|
+
identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
154
|
+
capture(event: string, properties?: {
|
|
155
|
+
[key: string]: any;
|
|
156
|
+
}, options?: PostHogCaptureOptions): void;
|
|
157
|
+
alias(alias: string): void;
|
|
158
|
+
autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
159
|
+
/***
|
|
160
|
+
*** GROUPS
|
|
161
|
+
***/
|
|
162
|
+
groups(groups: {
|
|
163
|
+
[type: string]: string | number;
|
|
164
|
+
}): void;
|
|
165
|
+
group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
166
|
+
groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
167
|
+
/***
|
|
168
|
+
* PROPERTIES
|
|
169
|
+
***/
|
|
170
|
+
setPersonPropertiesForFlags(properties: {
|
|
171
|
+
[type: string]: string;
|
|
172
|
+
}): void;
|
|
173
|
+
resetPersonPropertiesForFlags(): void;
|
|
174
|
+
/** @deprecated - Renamed to setPersonPropertiesForFlags */
|
|
175
|
+
personProperties(properties: {
|
|
176
|
+
[type: string]: string;
|
|
177
|
+
}): void;
|
|
178
|
+
setGroupPropertiesForFlags(properties: {
|
|
179
|
+
[type: string]: Record<string, string>;
|
|
180
|
+
}): void;
|
|
181
|
+
resetGroupPropertiesForFlags(): void;
|
|
182
|
+
/** @deprecated - Renamed to setGroupPropertiesForFlags */
|
|
183
|
+
groupProperties(properties: {
|
|
184
|
+
[type: string]: Record<string, string>;
|
|
185
|
+
}): void;
|
|
186
|
+
private remoteConfigAsync;
|
|
187
|
+
/***
|
|
188
|
+
*** FEATURE FLAGS
|
|
189
|
+
***/
|
|
190
|
+
private decideAsync;
|
|
191
|
+
private cacheSessionReplay;
|
|
192
|
+
private _remoteConfigAsync;
|
|
193
|
+
private _decideAsync;
|
|
194
|
+
private setKnownFeatureFlagDetails;
|
|
195
|
+
private getKnownFeatureFlagDetails;
|
|
196
|
+
private getKnownFeatureFlags;
|
|
197
|
+
private getKnownFeatureFlagPayloads;
|
|
198
|
+
private getBootstrappedFeatureFlagDetails;
|
|
199
|
+
private setBootstrappedFeatureFlagDetails;
|
|
200
|
+
private getBootstrappedFeatureFlags;
|
|
201
|
+
private getBootstrappedFeatureFlagPayloads;
|
|
202
|
+
getFeatureFlag(key: string): FeatureFlagValue | undefined;
|
|
203
|
+
getFeatureFlagPayload(key: string): JsonType | undefined;
|
|
204
|
+
getFeatureFlagPayloads(): PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
205
|
+
getFeatureFlags(): PostHogDecideResponse['featureFlags'] | undefined;
|
|
206
|
+
getFeatureFlagDetails(): PostHogFeatureFlagDetails | undefined;
|
|
207
|
+
getFeatureFlagsAndPayloads(): {
|
|
208
|
+
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
209
|
+
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
210
|
+
};
|
|
211
|
+
isFeatureEnabled(key: string): boolean | undefined;
|
|
212
|
+
reloadFeatureFlags(cb?: (err?: Error, flags?: PostHogDecideResponse['featureFlags']) => void): void;
|
|
213
|
+
reloadRemoteConfigAsync(): Promise<PostHogRemoteConfig | undefined>;
|
|
214
|
+
reloadFeatureFlagsAsync(sendAnonDistinctId?: boolean): Promise<PostHogDecideResponse['featureFlags'] | undefined>;
|
|
215
|
+
onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
|
|
216
|
+
onFeatureFlag(key: string, cb: (value: FeatureFlagValue) => void): () => void;
|
|
217
|
+
overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): Promise<void>;
|
|
218
|
+
/***
|
|
219
|
+
*** ERROR TRACKING
|
|
220
|
+
***/
|
|
221
|
+
captureException(error: unknown, additionalProperties?: {
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}): void;
|
|
224
|
+
/**
|
|
225
|
+
* Capture written user feedback for a LLM trace. Numeric values are converted to strings.
|
|
226
|
+
* @param traceId The trace ID to capture feedback for.
|
|
227
|
+
* @param userFeedback The feedback to capture.
|
|
228
|
+
*/
|
|
229
|
+
captureTraceFeedback(traceId: string | number, userFeedback: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Capture a metric for a LLM trace. Numeric values are converted to strings.
|
|
232
|
+
* @param traceId The trace ID to capture the metric for.
|
|
233
|
+
* @param metricName The name of the metric to capture.
|
|
234
|
+
* @param metricValue The value of the metric to capture.
|
|
235
|
+
*/
|
|
236
|
+
captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void;
|
|
237
|
+
}
|
|
238
|
+
export * from './types';
|
|
239
|
+
export { LZString };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const LZString: {
|
|
2
|
-
compressToBase64: (input: any) => string;
|
|
3
|
-
decompressFromBase64: (input: any) => any;
|
|
4
|
-
compress: (uncompressed: any) => any;
|
|
5
|
-
_compress: (uncompressed: any, bitsPerChar: any, getCharFromInt: any) => any;
|
|
6
|
-
decompress: (compressed: any) => any;
|
|
7
|
-
_decompress: (length: any, resetValue: any, getNextValue: any) => any;
|
|
8
|
-
};
|
|
1
|
+
export declare const LZString: {
|
|
2
|
+
compressToBase64: (input: any) => string;
|
|
3
|
+
decompressFromBase64: (input: any) => any;
|
|
4
|
+
compress: (uncompressed: any) => any;
|
|
5
|
+
_compress: (uncompressed: any, bitsPerChar: any, getCharFromInt: any) => any;
|
|
6
|
+
decompress: (compressed: any) => any;
|
|
7
|
+
_decompress: (length: any, resetValue: any, getNextValue: any) => any;
|
|
8
|
+
};
|