@posthog/types 1.319.1 → 1.320.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/posthog.d.ts +62 -2
- package/dist/posthog.d.ts.map +1 -1
- package/dist/survey.d.ts +13 -0
- package/dist/survey.d.ts.map +1 -0
- package/dist/survey.js +18 -0
- package/dist/survey.mjs +0 -0
- package/dist/toolbar.d.ts +34 -0
- package/dist/toolbar.d.ts.map +1 -0
- package/dist/toolbar.js +18 -0
- package/dist/toolbar.mjs +0 -0
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/posthog.ts +92 -2
- package/src/survey.ts +13 -0
- package/src/toolbar.ts +35 -0
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export type { Headers, RequestResponse, RequestCallback } from './request';
|
|
|
12
12
|
export type { SessionRecordingCanvasOptions, InitiatorType, NetworkRequest, CapturedNetworkRequest, SessionIdChangedCallback, SeverityLevel, } from './session-recording';
|
|
13
13
|
export type { AutocaptureCompatibleElement, DomAutocaptureEvents, AutocaptureConfig, RageclickConfig, BootstrapConfig, SupportedWebVitalsMetrics, PerformanceCaptureConfig, DeadClickCandidate, ExceptionAutoCaptureConfig, DeadClicksAutoCaptureConfig, HeatmapConfig, ConfigDefaults, ExternalIntegrationKind, ErrorTrackingOptions, MaskInputOptions, SlimDOMOptions, SessionRecordingOptions, RequestQueueConfig, PostHogConfig, } from './posthog-config';
|
|
14
14
|
export type { SegmentUser, SegmentAnalytics, SegmentPlugin, SegmentContext, SegmentFunction } from './segment';
|
|
15
|
+
export type { SurveyRenderReason } from './survey';
|
|
16
|
+
export type { ToolbarParams, ToolbarUserIntent, ToolbarSource, ToolbarVersion } from './toolbar';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1E,YAAY,EACR,cAAc,EACd,wBAAwB,EACxB,SAAS,EACT,aAAa,EACb,cAAc,EACd,YAAY,GACf,MAAM,WAAW,CAAA;AAGlB,YAAY,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC7B,MAAM,iBAAiB,CAAA;AAGxB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAG1E,YAAY,EACR,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,GAChB,MAAM,qBAAqB,CAAA;AAG5B,YAAY,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,GAChB,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1E,YAAY,EACR,cAAc,EACd,wBAAwB,EACxB,SAAS,EACT,aAAa,EACb,cAAc,EACd,YAAY,GACf,MAAM,WAAW,CAAA;AAGlB,YAAY,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC7B,MAAM,iBAAiB,CAAA;AAGxB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAG1E,YAAY,EACR,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,GAChB,MAAM,qBAAqB,CAAA;AAG5B,YAAY,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,GAChB,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAG9G,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAGlD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/posthog.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ import type { CaptureResult, CaptureOptions } from './capture';
|
|
|
10
10
|
import type { FeatureFlagsCallback, EarlyAccessFeatureCallback, EarlyAccessFeatureStage } from './feature-flags';
|
|
11
11
|
import type { SessionIdChangedCallback } from './session-recording';
|
|
12
12
|
import type { RequestCallback } from './request';
|
|
13
|
+
import type { SurveyRenderReason } from './survey';
|
|
14
|
+
import type { ToolbarParams } from './toolbar';
|
|
15
|
+
import type { ExceptionAutoCaptureConfig } from './posthog-config';
|
|
13
16
|
/**
|
|
14
17
|
* The PostHog instance interface.
|
|
15
18
|
*
|
|
@@ -159,6 +162,16 @@ export interface PostHog {
|
|
|
159
162
|
* Reload feature flags from the server.
|
|
160
163
|
*/
|
|
161
164
|
reloadFeatureFlags(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Manually update feature flag values without making a network request.
|
|
167
|
+
*
|
|
168
|
+
* @param flags - An object mapping flag keys to their values (boolean or string variant)
|
|
169
|
+
* @param payloads - Optional object mapping flag keys to their JSON payloads
|
|
170
|
+
* @param options - Optional settings. Use `{ merge: true }` to merge with existing flags instead of replacing.
|
|
171
|
+
*/
|
|
172
|
+
updateFlags(flags: Record<string, boolean | string>, payloads?: Record<string, JsonType>, options?: {
|
|
173
|
+
merge?: boolean;
|
|
174
|
+
}): void;
|
|
162
175
|
/**
|
|
163
176
|
* Register a callback to be called when feature flags are loaded.
|
|
164
177
|
*
|
|
@@ -197,8 +210,9 @@ export interface PostHog {
|
|
|
197
210
|
*
|
|
198
211
|
* @param callback - Callback to receive the features
|
|
199
212
|
* @param forceReload - Whether to force a reload from the server
|
|
213
|
+
* @param stages - The stages of the early access features to load
|
|
200
214
|
*/
|
|
201
|
-
getEarlyAccessFeatures(callback: EarlyAccessFeatureCallback, forceReload?: boolean): void;
|
|
215
|
+
getEarlyAccessFeatures(callback: EarlyAccessFeatureCallback, forceReload?: boolean, stages?: EarlyAccessFeatureStage[]): void;
|
|
202
216
|
/**
|
|
203
217
|
* Update enrollment in an early access feature.
|
|
204
218
|
*
|
|
@@ -385,7 +399,15 @@ export interface PostHog {
|
|
|
385
399
|
* @param surveyId - The survey ID
|
|
386
400
|
* @returns The render reason or null if can't render
|
|
387
401
|
*/
|
|
388
|
-
canRenderSurvey(surveyId: string):
|
|
402
|
+
canRenderSurvey(surveyId: string): SurveyRenderReason | null;
|
|
403
|
+
/**
|
|
404
|
+
* Check if a survey can be rendered (async version).
|
|
405
|
+
*
|
|
406
|
+
* @param surveyId - The survey ID
|
|
407
|
+
* @param forceReload - Whether to force a reload from the server
|
|
408
|
+
* @returns A promise that resolves to the render reason
|
|
409
|
+
*/
|
|
410
|
+
canRenderSurveyAsync(surveyId: string, forceReload?: boolean): Promise<SurveyRenderReason>;
|
|
389
411
|
/**
|
|
390
412
|
* Register an event listener.
|
|
391
413
|
*
|
|
@@ -394,6 +416,44 @@ export interface PostHog {
|
|
|
394
416
|
* @returns A function to unsubscribe
|
|
395
417
|
*/
|
|
396
418
|
on(event: 'eventCaptured', cb: (...args: any[]) => void): () => void;
|
|
419
|
+
/**
|
|
420
|
+
* Start automatic exception capture.
|
|
421
|
+
*
|
|
422
|
+
* @param config - Optional configuration for exception autocapture
|
|
423
|
+
*/
|
|
424
|
+
startExceptionAutocapture(config?: ExceptionAutoCaptureConfig): void;
|
|
425
|
+
/**
|
|
426
|
+
* Stop automatic exception capture.
|
|
427
|
+
*/
|
|
428
|
+
stopExceptionAutocapture(): void;
|
|
429
|
+
/**
|
|
430
|
+
* Load the PostHog toolbar.
|
|
431
|
+
*
|
|
432
|
+
* @param params - Toolbar parameters
|
|
433
|
+
* @returns Whether the toolbar was loaded
|
|
434
|
+
*/
|
|
435
|
+
loadToolbar(params: ToolbarParams): boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Get the current page view ID.
|
|
438
|
+
*
|
|
439
|
+
* @returns The current page view ID
|
|
440
|
+
*/
|
|
441
|
+
getPageViewId(): string | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* Capture written user feedback for a LLM trace.
|
|
444
|
+
*
|
|
445
|
+
* @param traceId - The trace ID to capture feedback for
|
|
446
|
+
* @param userFeedback - The feedback to capture
|
|
447
|
+
*/
|
|
448
|
+
captureTraceFeedback(traceId: string | number, userFeedback: string): void;
|
|
449
|
+
/**
|
|
450
|
+
* Capture a metric for a LLM trace.
|
|
451
|
+
*
|
|
452
|
+
* @param traceId - The trace ID to capture the metric for
|
|
453
|
+
* @param metricName - The name of the metric to capture
|
|
454
|
+
* @param metricValue - The value of the metric to capture
|
|
455
|
+
*/
|
|
456
|
+
captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void;
|
|
397
457
|
/**
|
|
398
458
|
* @deprecated Use `setPersonProperties` instead
|
|
399
459
|
*/
|
package/dist/posthog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../src/posthog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAChH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../src/posthog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAChH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;OAMG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IAM9G;;OAEG;IACH,MAAM,EAAE;QACJ,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;QACjF,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;KACzF,CAAA;IAED;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAA;CAChC"}
|
package/dist/survey.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Survey types
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Represents the result of checking if a survey can be rendered.
|
|
6
|
+
*/
|
|
7
|
+
export interface SurveyRenderReason {
|
|
8
|
+
/** Whether the survey is visible/can be rendered */
|
|
9
|
+
visible: boolean;
|
|
10
|
+
/** The reason why the survey cannot be rendered, if applicable */
|
|
11
|
+
disabledReason?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=survey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey.d.ts","sourceRoot":"","sources":["../src/survey.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAA;IAChB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;CAC1B"}
|
package/dist/survey.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
package/dist/survey.mjs
ADDED
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar types
|
|
3
|
+
*/
|
|
4
|
+
export type ToolbarUserIntent = 'add-action' | 'edit-action';
|
|
5
|
+
export type ToolbarSource = 'url' | 'localstorage';
|
|
6
|
+
export type ToolbarVersion = 'toolbar';
|
|
7
|
+
/**
|
|
8
|
+
* Parameters for loading the PostHog toolbar
|
|
9
|
+
*/
|
|
10
|
+
export interface ToolbarParams {
|
|
11
|
+
/** Public posthog-js token */
|
|
12
|
+
token?: string;
|
|
13
|
+
/** Private temporary user token */
|
|
14
|
+
temporaryToken?: string;
|
|
15
|
+
/** Action ID to edit */
|
|
16
|
+
actionId?: number;
|
|
17
|
+
/** User intent for the toolbar */
|
|
18
|
+
userIntent?: ToolbarUserIntent;
|
|
19
|
+
/** Source of the toolbar params */
|
|
20
|
+
source?: ToolbarSource;
|
|
21
|
+
/** Toolbar version */
|
|
22
|
+
toolbarVersion?: ToolbarVersion;
|
|
23
|
+
/** Whether to instrument */
|
|
24
|
+
instrument?: boolean;
|
|
25
|
+
/** Distinct ID of the user */
|
|
26
|
+
distinctId?: string;
|
|
27
|
+
/** Email of the user */
|
|
28
|
+
userEmail?: string;
|
|
29
|
+
/** Data attributes to capture */
|
|
30
|
+
dataAttributes?: string[];
|
|
31
|
+
/** Feature flags */
|
|
32
|
+
featureFlags?: Record<string, string | boolean>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../src/toolbar.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,aAAa,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,cAAc,CAAA;AAClD,MAAM,MAAM,cAAc,GAAG,SAAS,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kCAAkC;IAClC,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,mCAAmC;IACnC,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,sBAAsB;IACtB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,4BAA4B;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;CAClD"}
|
package/dist/toolbar.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
package/dist/toolbar.mjs
ADDED
|
File without changes
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -72,3 +72,9 @@ export type {
|
|
|
72
72
|
|
|
73
73
|
// Segment integration types
|
|
74
74
|
export type { SegmentUser, SegmentAnalytics, SegmentPlugin, SegmentContext, SegmentFunction } from './segment'
|
|
75
|
+
|
|
76
|
+
// Survey types
|
|
77
|
+
export type { SurveyRenderReason } from './survey'
|
|
78
|
+
|
|
79
|
+
// Toolbar types
|
|
80
|
+
export type { ToolbarParams, ToolbarUserIntent, ToolbarSource, ToolbarVersion } from './toolbar'
|
package/src/posthog.ts
CHANGED
|
@@ -11,6 +11,9 @@ import type { CaptureResult, CaptureOptions } from './capture'
|
|
|
11
11
|
import type { FeatureFlagsCallback, EarlyAccessFeatureCallback, EarlyAccessFeatureStage } from './feature-flags'
|
|
12
12
|
import type { SessionIdChangedCallback } from './session-recording'
|
|
13
13
|
import type { RequestCallback } from './request'
|
|
14
|
+
import type { SurveyRenderReason } from './survey'
|
|
15
|
+
import type { ToolbarParams } from './toolbar'
|
|
16
|
+
import type { ExceptionAutoCaptureConfig } from './posthog-config'
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* The PostHog instance interface.
|
|
@@ -197,6 +200,19 @@ export interface PostHog {
|
|
|
197
200
|
*/
|
|
198
201
|
reloadFeatureFlags(): void
|
|
199
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Manually update feature flag values without making a network request.
|
|
205
|
+
*
|
|
206
|
+
* @param flags - An object mapping flag keys to their values (boolean or string variant)
|
|
207
|
+
* @param payloads - Optional object mapping flag keys to their JSON payloads
|
|
208
|
+
* @param options - Optional settings. Use `{ merge: true }` to merge with existing flags instead of replacing.
|
|
209
|
+
*/
|
|
210
|
+
updateFlags(
|
|
211
|
+
flags: Record<string, boolean | string>,
|
|
212
|
+
payloads?: Record<string, JsonType>,
|
|
213
|
+
options?: { merge?: boolean }
|
|
214
|
+
): void
|
|
215
|
+
|
|
200
216
|
/**
|
|
201
217
|
* Register a callback to be called when feature flags are loaded.
|
|
202
218
|
*
|
|
@@ -242,8 +258,13 @@ export interface PostHog {
|
|
|
242
258
|
*
|
|
243
259
|
* @param callback - Callback to receive the features
|
|
244
260
|
* @param forceReload - Whether to force a reload from the server
|
|
261
|
+
* @param stages - The stages of the early access features to load
|
|
245
262
|
*/
|
|
246
|
-
getEarlyAccessFeatures(
|
|
263
|
+
getEarlyAccessFeatures(
|
|
264
|
+
callback: EarlyAccessFeatureCallback,
|
|
265
|
+
forceReload?: boolean,
|
|
266
|
+
stages?: EarlyAccessFeatureStage[]
|
|
267
|
+
): void
|
|
247
268
|
|
|
248
269
|
/**
|
|
249
270
|
* Update enrollment in an early access feature.
|
|
@@ -472,7 +493,16 @@ export interface PostHog {
|
|
|
472
493
|
* @param surveyId - The survey ID
|
|
473
494
|
* @returns The render reason or null if can't render
|
|
474
495
|
*/
|
|
475
|
-
canRenderSurvey(surveyId: string):
|
|
496
|
+
canRenderSurvey(surveyId: string): SurveyRenderReason | null
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Check if a survey can be rendered (async version).
|
|
500
|
+
*
|
|
501
|
+
* @param surveyId - The survey ID
|
|
502
|
+
* @param forceReload - Whether to force a reload from the server
|
|
503
|
+
* @returns A promise that resolves to the render reason
|
|
504
|
+
*/
|
|
505
|
+
canRenderSurveyAsync(surveyId: string, forceReload?: boolean): Promise<SurveyRenderReason>
|
|
476
506
|
|
|
477
507
|
// ============================================================================
|
|
478
508
|
// Events
|
|
@@ -487,6 +517,66 @@ export interface PostHog {
|
|
|
487
517
|
*/
|
|
488
518
|
on(event: 'eventCaptured', cb: (...args: any[]) => void): () => void
|
|
489
519
|
|
|
520
|
+
// ============================================================================
|
|
521
|
+
// Error Tracking
|
|
522
|
+
// ============================================================================
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Start automatic exception capture.
|
|
526
|
+
*
|
|
527
|
+
* @param config - Optional configuration for exception autocapture
|
|
528
|
+
*/
|
|
529
|
+
startExceptionAutocapture(config?: ExceptionAutoCaptureConfig): void
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Stop automatic exception capture.
|
|
533
|
+
*/
|
|
534
|
+
stopExceptionAutocapture(): void
|
|
535
|
+
|
|
536
|
+
// ============================================================================
|
|
537
|
+
// Toolbar
|
|
538
|
+
// ============================================================================
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Load the PostHog toolbar.
|
|
542
|
+
*
|
|
543
|
+
* @param params - Toolbar parameters
|
|
544
|
+
* @returns Whether the toolbar was loaded
|
|
545
|
+
*/
|
|
546
|
+
loadToolbar(params: ToolbarParams): boolean
|
|
547
|
+
|
|
548
|
+
// ============================================================================
|
|
549
|
+
// Page View
|
|
550
|
+
// ============================================================================
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Get the current page view ID.
|
|
554
|
+
*
|
|
555
|
+
* @returns The current page view ID
|
|
556
|
+
*/
|
|
557
|
+
getPageViewId(): string | undefined
|
|
558
|
+
|
|
559
|
+
// ============================================================================
|
|
560
|
+
// LLM Analytics
|
|
561
|
+
// ============================================================================
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Capture written user feedback for a LLM trace.
|
|
565
|
+
*
|
|
566
|
+
* @param traceId - The trace ID to capture feedback for
|
|
567
|
+
* @param userFeedback - The feedback to capture
|
|
568
|
+
*/
|
|
569
|
+
captureTraceFeedback(traceId: string | number, userFeedback: string): void
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Capture a metric for a LLM trace.
|
|
573
|
+
*
|
|
574
|
+
* @param traceId - The trace ID to capture the metric for
|
|
575
|
+
* @param metricName - The name of the metric to capture
|
|
576
|
+
* @param metricValue - The value of the metric to capture
|
|
577
|
+
*/
|
|
578
|
+
captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void
|
|
579
|
+
|
|
490
580
|
// ============================================================================
|
|
491
581
|
// Deprecated
|
|
492
582
|
// ============================================================================
|
package/src/survey.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Survey types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents the result of checking if a survey can be rendered.
|
|
7
|
+
*/
|
|
8
|
+
export interface SurveyRenderReason {
|
|
9
|
+
/** Whether the survey is visible/can be rendered */
|
|
10
|
+
visible: boolean
|
|
11
|
+
/** The reason why the survey cannot be rendered, if applicable */
|
|
12
|
+
disabledReason?: string
|
|
13
|
+
}
|
package/src/toolbar.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type ToolbarUserIntent = 'add-action' | 'edit-action'
|
|
6
|
+
export type ToolbarSource = 'url' | 'localstorage'
|
|
7
|
+
export type ToolbarVersion = 'toolbar'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for loading the PostHog toolbar
|
|
11
|
+
*/
|
|
12
|
+
export interface ToolbarParams {
|
|
13
|
+
/** Public posthog-js token */
|
|
14
|
+
token?: string
|
|
15
|
+
/** Private temporary user token */
|
|
16
|
+
temporaryToken?: string
|
|
17
|
+
/** Action ID to edit */
|
|
18
|
+
actionId?: number
|
|
19
|
+
/** User intent for the toolbar */
|
|
20
|
+
userIntent?: ToolbarUserIntent
|
|
21
|
+
/** Source of the toolbar params */
|
|
22
|
+
source?: ToolbarSource
|
|
23
|
+
/** Toolbar version */
|
|
24
|
+
toolbarVersion?: ToolbarVersion
|
|
25
|
+
/** Whether to instrument */
|
|
26
|
+
instrument?: boolean
|
|
27
|
+
/** Distinct ID of the user */
|
|
28
|
+
distinctId?: string
|
|
29
|
+
/** Email of the user */
|
|
30
|
+
userEmail?: string
|
|
31
|
+
/** Data attributes to capture */
|
|
32
|
+
dataAttributes?: string[]
|
|
33
|
+
/** Feature flags */
|
|
34
|
+
featureFlags?: Record<string, string | boolean>
|
|
35
|
+
}
|