posthog-react-native 3.15.0 → 3.15.1
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/posthog-core/src/eventemitter.d.ts +8 -8
- package/lib/posthog-core/src/eventemitter.js +1 -0
- package/lib/posthog-core/src/eventemitter.js.map +1 -0
- package/lib/posthog-core/src/featureFlagUtils.d.ts +34 -34
- package/lib/posthog-core/src/featureFlagUtils.js +1 -0
- package/lib/posthog-core/src/featureFlagUtils.js.map +1 -0
- package/lib/posthog-core/src/index.d.ts +242 -239
- package/lib/posthog-core/src/index.js +1 -0
- package/lib/posthog-core/src/index.js.map +1 -0
- package/lib/posthog-core/src/lz-string.d.ts +8 -8
- package/lib/posthog-core/src/lz-string.js +1 -0
- package/lib/posthog-core/src/lz-string.js.map +1 -0
- package/lib/posthog-core/src/types.d.ts +422 -423
- package/lib/posthog-core/src/types.js +1 -0
- package/lib/posthog-core/src/types.js.map +1 -0
- package/lib/posthog-core/src/utils.d.ts +19 -19
- package/lib/posthog-core/src/utils.js +1 -0
- package/lib/posthog-core/src/utils.js.map +1 -0
- package/lib/posthog-core/src/vendor/uuidv7.d.ts +179 -179
- package/lib/posthog-core/src/vendor/uuidv7.js +7 -0
- package/lib/posthog-core/src/vendor/uuidv7.js.map +1 -0
- package/lib/posthog-react-native/index.d.ts +10 -10
- package/lib/posthog-react-native/index.js +1 -0
- package/lib/posthog-react-native/index.js.map +1 -0
- package/lib/posthog-react-native/src/PostHogContext.d.ts +5 -5
- package/lib/posthog-react-native/src/PostHogContext.js +1 -0
- package/lib/posthog-react-native/src/PostHogContext.js.map +1 -0
- package/lib/posthog-react-native/src/PostHogProvider.d.ts +14 -14
- package/lib/posthog-react-native/src/PostHogProvider.js +1 -0
- package/lib/posthog-react-native/src/PostHogProvider.js.map +1 -0
- package/lib/posthog-react-native/src/autocapture.d.ts +4 -4
- package/lib/posthog-react-native/src/autocapture.js +1 -0
- package/lib/posthog-react-native/src/autocapture.js.map +1 -0
- package/lib/posthog-react-native/src/frameworks/wix-navigation.d.ts +3 -3
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js +1 -0
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.d.ts +5 -5
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.d.ts +3 -3
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.d.ts +6 -6
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js +1 -0
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js.map +1 -0
- package/lib/posthog-react-native/src/hooks/usePostHog.d.ts +2 -2
- package/lib/posthog-react-native/src/hooks/usePostHog.js +1 -0
- package/lib/posthog-react-native/src/hooks/usePostHog.js.map +1 -0
- package/lib/posthog-react-native/src/legacy.d.ts +4 -4
- package/lib/posthog-react-native/src/legacy.js +1 -0
- package/lib/posthog-react-native/src/legacy.js.map +1 -0
- package/lib/posthog-react-native/src/native-deps.d.ts +4 -4
- package/lib/posthog-react-native/src/native-deps.js +1 -0
- package/lib/posthog-react-native/src/native-deps.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.d.ts +13 -13
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js.map +1 -0
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.d.ts +2 -2
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js +1 -0
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js.map +1 -0
- package/lib/posthog-react-native/src/posthog-rn.d.ts +71 -71
- package/lib/posthog-react-native/src/posthog-rn.js +1 -0
- package/lib/posthog-react-native/src/posthog-rn.js.map +1 -0
- package/lib/posthog-react-native/src/storage.d.ts +21 -21
- package/lib/posthog-react-native/src/storage.js +1 -0
- package/lib/posthog-react-native/src/storage.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.d.ts +16 -16
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js +1 -0
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/BottomSection.d.ts +9 -9
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/Cancel.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/components/Cancel.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/Cancel.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.d.ts +7 -7
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.d.ts +27 -27
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.d.ts +10 -10
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/components/Surveys.d.ts +14 -14
- package/lib/posthog-react-native/src/surveys/components/Surveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/components/Surveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.d.ts +2 -2
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/icons.d.ts +8 -10
- package/lib/posthog-react-native/src/surveys/icons.js +1 -0
- package/lib/posthog-react-native/src/surveys/icons.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/index.d.ts +6 -6
- package/lib/posthog-react-native/src/surveys/index.js +1 -0
- package/lib/posthog-react-native/src/surveys/index.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/surveys-utils.d.ts +13 -13
- package/lib/posthog-react-native/src/surveys/surveys-utils.js +1 -0
- package/lib/posthog-react-native/src/surveys/surveys-utils.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.d.ts +3 -3
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js +1 -0
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js.map +1 -0
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.d.ts +8 -8
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js +1 -0
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js.map +1 -0
- package/lib/posthog-react-native/src/types.d.ts +112 -112
- package/lib/posthog-react-native/src/types.js +1 -0
- package/lib/posthog-react-native/src/types.js.map +1 -0
- package/lib/posthog-react-native/src/version.d.ts +1 -1
- package/lib/posthog-react-native/src/version.js +1 -0
- package/lib/posthog-react-native/src/version.js.map +1 -0
- package/lib/posthog-react-native/tsconfig.tsbuildinfo +1 -0
- package/package.json +8 -9
- package/lib/index.cjs.js +0 -4677
- package/lib/index.cjs.js.map +0 -1
- package/lib/index.d.ts +0 -875
- package/lib/index.esm.js +0 -4659
- package/lib/index.esm.js.map +0 -1
- package/lib/posthog-react-native/test/test-utils.d.ts +0 -2
package/lib/index.d.ts
DELETED
|
@@ -1,875 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-native" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
import PostHogReactNativeSessionReplay from 'posthog-react-native-session-replay';
|
|
4
|
-
import { PostHogDecideResponse as PostHogDecideResponse$1 } from 'posthog-core';
|
|
5
|
-
import { FeatureFlagValue as FeatureFlagValue$1, JsonType as JsonType$1 } from 'posthog-core/src';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
8
|
-
|
|
9
|
-
type PostHogCoreOptions = {
|
|
10
|
-
/** PostHog API host, usually 'https://us.i.posthog.com' or 'https://eu.i.posthog.com' */
|
|
11
|
-
host?: string;
|
|
12
|
-
/** The number of events to queue before sending to PostHog (flushing) */
|
|
13
|
-
flushAt?: number;
|
|
14
|
-
/** The interval in milliseconds between periodic flushes */
|
|
15
|
-
flushInterval?: number;
|
|
16
|
-
/** The maximum number of queued messages to be flushed as part of a single batch (must be higher than `flushAt`) */
|
|
17
|
-
maxBatchSize?: number;
|
|
18
|
-
/** The maximum number of cached messages either in memory or on the local storage.
|
|
19
|
-
* Defaults to 1000, (must be higher than `flushAt`)
|
|
20
|
-
*/
|
|
21
|
-
maxQueueSize?: number;
|
|
22
|
-
/** If set to true the SDK is essentially disabled (useful for local environments where you don't want to track anything) */
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
/** If set to false the SDK will not track until the `optIn` function is called. */
|
|
25
|
-
defaultOptIn?: boolean;
|
|
26
|
-
/** Whether to track that `getFeatureFlag` was called (used by Experiments) */
|
|
27
|
-
sendFeatureFlagEvent?: boolean;
|
|
28
|
-
/** Whether to load feature flags when initialized or not */
|
|
29
|
-
preloadFeatureFlags?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to load remote config when initialized or not
|
|
32
|
-
* Experimental support
|
|
33
|
-
* Default: false - Remote config is loaded by default
|
|
34
|
-
*/
|
|
35
|
-
disableRemoteConfig?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to load surveys when initialized or not
|
|
38
|
-
* Experimental support
|
|
39
|
-
* Default: false - Surveys are loaded by default, but requires the `PostHogSurveyProvider` to be used
|
|
40
|
-
*/
|
|
41
|
-
disableSurveys?: boolean;
|
|
42
|
-
/** Option to bootstrap the library with given distinctId and feature flags */
|
|
43
|
-
bootstrap?: {
|
|
44
|
-
distinctId?: string;
|
|
45
|
-
isIdentifiedId?: boolean;
|
|
46
|
-
featureFlags?: Record<string, FeatureFlagValue>;
|
|
47
|
-
featureFlagPayloads?: Record<string, JsonType>;
|
|
48
|
-
};
|
|
49
|
-
/** How many times we will retry HTTP requests. Defaults to 3. */
|
|
50
|
-
fetchRetryCount?: number;
|
|
51
|
-
/** The delay between HTTP request retries, Defaults to 3 seconds. */
|
|
52
|
-
fetchRetryDelay?: number;
|
|
53
|
-
/** Timeout in milliseconds for any calls. Defaults to 10 seconds. */
|
|
54
|
-
requestTimeout?: number;
|
|
55
|
-
/** Timeout in milliseconds for feature flag calls. Defaults to 10 seconds for stateful clients, and 3 seconds for stateless. */
|
|
56
|
-
featureFlagsRequestTimeoutMs?: number;
|
|
57
|
-
/** Timeout in milliseconds for remote config calls. Defaults to 3 seconds. */
|
|
58
|
-
remoteConfigRequestTimeoutMs?: number;
|
|
59
|
-
/** For Session Analysis how long before we expire a session (defaults to 30 mins) */
|
|
60
|
-
sessionExpirationTimeSeconds?: number;
|
|
61
|
-
/** Whether to post events to PostHog in JSON or compressed format. Defaults to 'json' */
|
|
62
|
-
captureMode?: 'json' | 'form';
|
|
63
|
-
disableGeoip?: boolean;
|
|
64
|
-
/** Special flag to indicate ingested data is for a historical migration. */
|
|
65
|
-
historicalMigration?: boolean;
|
|
66
|
-
};
|
|
67
|
-
declare enum PostHogPersistedProperty {
|
|
68
|
-
AnonymousId = "anonymous_id",
|
|
69
|
-
DistinctId = "distinct_id",
|
|
70
|
-
Props = "props",
|
|
71
|
-
FeatureFlagDetails = "feature_flag_details",
|
|
72
|
-
FeatureFlags = "feature_flags",
|
|
73
|
-
FeatureFlagPayloads = "feature_flag_payloads",
|
|
74
|
-
BootstrapFeatureFlagDetails = "bootstrap_feature_flag_details",
|
|
75
|
-
BootstrapFeatureFlags = "bootstrap_feature_flags",
|
|
76
|
-
BootstrapFeatureFlagPayloads = "bootstrap_feature_flag_payloads",
|
|
77
|
-
OverrideFeatureFlags = "override_feature_flags",
|
|
78
|
-
Queue = "queue",
|
|
79
|
-
OptedOut = "opted_out",
|
|
80
|
-
SessionId = "session_id",
|
|
81
|
-
SessionLastTimestamp = "session_timestamp",
|
|
82
|
-
PersonProperties = "person_properties",
|
|
83
|
-
GroupProperties = "group_properties",
|
|
84
|
-
InstalledAppBuild = "installed_app_build",
|
|
85
|
-
InstalledAppVersion = "installed_app_version",
|
|
86
|
-
SessionReplay = "session_replay",
|
|
87
|
-
DecideEndpointWasHit = "decide_endpoint_was_hit",
|
|
88
|
-
SurveyLastSeenDate = "survey_last_seen_date",
|
|
89
|
-
SurveysSeen = "surveys_seen",
|
|
90
|
-
Surveys = "surveys",
|
|
91
|
-
RemoteConfig = "remote_config"
|
|
92
|
-
}
|
|
93
|
-
type PostHogFetchOptions = {
|
|
94
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
95
|
-
mode?: 'no-cors';
|
|
96
|
-
credentials?: 'omit';
|
|
97
|
-
headers: {
|
|
98
|
-
[key: string]: string;
|
|
99
|
-
};
|
|
100
|
-
body?: string;
|
|
101
|
-
signal?: AbortSignal;
|
|
102
|
-
};
|
|
103
|
-
type PostHogCaptureOptions = {
|
|
104
|
-
/** If provided overrides the auto-generated event ID */
|
|
105
|
-
uuid?: string;
|
|
106
|
-
/** If provided overrides the auto-generated timestamp */
|
|
107
|
-
timestamp?: Date;
|
|
108
|
-
disableGeoip?: boolean;
|
|
109
|
-
};
|
|
110
|
-
type PostHogFetchResponse = {
|
|
111
|
-
status: number;
|
|
112
|
-
text: () => Promise<string>;
|
|
113
|
-
json: () => Promise<any>;
|
|
114
|
-
};
|
|
115
|
-
type PostHogEventProperties = {
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
};
|
|
118
|
-
type PostHogAutocaptureElement = {
|
|
119
|
-
$el_text?: string;
|
|
120
|
-
tag_name: string;
|
|
121
|
-
href?: string;
|
|
122
|
-
nth_child?: number;
|
|
123
|
-
nth_of_type?: number;
|
|
124
|
-
order?: number;
|
|
125
|
-
} & {
|
|
126
|
-
[key: string]: any;
|
|
127
|
-
};
|
|
128
|
-
type PostHogRemoteConfig = {
|
|
129
|
-
sessionRecording?: boolean | {
|
|
130
|
-
[key: string]: JsonType;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Whether surveys are enabled
|
|
134
|
-
*/
|
|
135
|
-
surveys?: boolean | Survey[];
|
|
136
|
-
/**
|
|
137
|
-
* Indicates if the team has any flags enabled (if not we don't need to load them)
|
|
138
|
-
*/
|
|
139
|
-
hasFeatureFlags?: boolean;
|
|
140
|
-
};
|
|
141
|
-
type FeatureFlagValue = string | boolean;
|
|
142
|
-
type PostHogDecideResponse = Omit<PostHogRemoteConfig, 'surveys' | 'hasFeatureFlags'> & {
|
|
143
|
-
featureFlags: {
|
|
144
|
-
[key: string]: FeatureFlagValue;
|
|
145
|
-
};
|
|
146
|
-
featureFlagPayloads: {
|
|
147
|
-
[key: string]: JsonType;
|
|
148
|
-
};
|
|
149
|
-
flags: {
|
|
150
|
-
[key: string]: FeatureFlagDetail;
|
|
151
|
-
};
|
|
152
|
-
errorsWhileComputingFlags: boolean;
|
|
153
|
-
sessionRecording?: boolean | {
|
|
154
|
-
[key: string]: JsonType;
|
|
155
|
-
};
|
|
156
|
-
quotaLimited?: string[];
|
|
157
|
-
requestId?: string;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Creates a type with all properties of T, but makes only K properties required while the rest remain optional.
|
|
161
|
-
*
|
|
162
|
-
* @template T - The base type containing all properties
|
|
163
|
-
* @template K - Union type of keys from T that should be required
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* interface User {
|
|
167
|
-
* id: number;
|
|
168
|
-
* name: string;
|
|
169
|
-
* email?: string;
|
|
170
|
-
* age?: number;
|
|
171
|
-
* }
|
|
172
|
-
*
|
|
173
|
-
* // Makes 'id' and 'name' required, but 'email' and 'age' optional
|
|
174
|
-
* type RequiredUser = PartialWithRequired<User, 'id' | 'name'>;
|
|
175
|
-
*
|
|
176
|
-
* const user: RequiredUser = {
|
|
177
|
-
* id: 1, // Must be provided
|
|
178
|
-
* name: "John" // Must be provided
|
|
179
|
-
* // email and age are optional
|
|
180
|
-
* };
|
|
181
|
-
*/
|
|
182
|
-
type PartialWithRequired<T, K extends keyof T> = {
|
|
183
|
-
[P in K]: T[P];
|
|
184
|
-
} & {
|
|
185
|
-
[P in Exclude<keyof T, K>]?: T[P];
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* These are the fields we care about from PostHogDecideResponse for feature flags.
|
|
189
|
-
*/
|
|
190
|
-
type PostHogFeatureFlagDetails = PartialWithRequired<PostHogDecideResponse, 'flags' | 'featureFlags' | 'featureFlagPayloads' | 'requestId'>;
|
|
191
|
-
type JsonType = string | number | boolean | null | {
|
|
192
|
-
[key: string]: JsonType;
|
|
193
|
-
} | Array<JsonType>;
|
|
194
|
-
type FeatureFlagDetail = {
|
|
195
|
-
key: string;
|
|
196
|
-
enabled: boolean;
|
|
197
|
-
variant: string | undefined;
|
|
198
|
-
reason: EvaluationReason | undefined;
|
|
199
|
-
metadata: FeatureFlagMetadata | undefined;
|
|
200
|
-
};
|
|
201
|
-
type FeatureFlagMetadata = {
|
|
202
|
-
id: number | undefined;
|
|
203
|
-
version: number | undefined;
|
|
204
|
-
description: string | undefined;
|
|
205
|
-
payload: string | undefined;
|
|
206
|
-
};
|
|
207
|
-
type EvaluationReason = {
|
|
208
|
-
code: string | undefined;
|
|
209
|
-
condition_index: number | undefined;
|
|
210
|
-
description: string | undefined;
|
|
211
|
-
};
|
|
212
|
-
type SurveyAppearance = {
|
|
213
|
-
backgroundColor?: string;
|
|
214
|
-
submitButtonColor?: string;
|
|
215
|
-
submitButtonText?: string;
|
|
216
|
-
submitButtonTextColor?: string;
|
|
217
|
-
ratingButtonColor?: string;
|
|
218
|
-
ratingButtonActiveColor?: string;
|
|
219
|
-
autoDisappear?: boolean;
|
|
220
|
-
displayThankYouMessage?: boolean;
|
|
221
|
-
thankYouMessageHeader?: string;
|
|
222
|
-
thankYouMessageDescription?: string;
|
|
223
|
-
thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType;
|
|
224
|
-
thankYouMessageCloseButtonText?: string;
|
|
225
|
-
borderColor?: string;
|
|
226
|
-
position?: SurveyPosition;
|
|
227
|
-
placeholder?: string;
|
|
228
|
-
shuffleQuestions?: boolean;
|
|
229
|
-
surveyPopupDelaySeconds?: number;
|
|
230
|
-
widgetType?: SurveyWidgetType;
|
|
231
|
-
widgetSelector?: string;
|
|
232
|
-
widgetLabel?: string;
|
|
233
|
-
widgetColor?: string;
|
|
234
|
-
};
|
|
235
|
-
declare enum SurveyPosition {
|
|
236
|
-
Left = "left",
|
|
237
|
-
Right = "right",
|
|
238
|
-
Center = "center"
|
|
239
|
-
}
|
|
240
|
-
declare enum SurveyWidgetType {
|
|
241
|
-
Button = "button",
|
|
242
|
-
Tab = "tab",
|
|
243
|
-
Selector = "selector"
|
|
244
|
-
}
|
|
245
|
-
declare enum SurveyType {
|
|
246
|
-
Popover = "popover",
|
|
247
|
-
API = "api",
|
|
248
|
-
Widget = "widget"
|
|
249
|
-
}
|
|
250
|
-
type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion;
|
|
251
|
-
declare enum SurveyQuestionDescriptionContentType {
|
|
252
|
-
Html = "html",
|
|
253
|
-
Text = "text"
|
|
254
|
-
}
|
|
255
|
-
type SurveyQuestionBase = {
|
|
256
|
-
question: string;
|
|
257
|
-
id?: string;
|
|
258
|
-
description?: string;
|
|
259
|
-
descriptionContentType?: SurveyQuestionDescriptionContentType;
|
|
260
|
-
optional?: boolean;
|
|
261
|
-
buttonText?: string;
|
|
262
|
-
originalQuestionIndex: number;
|
|
263
|
-
branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching;
|
|
264
|
-
};
|
|
265
|
-
type BasicSurveyQuestion = SurveyQuestionBase & {
|
|
266
|
-
type: SurveyQuestionType.Open;
|
|
267
|
-
};
|
|
268
|
-
type LinkSurveyQuestion = SurveyQuestionBase & {
|
|
269
|
-
type: SurveyQuestionType.Link;
|
|
270
|
-
link?: string;
|
|
271
|
-
};
|
|
272
|
-
type RatingSurveyQuestion = SurveyQuestionBase & {
|
|
273
|
-
type: SurveyQuestionType.Rating;
|
|
274
|
-
display: SurveyRatingDisplay;
|
|
275
|
-
scale: 3 | 5 | 7 | 10;
|
|
276
|
-
lowerBoundLabel: string;
|
|
277
|
-
upperBoundLabel: string;
|
|
278
|
-
};
|
|
279
|
-
declare enum SurveyRatingDisplay {
|
|
280
|
-
Number = "number",
|
|
281
|
-
Emoji = "emoji"
|
|
282
|
-
}
|
|
283
|
-
type MultipleSurveyQuestion = SurveyQuestionBase & {
|
|
284
|
-
type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice;
|
|
285
|
-
choices: string[];
|
|
286
|
-
hasOpenChoice?: boolean;
|
|
287
|
-
shuffleOptions?: boolean;
|
|
288
|
-
};
|
|
289
|
-
declare enum SurveyQuestionType {
|
|
290
|
-
Open = "open",
|
|
291
|
-
MultipleChoice = "multiple_choice",
|
|
292
|
-
SingleChoice = "single_choice",
|
|
293
|
-
Rating = "rating",
|
|
294
|
-
Link = "link"
|
|
295
|
-
}
|
|
296
|
-
declare enum SurveyQuestionBranchingType {
|
|
297
|
-
NextQuestion = "next_question",
|
|
298
|
-
End = "end",
|
|
299
|
-
ResponseBased = "response_based",
|
|
300
|
-
SpecificQuestion = "specific_question"
|
|
301
|
-
}
|
|
302
|
-
type NextQuestionBranching = {
|
|
303
|
-
type: SurveyQuestionBranchingType.NextQuestion;
|
|
304
|
-
};
|
|
305
|
-
type EndBranching = {
|
|
306
|
-
type: SurveyQuestionBranchingType.End;
|
|
307
|
-
};
|
|
308
|
-
type ResponseBasedBranching = {
|
|
309
|
-
type: SurveyQuestionBranchingType.ResponseBased;
|
|
310
|
-
responseValues: Record<string, any>;
|
|
311
|
-
};
|
|
312
|
-
type SpecificQuestionBranching = {
|
|
313
|
-
type: SurveyQuestionBranchingType.SpecificQuestion;
|
|
314
|
-
index: number;
|
|
315
|
-
};
|
|
316
|
-
type SurveyResponse = {
|
|
317
|
-
surveys: Survey[];
|
|
318
|
-
};
|
|
319
|
-
declare enum SurveyMatchType {
|
|
320
|
-
Regex = "regex",
|
|
321
|
-
NotRegex = "not_regex",
|
|
322
|
-
Exact = "exact",
|
|
323
|
-
IsNot = "is_not",
|
|
324
|
-
Icontains = "icontains",
|
|
325
|
-
NotIcontains = "not_icontains"
|
|
326
|
-
}
|
|
327
|
-
type Survey = {
|
|
328
|
-
id: string;
|
|
329
|
-
name: string;
|
|
330
|
-
description?: string;
|
|
331
|
-
type: SurveyType;
|
|
332
|
-
feature_flag_keys?: {
|
|
333
|
-
key: string;
|
|
334
|
-
value?: string;
|
|
335
|
-
}[];
|
|
336
|
-
linked_flag_key?: string;
|
|
337
|
-
targeting_flag_key?: string;
|
|
338
|
-
internal_targeting_flag_key?: string;
|
|
339
|
-
questions: SurveyQuestion[];
|
|
340
|
-
appearance?: SurveyAppearance;
|
|
341
|
-
conditions?: {
|
|
342
|
-
url?: string;
|
|
343
|
-
selector?: string;
|
|
344
|
-
seenSurveyWaitPeriodInDays?: number;
|
|
345
|
-
urlMatchType?: SurveyMatchType;
|
|
346
|
-
events?: {
|
|
347
|
-
repeatedActivation?: boolean;
|
|
348
|
-
values?: {
|
|
349
|
-
name: string;
|
|
350
|
-
}[];
|
|
351
|
-
};
|
|
352
|
-
actions?: {
|
|
353
|
-
values: SurveyActionType[];
|
|
354
|
-
};
|
|
355
|
-
deviceTypes?: string[];
|
|
356
|
-
deviceTypesMatchType?: SurveyMatchType;
|
|
357
|
-
};
|
|
358
|
-
start_date?: string;
|
|
359
|
-
end_date?: string;
|
|
360
|
-
current_iteration?: number;
|
|
361
|
-
current_iteration_start_date?: string;
|
|
362
|
-
};
|
|
363
|
-
type SurveyActionType = {
|
|
364
|
-
id: number;
|
|
365
|
-
name?: string;
|
|
366
|
-
steps?: ActionStepType[];
|
|
367
|
-
};
|
|
368
|
-
/** Sync with plugin-server/src/types.ts */
|
|
369
|
-
declare enum ActionStepStringMatching {
|
|
370
|
-
Contains = "contains",
|
|
371
|
-
Exact = "exact",
|
|
372
|
-
Regex = "regex"
|
|
373
|
-
}
|
|
374
|
-
type ActionStepType = {
|
|
375
|
-
event?: string;
|
|
376
|
-
selector?: string;
|
|
377
|
-
/** @deprecated Only `selector` should be used now. */
|
|
378
|
-
tag_name?: string;
|
|
379
|
-
text?: string;
|
|
380
|
-
/** @default StringMatching.Exact */
|
|
381
|
-
text_matching?: ActionStepStringMatching;
|
|
382
|
-
href?: string;
|
|
383
|
-
/** @default ActionStepStringMatching.Exact */
|
|
384
|
-
href_matching?: ActionStepStringMatching;
|
|
385
|
-
url?: string;
|
|
386
|
-
/** @default StringMatching.Contains */
|
|
387
|
-
url_matching?: ActionStepStringMatching;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
interface RetriableOptions {
|
|
391
|
-
retryCount: number;
|
|
392
|
-
retryDelay: number;
|
|
393
|
-
retryCheck: (err: any) => boolean;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
declare class SimpleEventEmitter {
|
|
397
|
-
events: {
|
|
398
|
-
[key: string]: ((...args: any[]) => void)[];
|
|
399
|
-
};
|
|
400
|
-
constructor();
|
|
401
|
-
on(event: string, listener: (...args: any[]) => void): () => void;
|
|
402
|
-
emit(event: string, payload: any): void;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
declare abstract class PostHogCoreStateless {
|
|
406
|
-
readonly apiKey: string;
|
|
407
|
-
readonly host: string;
|
|
408
|
-
readonly flushAt: number;
|
|
409
|
-
readonly preloadFeatureFlags: boolean;
|
|
410
|
-
readonly disableSurveys: boolean;
|
|
411
|
-
private maxBatchSize;
|
|
412
|
-
private maxQueueSize;
|
|
413
|
-
private flushInterval;
|
|
414
|
-
private flushPromise;
|
|
415
|
-
private requestTimeout;
|
|
416
|
-
private featureFlagsRequestTimeoutMs;
|
|
417
|
-
private remoteConfigRequestTimeoutMs;
|
|
418
|
-
private captureMode;
|
|
419
|
-
private removeDebugCallback?;
|
|
420
|
-
private disableGeoip;
|
|
421
|
-
private historicalMigration;
|
|
422
|
-
protected disabled: boolean;
|
|
423
|
-
private defaultOptIn;
|
|
424
|
-
private pendingPromises;
|
|
425
|
-
protected _events: SimpleEventEmitter;
|
|
426
|
-
protected _flushTimer?: any;
|
|
427
|
-
protected _retryOptions: RetriableOptions;
|
|
428
|
-
protected _initPromise: Promise<void>;
|
|
429
|
-
protected _isInitialized: boolean;
|
|
430
|
-
protected _remoteConfigResponsePromise?: Promise<PostHogRemoteConfig | undefined>;
|
|
431
|
-
abstract fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
432
|
-
abstract getLibraryId(): string;
|
|
433
|
-
abstract getLibraryVersion(): string;
|
|
434
|
-
abstract getCustomUserAgent(): string | void;
|
|
435
|
-
abstract getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
436
|
-
abstract setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
437
|
-
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
438
|
-
protected logMsgIfDebug(fn: () => void): void;
|
|
439
|
-
protected wrap(fn: () => void): void;
|
|
440
|
-
protected getCommonEventProperties(): any;
|
|
441
|
-
get optedOut(): boolean;
|
|
442
|
-
optIn(): Promise<void>;
|
|
443
|
-
optOut(): Promise<void>;
|
|
444
|
-
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
445
|
-
debug(enabled?: boolean): void;
|
|
446
|
-
get isDebug(): boolean;
|
|
447
|
-
get isDisabled(): boolean;
|
|
448
|
-
private buildPayload;
|
|
449
|
-
protected addPendingPromise<T>(promise: Promise<T>): Promise<T>;
|
|
450
|
-
/***
|
|
451
|
-
*** TRACKING
|
|
452
|
-
***/
|
|
453
|
-
protected identifyStateless(distinctId: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
454
|
-
protected captureStateless(distinctId: string, event: string, properties?: {
|
|
455
|
-
[key: string]: any;
|
|
456
|
-
}, options?: PostHogCaptureOptions): void;
|
|
457
|
-
protected aliasStateless(alias: string, distinctId: string, properties?: {
|
|
458
|
-
[key: string]: any;
|
|
459
|
-
}, options?: PostHogCaptureOptions): void;
|
|
460
|
-
/***
|
|
461
|
-
*** GROUPS
|
|
462
|
-
***/
|
|
463
|
-
protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): void;
|
|
464
|
-
protected getRemoteConfig(): Promise<PostHogRemoteConfig | undefined>;
|
|
465
|
-
/***
|
|
466
|
-
*** FEATURE FLAGS
|
|
467
|
-
***/
|
|
468
|
-
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>;
|
|
469
|
-
protected getFeatureFlagStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
470
|
-
response: FeatureFlagValue | undefined;
|
|
471
|
-
requestId: string | undefined;
|
|
472
|
-
}>;
|
|
473
|
-
protected getFeatureFlagDetailStateless(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean): Promise<{
|
|
474
|
-
response: FeatureFlagDetail | undefined;
|
|
475
|
-
requestId: string | undefined;
|
|
476
|
-
} | undefined>;
|
|
477
|
-
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>;
|
|
478
|
-
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>;
|
|
479
|
-
protected getFeatureFlagsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
480
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
481
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
482
|
-
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
483
|
-
}>;
|
|
484
|
-
protected getFeatureFlagsAndPayloadsStateless(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, disableGeoip?: boolean, flagKeysToEvaluate?: string[]): Promise<{
|
|
485
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
486
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
487
|
-
requestId: PostHogDecideResponse['requestId'] | undefined;
|
|
488
|
-
}>;
|
|
489
|
-
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>;
|
|
490
|
-
/***
|
|
491
|
-
*** SURVEYS
|
|
492
|
-
***/
|
|
493
|
-
getSurveysStateless(): Promise<SurveyResponse['surveys']>;
|
|
494
|
-
/***
|
|
495
|
-
*** QUEUEING AND FLUSHING
|
|
496
|
-
***/
|
|
497
|
-
protected enqueue(type: string, _message: any, options?: PostHogCaptureOptions): void;
|
|
498
|
-
private clearFlushTimer;
|
|
499
|
-
/**
|
|
500
|
-
* Helper for flushing the queue in the background
|
|
501
|
-
* Avoids unnecessary promise errors
|
|
502
|
-
*/
|
|
503
|
-
private flushBackground;
|
|
504
|
-
flush(): Promise<any[]>;
|
|
505
|
-
protected getCustomHeaders(): {
|
|
506
|
-
[key: string]: string;
|
|
507
|
-
};
|
|
508
|
-
private _flush;
|
|
509
|
-
private fetchWithRetry;
|
|
510
|
-
shutdown(shutdownTimeoutMs?: number): Promise<void>;
|
|
511
|
-
}
|
|
512
|
-
declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
513
|
-
private sendFeatureFlagEvent;
|
|
514
|
-
private flagCallReported;
|
|
515
|
-
protected _decideResponsePromise?: Promise<PostHogDecideResponse | undefined>;
|
|
516
|
-
protected _sessionExpirationTimeSeconds: number;
|
|
517
|
-
protected sessionProps: PostHogEventProperties;
|
|
518
|
-
constructor(apiKey: string, options?: PostHogCoreOptions);
|
|
519
|
-
protected setupBootstrap(options?: Partial<PostHogCoreOptions>): void;
|
|
520
|
-
private get props();
|
|
521
|
-
private set props(value);
|
|
522
|
-
private clearProps;
|
|
523
|
-
private _props;
|
|
524
|
-
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
525
|
-
reset(propertiesToKeep?: PostHogPersistedProperty[]): void;
|
|
526
|
-
protected getCommonEventProperties(): any;
|
|
527
|
-
private enrichProperties;
|
|
528
|
-
/**
|
|
529
|
-
* * @returns {string} The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.
|
|
530
|
-
*/
|
|
531
|
-
getSessionId(): string;
|
|
532
|
-
resetSessionId(): void;
|
|
533
|
-
/**
|
|
534
|
-
* * @returns {string} The stored anonymous ID. This may be an empty string if the client is not yet fully initialized.
|
|
535
|
-
*/
|
|
536
|
-
getAnonymousId(): string;
|
|
537
|
-
/**
|
|
538
|
-
* * @returns {string} The stored distinct ID. This may be an empty string if the client is not yet fully initialized.
|
|
539
|
-
*/
|
|
540
|
-
getDistinctId(): string;
|
|
541
|
-
unregister(property: string): Promise<void>;
|
|
542
|
-
register(properties: {
|
|
543
|
-
[key: string]: any;
|
|
544
|
-
}): Promise<void>;
|
|
545
|
-
registerForSession(properties: {
|
|
546
|
-
[key: string]: any;
|
|
547
|
-
}): void;
|
|
548
|
-
unregisterForSession(property: string): void;
|
|
549
|
-
/***
|
|
550
|
-
*** TRACKING
|
|
551
|
-
***/
|
|
552
|
-
identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
553
|
-
capture(event: string, properties?: {
|
|
554
|
-
[key: string]: any;
|
|
555
|
-
}, options?: PostHogCaptureOptions): void;
|
|
556
|
-
alias(alias: string): void;
|
|
557
|
-
autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
558
|
-
/***
|
|
559
|
-
*** GROUPS
|
|
560
|
-
***/
|
|
561
|
-
groups(groups: {
|
|
562
|
-
[type: string]: string | number;
|
|
563
|
-
}): void;
|
|
564
|
-
group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
565
|
-
groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
566
|
-
/***
|
|
567
|
-
* PROPERTIES
|
|
568
|
-
***/
|
|
569
|
-
setPersonPropertiesForFlags(properties: {
|
|
570
|
-
[type: string]: string;
|
|
571
|
-
}): void;
|
|
572
|
-
resetPersonPropertiesForFlags(): void;
|
|
573
|
-
/** @deprecated - Renamed to setPersonPropertiesForFlags */
|
|
574
|
-
personProperties(properties: {
|
|
575
|
-
[type: string]: string;
|
|
576
|
-
}): void;
|
|
577
|
-
setGroupPropertiesForFlags(properties: {
|
|
578
|
-
[type: string]: Record<string, string>;
|
|
579
|
-
}): void;
|
|
580
|
-
resetGroupPropertiesForFlags(): void;
|
|
581
|
-
/** @deprecated - Renamed to setGroupPropertiesForFlags */
|
|
582
|
-
groupProperties(properties: {
|
|
583
|
-
[type: string]: Record<string, string>;
|
|
584
|
-
}): void;
|
|
585
|
-
private remoteConfigAsync;
|
|
586
|
-
/***
|
|
587
|
-
*** FEATURE FLAGS
|
|
588
|
-
***/
|
|
589
|
-
private decideAsync;
|
|
590
|
-
private cacheSessionReplay;
|
|
591
|
-
private _remoteConfigAsync;
|
|
592
|
-
private _decideAsync;
|
|
593
|
-
private setKnownFeatureFlagDetails;
|
|
594
|
-
private getKnownFeatureFlagDetails;
|
|
595
|
-
private getKnownFeatureFlags;
|
|
596
|
-
private getKnownFeatureFlagPayloads;
|
|
597
|
-
private getBootstrappedFeatureFlagDetails;
|
|
598
|
-
private setBootstrappedFeatureFlagDetails;
|
|
599
|
-
private getBootstrappedFeatureFlags;
|
|
600
|
-
private getBootstrappedFeatureFlagPayloads;
|
|
601
|
-
getFeatureFlag(key: string): FeatureFlagValue | undefined;
|
|
602
|
-
getFeatureFlagPayload(key: string): JsonType | undefined;
|
|
603
|
-
getFeatureFlagPayloads(): PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
604
|
-
getFeatureFlags(): PostHogDecideResponse['featureFlags'] | undefined;
|
|
605
|
-
getFeatureFlagDetails(): PostHogFeatureFlagDetails | undefined;
|
|
606
|
-
getFeatureFlagsAndPayloads(): {
|
|
607
|
-
flags: PostHogDecideResponse['featureFlags'] | undefined;
|
|
608
|
-
payloads: PostHogDecideResponse['featureFlagPayloads'] | undefined;
|
|
609
|
-
};
|
|
610
|
-
isFeatureEnabled(key: string): boolean | undefined;
|
|
611
|
-
reloadFeatureFlags(cb?: (err?: Error, flags?: PostHogDecideResponse['featureFlags']) => void): void;
|
|
612
|
-
reloadRemoteConfigAsync(): Promise<PostHogRemoteConfig | undefined>;
|
|
613
|
-
reloadFeatureFlagsAsync(sendAnonDistinctId?: boolean): Promise<PostHogDecideResponse['featureFlags'] | undefined>;
|
|
614
|
-
onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
|
|
615
|
-
onFeatureFlag(key: string, cb: (value: FeatureFlagValue) => void): () => void;
|
|
616
|
-
overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): Promise<void>;
|
|
617
|
-
/***
|
|
618
|
-
*** ERROR TRACKING
|
|
619
|
-
***/
|
|
620
|
-
captureException(error: unknown, additionalProperties?: {
|
|
621
|
-
[key: string]: any;
|
|
622
|
-
}): void;
|
|
623
|
-
/**
|
|
624
|
-
* Capture written user feedback for a LLM trace. Numeric values are converted to strings.
|
|
625
|
-
* @param traceId The trace ID to capture feedback for.
|
|
626
|
-
* @param userFeedback The feedback to capture.
|
|
627
|
-
*/
|
|
628
|
-
captureTraceFeedback(traceId: string | number, userFeedback: string): void;
|
|
629
|
-
/**
|
|
630
|
-
* Capture a metric for a LLM trace. Numeric values are converted to strings.
|
|
631
|
-
* @param traceId The trace ID to capture the metric for.
|
|
632
|
-
* @param metricName The name of the metric to capture.
|
|
633
|
-
* @param metricValue The value of the metric to capture.
|
|
634
|
-
*/
|
|
635
|
-
captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
type PostHogAutocaptureNavigationTrackerOptions = {
|
|
639
|
-
routeToName?: (name: string, params: any) => string;
|
|
640
|
-
routeToProperties?: (name: string, params: any) => Record<string, any>;
|
|
641
|
-
};
|
|
642
|
-
type PostHogNavigationRef = {
|
|
643
|
-
getCurrentRoute(): any | undefined;
|
|
644
|
-
isReady: () => boolean;
|
|
645
|
-
};
|
|
646
|
-
type PostHogAutocaptureOptions = {
|
|
647
|
-
captureTouches?: boolean;
|
|
648
|
-
customLabelProp?: string;
|
|
649
|
-
noCaptureProp?: string;
|
|
650
|
-
maxElementsCaptured?: number;
|
|
651
|
-
ignoreLabels?: string[];
|
|
652
|
-
propsToCapture?: string[];
|
|
653
|
-
captureScreens?: boolean;
|
|
654
|
-
navigation?: PostHogAutocaptureNavigationTrackerOptions;
|
|
655
|
-
navigationRef?: PostHogNavigationRef;
|
|
656
|
-
/** Captures app lifecycle events such as Application Installed, Application Updated, Application Opened, Application Became Active and Application Backgrounded.
|
|
657
|
-
* By default is true.
|
|
658
|
-
* If you're already using the 'captureNativeAppLifecycleEvents' client option, you don't need to set this.
|
|
659
|
-
* If 'captureNativeAppLifecycleEvents' is set, the 'captureNativeAppLifecycleEvents' value has priority over this option.
|
|
660
|
-
* Application Installed and Application Updated events are not supported with persistence set to 'memory'.
|
|
661
|
-
*/
|
|
662
|
-
captureLifecycleEvents?: boolean;
|
|
663
|
-
};
|
|
664
|
-
interface PostHogCustomAppProperties {
|
|
665
|
-
/** Build number like "1.2.2" or "122" */
|
|
666
|
-
$app_build?: string | null;
|
|
667
|
-
/** Name of the app as displayed below the icon like "PostHog" */
|
|
668
|
-
$app_name?: string | null;
|
|
669
|
-
/** Namespace of the app usually like "com.posthog.app" */
|
|
670
|
-
$app_namespace?: string | null;
|
|
671
|
-
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
672
|
-
$app_version?: string | null;
|
|
673
|
-
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
674
|
-
$device_manufacturer?: string | null;
|
|
675
|
-
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
|
|
676
|
-
$device_name?: string | null;
|
|
677
|
-
/** Model identifier like "iPhone13,2" or "SM-S921B" */
|
|
678
|
-
$device_model?: string | null;
|
|
679
|
-
/** Device type ("Mobile" | "Desktop" | "Web") */
|
|
680
|
-
$device_type?: string | null;
|
|
681
|
-
/** Operating system name like iOS or Android */
|
|
682
|
-
$os_name?: string | null;
|
|
683
|
-
/** Operating system version "14.0" */
|
|
684
|
-
$os_version?: string | null;
|
|
685
|
-
/** Locale (language) of the device like "en-US" */
|
|
686
|
-
$locale?: string | null;
|
|
687
|
-
/** Timezone of the device like "Europe/Berlin" */
|
|
688
|
-
$timezone?: string | null;
|
|
689
|
-
}
|
|
690
|
-
type PostHogSessionReplayConfig = {
|
|
691
|
-
/**
|
|
692
|
-
* Enable masking of all text and text input fields
|
|
693
|
-
* Default: true
|
|
694
|
-
*/
|
|
695
|
-
maskAllTextInputs?: boolean;
|
|
696
|
-
/**
|
|
697
|
-
* Enable masking of all images to a placeholder
|
|
698
|
-
* Default: true
|
|
699
|
-
*/
|
|
700
|
-
maskAllImages?: boolean;
|
|
701
|
-
/**
|
|
702
|
-
* Enable masking of all sandboxed system views
|
|
703
|
-
* These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController
|
|
704
|
-
* iOS only
|
|
705
|
-
* Experimental support
|
|
706
|
-
* Default: true
|
|
707
|
-
*/
|
|
708
|
-
maskAllSandboxedViews?: boolean;
|
|
709
|
-
/**
|
|
710
|
-
* Enable masking of images that likely originated from user's photo library
|
|
711
|
-
* Experimental support (UIKit only)
|
|
712
|
-
* iOS only
|
|
713
|
-
* Default: false
|
|
714
|
-
*
|
|
715
|
-
* @deprecated This property has no effect and will be removed in the next major release. To learn how to manually mask user photos please see our Privacy controls documentation: https://posthog.com/docs/session-replay/privacy?tab=React+Native
|
|
716
|
-
*/
|
|
717
|
-
maskPhotoLibraryImages?: boolean;
|
|
718
|
-
/**
|
|
719
|
-
* Enable capturing of logcat as console events
|
|
720
|
-
* Android only
|
|
721
|
-
* Default: true
|
|
722
|
-
*/
|
|
723
|
-
captureLog?: boolean;
|
|
724
|
-
/**
|
|
725
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
726
|
-
* This is used for capturing the view as a screenshot
|
|
727
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
728
|
-
* Defaults to 1s on iOS
|
|
729
|
-
*/
|
|
730
|
-
iOSdebouncerDelayMs?: number;
|
|
731
|
-
/**
|
|
732
|
-
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
|
|
733
|
-
* This is used for capturing the view as a screenshot
|
|
734
|
-
* The lower the number more snapshots will be captured but higher the performance impact
|
|
735
|
-
* Defaults to 1000ms (1s)
|
|
736
|
-
* Ps: it was 500ms (0.5s) by default until version 3.3.7
|
|
737
|
-
*/
|
|
738
|
-
androidDebouncerDelayMs?: number;
|
|
739
|
-
/**
|
|
740
|
-
* Enable capturing network telemetry
|
|
741
|
-
* iOS only
|
|
742
|
-
* Default: true
|
|
743
|
-
*/
|
|
744
|
-
captureNetworkTelemetry?: boolean;
|
|
745
|
-
};
|
|
746
|
-
interface PostHogCustomStorage {
|
|
747
|
-
getItem: (key: string) => string | null | Promise<string | null>;
|
|
748
|
-
setItem: (key: string, value: string) => void | Promise<void>;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
declare let OptionalReactNativeSessionReplay: typeof PostHogReactNativeSessionReplay | undefined;
|
|
752
|
-
|
|
753
|
-
type PostHogOptions = PostHogCoreOptions & {
|
|
754
|
-
/** Allows you to provide the storage type. By default 'file'.
|
|
755
|
-
* 'file' will try to load the best available storage, the provided 'customStorage', 'customAsyncStorage' or in-memory storage.
|
|
756
|
-
*/
|
|
757
|
-
persistence?: 'memory' | 'file';
|
|
758
|
-
/** Allows you to provide your own implementation of the common information about your App or a function to modify the default App properties generated */
|
|
759
|
-
customAppProperties?: PostHogCustomAppProperties | ((properties: PostHogCustomAppProperties) => PostHogCustomAppProperties);
|
|
760
|
-
/** Allows you to provide a custom asynchronous storage such as async-storage, expo-file-system or a synchronous storage such as mmkv.
|
|
761
|
-
* If not provided, PostHog will attempt to use the best available storage via optional peer dependencies (async-storage, expo-file-system).
|
|
762
|
-
* If `persistence` is set to 'memory', this option will be ignored.
|
|
763
|
-
*/
|
|
764
|
-
customStorage?: PostHogCustomStorage;
|
|
765
|
-
/** Captures app lifecycle events such as Application Installed, Application Updated, Application Opened, Application Became Active and Application Backgrounded.
|
|
766
|
-
* By default is false.
|
|
767
|
-
* If you're already using the 'captureLifecycleEvents' options with 'withReactNativeNavigation' or 'PostHogProvider, you don't need to set this.
|
|
768
|
-
* If this is set, this value has priority over the 'captureLifecycleEvents' option.
|
|
769
|
-
* Application Installed and Application Updated events are not supported with persistence set to 'memory'.
|
|
770
|
-
*/
|
|
771
|
-
captureNativeAppLifecycleEvents?: boolean;
|
|
772
|
-
/**
|
|
773
|
-
* Enable Recording of Session Replays for Android and iOS
|
|
774
|
-
* Requires Record user sessions to be enabled in the PostHog Project Settings
|
|
775
|
-
* Defaults to false
|
|
776
|
-
*/
|
|
777
|
-
enableSessionReplay?: boolean;
|
|
778
|
-
/**
|
|
779
|
-
* Configuration for Session Replay
|
|
780
|
-
*/
|
|
781
|
-
sessionReplayConfig?: PostHogSessionReplayConfig;
|
|
782
|
-
/**
|
|
783
|
-
* If enabled, the session id ($session_id) will be persisted across app restarts.
|
|
784
|
-
* This is an option for back compatibility, so your current data isn't skewed with the new version of the SDK.
|
|
785
|
-
* If this is false, the session id will be always reset on app restart.
|
|
786
|
-
* Defaults to false
|
|
787
|
-
*/
|
|
788
|
-
enablePersistSessionIdAcrossRestart?: boolean;
|
|
789
|
-
};
|
|
790
|
-
declare class PostHog extends PostHogCore {
|
|
791
|
-
private _persistence;
|
|
792
|
-
private _storage;
|
|
793
|
-
private _appProperties;
|
|
794
|
-
private _currentSessionId?;
|
|
795
|
-
private _enableSessionReplay?;
|
|
796
|
-
private _disableSurveys;
|
|
797
|
-
private _disableRemoteConfig;
|
|
798
|
-
constructor(apiKey: string, options?: PostHogOptions);
|
|
799
|
-
ready(): Promise<void>;
|
|
800
|
-
getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
801
|
-
setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
802
|
-
fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
803
|
-
getLibraryId(): string;
|
|
804
|
-
getLibraryVersion(): string;
|
|
805
|
-
getCustomUserAgent(): string;
|
|
806
|
-
getCommonEventProperties(): any;
|
|
807
|
-
screen(name: string, properties?: {
|
|
808
|
-
[key: string]: any;
|
|
809
|
-
}, options?: PostHogCaptureOptions): Promise<void>;
|
|
810
|
-
_isEnableSessionReplay(): boolean;
|
|
811
|
-
_resetSessionId(reactNativeSessionReplay: typeof OptionalReactNativeSessionReplay | undefined, sessionId: string): void;
|
|
812
|
-
getSessionId(): string;
|
|
813
|
-
resetSessionId(): void;
|
|
814
|
-
identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
|
|
815
|
-
initReactNativeNavigation(options: PostHogAutocaptureOptions): boolean;
|
|
816
|
-
getSurveys(): Promise<SurveyResponse['surveys']>;
|
|
817
|
-
private startSessionReplay;
|
|
818
|
-
private captureNativeAppLifecycleEvents;
|
|
819
|
-
private persistAppVersion;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
declare function _useNavigationTracker(options?: PostHogAutocaptureNavigationTrackerOptions, navigationRef?: PostHogNavigationRef, client?: PostHog): void;
|
|
823
|
-
declare const useNavigationTracker: typeof _useNavigationTracker;
|
|
824
|
-
|
|
825
|
-
declare function useFeatureFlags(client?: PostHog): PostHogDecideResponse$1['featureFlags'] | undefined;
|
|
826
|
-
|
|
827
|
-
declare function useFeatureFlag(flag: string, client?: PostHog): FeatureFlagValue$1 | undefined;
|
|
828
|
-
type FeatureFlagWithPayload = [FeatureFlagValue$1 | undefined, JsonType$1 | undefined];
|
|
829
|
-
declare function useFeatureFlagWithPayload(flag: string, client?: PostHog): FeatureFlagWithPayload;
|
|
830
|
-
|
|
831
|
-
declare const usePostHog: () => PostHog;
|
|
832
|
-
|
|
833
|
-
interface PostHogProviderProps {
|
|
834
|
-
children: React.ReactNode;
|
|
835
|
-
options?: PostHogOptions;
|
|
836
|
-
apiKey?: string;
|
|
837
|
-
client?: PostHog;
|
|
838
|
-
autocapture?: boolean | PostHogAutocaptureOptions;
|
|
839
|
-
debug?: boolean;
|
|
840
|
-
style?: StyleProp<ViewStyle>;
|
|
841
|
-
}
|
|
842
|
-
declare const PostHogProvider: ({ children, client, options, apiKey, autocapture, style, debug, }: PostHogProviderProps) => JSX.Element | null;
|
|
843
|
-
|
|
844
|
-
type PostHogSurveyProviderProps = {
|
|
845
|
-
/**
|
|
846
|
-
* The default appearance for surveys when not specified in PostHog.
|
|
847
|
-
*/
|
|
848
|
-
defaultSurveyAppearance?: SurveyAppearance;
|
|
849
|
-
/**
|
|
850
|
-
* If true, PosHog appearance will be ignored and defaultSurveyAppearance is always used.
|
|
851
|
-
*/
|
|
852
|
-
overrideAppearanceWithDefault?: boolean;
|
|
853
|
-
client?: PostHog;
|
|
854
|
-
children: React.ReactNode;
|
|
855
|
-
};
|
|
856
|
-
declare function PostHogSurveyProvider(props: PostHogSurveyProviderProps): JSX.Element;
|
|
857
|
-
|
|
858
|
-
type SurveyAppearanceTheme = Omit<Required<SurveyAppearance>, 'widgetSelector' | 'widgetType' | 'widgetColor' | 'widgetLabel' | 'shuffleQuestions'>;
|
|
859
|
-
|
|
860
|
-
type SurveyModalProps = {
|
|
861
|
-
survey: Survey;
|
|
862
|
-
appearance: SurveyAppearanceTheme;
|
|
863
|
-
onShow: () => void;
|
|
864
|
-
onClose: (submitted: boolean) => void;
|
|
865
|
-
};
|
|
866
|
-
declare function SurveyModal(props: SurveyModalProps): JSX.Element | null;
|
|
867
|
-
|
|
868
|
-
declare function Questions({ survey, appearance, styleOverrides, onSubmit, }: {
|
|
869
|
-
survey: Survey;
|
|
870
|
-
appearance: SurveyAppearanceTheme;
|
|
871
|
-
styleOverrides?: StyleProp<ViewStyle>;
|
|
872
|
-
onSubmit: () => void;
|
|
873
|
-
}): JSX.Element;
|
|
874
|
-
|
|
875
|
-
export { FeatureFlagWithPayload, PostHog, PostHogAutocaptureNavigationTrackerOptions, PostHogAutocaptureOptions, PostHogCustomAppProperties, PostHogCustomStorage, PostHogNavigationRef, PostHogOptions, PostHogProvider, PostHogProviderProps, PostHogSessionReplayConfig, PostHogSurveyProvider, PostHogSurveyProviderProps, Questions, Survey, SurveyAppearance, SurveyModal, SurveyModalProps, PostHog as default, useFeatureFlag, useFeatureFlagWithPayload, useFeatureFlags, useNavigationTracker, usePostHog };
|