posthog-js 1.167.1 → 1.169.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/all-external-dependencies.js +2 -2
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +2 -2
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/lib/src/extensions/exception-autocapture/error-conversion.d.ts +46 -2
- package/dist/lib/src/extensions/exception-autocapture/stack-trace.d.ts +5 -5
- package/dist/lib/src/extensions/replay/sessionrecording.d.ts +11 -1
- package/dist/lib/src/types.d.ts +8 -17
- package/dist/lib/src/utils/globals.d.ts +3 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +20 -19
- package/dist/module.full.d.ts +20 -19
- package/dist/module.full.js +2 -2
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +20 -19
- package/dist/module.full.no-external.js +2 -2
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +20 -19
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js.map +1 -1
- package/dist/tracing-headers.js.map +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/exception-autocapture/error-conversion.d.ts +46 -2
- package/lib/src/extensions/exception-autocapture/error-conversion.js +146 -89
- package/lib/src/extensions/exception-autocapture/error-conversion.js.map +1 -1
- package/lib/src/extensions/exception-autocapture/stack-trace.d.ts +5 -5
- package/lib/src/extensions/exception-autocapture/stack-trace.js +46 -23
- package/lib/src/extensions/exception-autocapture/stack-trace.js.map +1 -1
- package/lib/src/extensions/replay/sessionrecording.d.ts +11 -1
- package/lib/src/extensions/replay/sessionrecording.js +46 -14
- package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
- package/lib/src/extensions/sentry-integration.js +1 -0
- package/lib/src/extensions/sentry-integration.js.map +1 -1
- package/lib/src/posthog-core.js +23 -16
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/types.d.ts +8 -17
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/globals.d.ts +3 -2
- package/lib/src/utils/globals.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PostHog } from '../../posthog-core';
|
|
2
2
|
import { DecideResponse } from '../../types';
|
|
3
3
|
import { EventType, type eventWithTime, IncrementalSource } from '@rrweb/types';
|
|
4
|
+
type SessionStartReason = 'sampling_override' | 'recording_initialized' | 'linked_flag_match' | 'linked_flag_override' | 'sampling' | 'session_id_changed';
|
|
4
5
|
export declare const RECORDING_IDLE_THRESHOLD_MS: number;
|
|
5
6
|
export declare const RECORDING_MAX_EVENT_SIZE: number;
|
|
6
7
|
export declare const RECORDING_BUFFER_TIMEOUT = 2000;
|
|
@@ -89,7 +90,7 @@ export declare class SessionRecording {
|
|
|
89
90
|
private _onOffline;
|
|
90
91
|
private _onOnline;
|
|
91
92
|
private _onVisibilityChange;
|
|
92
|
-
startIfEnabledOrStop(): void;
|
|
93
|
+
startIfEnabledOrStop(startReason?: SessionStartReason): void;
|
|
93
94
|
stopRecording(): void;
|
|
94
95
|
private makeSamplingDecision;
|
|
95
96
|
afterDecideResponse(response: DecideResponse): void;
|
|
@@ -124,5 +125,14 @@ export declare class SessionRecording {
|
|
|
124
125
|
* instead call `posthog.startSessionRecording({linked_flag: true})`
|
|
125
126
|
* */
|
|
126
127
|
overrideLinkedFlag(): void;
|
|
128
|
+
/**
|
|
129
|
+
* this ignores the sampling config and causes capture to start
|
|
130
|
+
* (if recording would have started had the flag been received i.e. it does not override other config).
|
|
131
|
+
*
|
|
132
|
+
* It is not usual to call this directly,
|
|
133
|
+
* instead call `posthog.startSessionRecording({sampling: true})`
|
|
134
|
+
* */
|
|
135
|
+
overrideSampling(): void;
|
|
136
|
+
private _reportStarted;
|
|
127
137
|
}
|
|
128
138
|
export {};
|
package/dist/lib/src/types.d.ts
CHANGED
|
@@ -455,23 +455,14 @@ export type ErrorEventArgs = [
|
|
|
455
455
|
colno?: number | undefined,
|
|
456
456
|
error?: Error | undefined
|
|
457
457
|
];
|
|
458
|
+
export type ErrorMetadata = {
|
|
459
|
+
handled?: boolean;
|
|
460
|
+
synthetic?: boolean;
|
|
461
|
+
overrideExceptionType?: string;
|
|
462
|
+
overrideExceptionMessage?: string;
|
|
463
|
+
defaultExceptionType?: string;
|
|
464
|
+
defaultExceptionMessage?: string;
|
|
465
|
+
};
|
|
458
466
|
export declare const severityLevels: readonly ["fatal", "error", "warning", "log", "info", "debug"];
|
|
459
467
|
export declare type SeverityLevel = typeof severityLevels[number];
|
|
460
|
-
export interface ErrorProperties {
|
|
461
|
-
$exception_type: string;
|
|
462
|
-
$exception_message: string;
|
|
463
|
-
$exception_level: SeverityLevel;
|
|
464
|
-
$exception_source?: string;
|
|
465
|
-
$exception_lineno?: number;
|
|
466
|
-
$exception_colno?: number;
|
|
467
|
-
$exception_DOMException_code?: string;
|
|
468
|
-
$exception_is_synthetic?: boolean;
|
|
469
|
-
$exception_stack_trace_raw?: string;
|
|
470
|
-
$exception_handled?: boolean;
|
|
471
|
-
$exception_personURL?: string;
|
|
472
|
-
}
|
|
473
|
-
export interface ErrorConversions {
|
|
474
|
-
errorToProperties: (args: ErrorEventArgs) => ErrorProperties;
|
|
475
|
-
unhandledRejectionToProperties: (args: [ev: PromiseRejectionEvent]) => ErrorProperties;
|
|
476
|
-
}
|
|
477
468
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ErrorProperties } from '../extensions/exception-autocapture/error-conversion';
|
|
1
2
|
import type { PostHog } from '../posthog-core';
|
|
2
3
|
import { SessionIdManager } from '../sessionid';
|
|
3
|
-
import { ErrorEventArgs,
|
|
4
|
+
import { ErrorEventArgs, ErrorMetadata, Properties } from '../types';
|
|
4
5
|
declare const win: (Window & typeof globalThis) | undefined;
|
|
5
6
|
/**
|
|
6
7
|
* This is our contract between (potentially) lazily loaded extensions and the SDK
|
|
@@ -10,7 +11,7 @@ export type PostHogExtensionKind = 'toolbar' | 'exception-autocapture' | 'web-vi
|
|
|
10
11
|
interface PostHogExtensions {
|
|
11
12
|
loadExternalDependency?: (posthog: PostHog, kind: PostHogExtensionKind, callback: (error?: string | Event, event?: Event) => void) => void;
|
|
12
13
|
loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void;
|
|
13
|
-
parseErrorAsProperties?: ([event, source, lineno, colno, error]: ErrorEventArgs) => ErrorProperties;
|
|
14
|
+
parseErrorAsProperties?: ([event, source, lineno, colno, error]: ErrorEventArgs, metadata?: ErrorMetadata) => ErrorProperties;
|
|
14
15
|
errorWrappingFunctions?: {
|
|
15
16
|
wrapOnError: (captureFn: (props: Properties) => void) => () => void;
|
|
16
17
|
wrapUnhandledRejection: (captureFn: (props: Properties) => void) => () => void;
|