@leanbase.com/js 0.2.2-alpha.0 → 0.2.2
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/leanbase.d.ts +0 -3
- package/dist/leanbase.iife.js +1 -1
- package/dist/leanbase.iife.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +0 -708
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +0 -135
- package/dist/version.d.ts +1 -1
- package/lib/leanbase.d.ts +0 -3
- package/lib/leanbase.js +0 -25
- package/lib/leanbase.js.map +1 -1
- package/lib/types.d.ts +0 -135
- package/lib/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -6
- package/dist/extensions/replay/external/config.d.ts +0 -9
- package/dist/extensions/replay/external/denylist.d.ts +0 -5
- package/dist/extensions/replay/external/lazy-loaded-session-recorder.d.ts +0 -153
- package/dist/extensions/replay/external/mutation-throttler.d.ts +0 -20
- package/dist/extensions/replay/external/network-plugin.d.ts +0 -15
- package/dist/extensions/replay/external/sessionrecording-utils.d.ts +0 -19
- package/dist/extensions/replay/external/triggerMatching.d.ts +0 -102
- package/dist/extensions/replay/rrweb-plugins/patch.d.ts +0 -3
- package/dist/extensions/replay/session-recording.d.ts +0 -75
- package/dist/extensions/replay/types/rrweb-types.d.ts +0 -439
- package/dist/extensions/replay/types/rrweb.d.ts +0 -82
- package/dist/extensions/sampling.d.ts +0 -4
- package/dist/utils/logger.d.ts +0 -10
- package/lib/extensions/replay/external/config.d.ts +0 -9
- package/lib/extensions/replay/external/config.js +0 -221
- package/lib/extensions/replay/external/config.js.map +0 -1
- package/lib/extensions/replay/external/denylist.d.ts +0 -5
- package/lib/extensions/replay/external/denylist.js +0 -28
- package/lib/extensions/replay/external/denylist.js.map +0 -1
- package/lib/extensions/replay/external/lazy-loaded-session-recorder.d.ts +0 -153
- package/lib/extensions/replay/external/lazy-loaded-session-recorder.js +0 -1042
- package/lib/extensions/replay/external/lazy-loaded-session-recorder.js.map +0 -1
- package/lib/extensions/replay/external/mutation-throttler.d.ts +0 -20
- package/lib/extensions/replay/external/mutation-throttler.js +0 -77
- package/lib/extensions/replay/external/mutation-throttler.js.map +0 -1
- package/lib/extensions/replay/external/network-plugin.d.ts +0 -15
- package/lib/extensions/replay/external/network-plugin.js +0 -503
- package/lib/extensions/replay/external/network-plugin.js.map +0 -1
- package/lib/extensions/replay/external/sessionrecording-utils.d.ts +0 -19
- package/lib/extensions/replay/external/sessionrecording-utils.js +0 -125
- package/lib/extensions/replay/external/sessionrecording-utils.js.map +0 -1
- package/lib/extensions/replay/external/triggerMatching.d.ts +0 -102
- package/lib/extensions/replay/external/triggerMatching.js +0 -342
- package/lib/extensions/replay/external/triggerMatching.js.map +0 -1
- package/lib/extensions/replay/rrweb-plugins/patch.d.ts +0 -3
- package/lib/extensions/replay/rrweb-plugins/patch.js +0 -32
- package/lib/extensions/replay/rrweb-plugins/patch.js.map +0 -1
- package/lib/extensions/replay/session-recording.d.ts +0 -75
- package/lib/extensions/replay/session-recording.js +0 -279
- package/lib/extensions/replay/session-recording.js.map +0 -1
- package/lib/extensions/replay/types/rrweb-types.d.ts +0 -439
- package/lib/extensions/replay/types/rrweb-types.js +0 -83
- package/lib/extensions/replay/types/rrweb-types.js.map +0 -1
- package/lib/extensions/replay/types/rrweb.d.ts +0 -82
- package/lib/extensions/replay/types/rrweb.js +0 -9
- package/lib/extensions/replay/types/rrweb.js.map +0 -1
- package/lib/extensions/sampling.d.ts +0 -4
- package/lib/extensions/sampling.js +0 -23
- package/lib/extensions/sampling.js.map +0 -1
- package/lib/utils/logger.d.ts +0 -10
- package/lib/utils/logger.js +0 -15
- package/lib/utils/logger.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Leanbase } from '../../leanbase';
|
|
2
|
-
import { Properties, RemoteConfig, SessionStartReason } from '../../types';
|
|
3
|
-
import { type eventWithTime } from './types/rrweb-types';
|
|
4
|
-
import { SessionRecordingStatus, TriggerType } from './external/triggerMatching';
|
|
5
|
-
export declare class SessionRecording {
|
|
6
|
-
private readonly _instance;
|
|
7
|
-
_forceAllowLocalhostNetworkCapture: boolean;
|
|
8
|
-
private _receivedFlags;
|
|
9
|
-
private _bootstrapFailed;
|
|
10
|
-
private _warnedMissingConsent;
|
|
11
|
-
private _warnedMissingLoader;
|
|
12
|
-
private _persistFlagsOnSessionListener;
|
|
13
|
-
private _lazyLoadedSessionRecording;
|
|
14
|
-
get started(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* defaults to buffering mode until a flags response is received
|
|
17
|
-
* once a flags response is received status can be disabled, active or sampled
|
|
18
|
-
*/
|
|
19
|
-
get status(): SessionRecordingStatus;
|
|
20
|
-
constructor(_instance: Leanbase);
|
|
21
|
-
private get _isRecordingEnabled();
|
|
22
|
-
startIfEnabledOrStop(startReason?: SessionStartReason): void;
|
|
23
|
-
/**
|
|
24
|
-
* session recording waits until it receives remote config before loading the script
|
|
25
|
-
* this is to ensure we can control the script name remotely
|
|
26
|
-
* and because we wait until we have local and remote config to determine if we should start at all
|
|
27
|
-
* if start is called and there is no remote config then we wait until there is
|
|
28
|
-
*/
|
|
29
|
-
private _lazyLoadAndStart;
|
|
30
|
-
stopRecording(): void;
|
|
31
|
-
private _resetSampling;
|
|
32
|
-
private _persistRemoteConfig;
|
|
33
|
-
private _clearRemoteConfig;
|
|
34
|
-
onRemoteConfig(response: RemoteConfig): void;
|
|
35
|
-
log(message: string, level?: 'log' | 'warn' | 'error'): void;
|
|
36
|
-
private get _scriptName();
|
|
37
|
-
private _onScriptLoaded;
|
|
38
|
-
/**
|
|
39
|
-
* this is maintained on the public API only because it has always been on the public API
|
|
40
|
-
* if you are calling this directly you are certainly doing something wrong
|
|
41
|
-
* @deprecated
|
|
42
|
-
*/
|
|
43
|
-
onRRwebEmit(rawEvent: eventWithTime): void;
|
|
44
|
-
/**
|
|
45
|
-
* this ignores the linked flag config and (if other conditions are met) causes capture to start
|
|
46
|
-
*
|
|
47
|
-
* It is not usual to call this directly,
|
|
48
|
-
* instead call `posthog.startSessionRecording({linked_flag: true})`
|
|
49
|
-
* */
|
|
50
|
-
overrideLinkedFlag(): void;
|
|
51
|
-
/**
|
|
52
|
-
* this ignores the sampling config and (if other conditions are met) causes capture to start
|
|
53
|
-
*
|
|
54
|
-
* It is not usual to call this directly,
|
|
55
|
-
* instead call `posthog.startSessionRecording({sampling: true})`
|
|
56
|
-
* */
|
|
57
|
-
overrideSampling(): void;
|
|
58
|
-
/**
|
|
59
|
-
* this ignores the URL/Event trigger config and (if other conditions are met) causes capture to start
|
|
60
|
-
*
|
|
61
|
-
* It is not usual to call this directly,
|
|
62
|
-
* instead call `posthog.startSessionRecording({trigger: 'url' | 'event'})`
|
|
63
|
-
* */
|
|
64
|
-
overrideTrigger(triggerType: TriggerType): void;
|
|
65
|
-
get sdkDebugProperties(): Properties;
|
|
66
|
-
/**
|
|
67
|
-
* This adds a custom event to the session recording
|
|
68
|
-
*
|
|
69
|
-
* It is not intended for arbitrary public use - playback only displays known custom events
|
|
70
|
-
* And is exposed on the public interface only so that other parts of the SDK are able to use it
|
|
71
|
-
*
|
|
72
|
-
* if you are calling this from client code, you're probably looking for `posthog.capture('$custom_event', {...})`
|
|
73
|
-
*/
|
|
74
|
-
tryAddCustomEvent(tag: string, payload: any): boolean;
|
|
75
|
-
}
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { SESSION_RECORDING_IS_SAMPLED, SESSION_RECORDING_REMOTE_CONFIG } from '../../constants';
|
|
2
|
-
import { isNullish, isUndefined } from '@posthog/core';
|
|
3
|
-
import { logger } from '../../leanbase-logger';
|
|
4
|
-
import { assignableWindow, window } from '../../utils';
|
|
5
|
-
import { DISABLED, LAZY_LOADING } from './external/triggerMatching';
|
|
6
|
-
const LOGGER_PREFIX = '[SessionRecording]';
|
|
7
|
-
const log = {
|
|
8
|
-
info: (...args) => logger.info(LOGGER_PREFIX, ...args),
|
|
9
|
-
warn: (...args) => logger.warn(LOGGER_PREFIX, ...args),
|
|
10
|
-
error: (...args) => logger.error(LOGGER_PREFIX, ...args),
|
|
11
|
-
};
|
|
12
|
-
export class SessionRecording {
|
|
13
|
-
get started() {
|
|
14
|
-
return !!this._lazyLoadedSessionRecording?.isStarted;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* defaults to buffering mode until a flags response is received
|
|
18
|
-
* once a flags response is received status can be disabled, active or sampled
|
|
19
|
-
*/
|
|
20
|
-
get status() {
|
|
21
|
-
if (this._lazyLoadedSessionRecording) {
|
|
22
|
-
return this._lazyLoadedSessionRecording.status;
|
|
23
|
-
}
|
|
24
|
-
if (this._receivedFlags && !this._isRecordingEnabled) {
|
|
25
|
-
return DISABLED;
|
|
26
|
-
}
|
|
27
|
-
return LAZY_LOADING;
|
|
28
|
-
}
|
|
29
|
-
constructor(_instance) {
|
|
30
|
-
this._instance = _instance;
|
|
31
|
-
this._forceAllowLocalhostNetworkCapture = false;
|
|
32
|
-
this._receivedFlags = false;
|
|
33
|
-
this._bootstrapFailed = false;
|
|
34
|
-
this._warnedMissingConsent = false;
|
|
35
|
-
this._warnedMissingLoader = false;
|
|
36
|
-
this._persistFlagsOnSessionListener = undefined;
|
|
37
|
-
if (!this._instance.sessionManager) {
|
|
38
|
-
log.error('started without valid sessionManager');
|
|
39
|
-
throw new Error(LOGGER_PREFIX + ' started without valid sessionManager. This is a bug.');
|
|
40
|
-
}
|
|
41
|
-
if (this._instance.config.cookieless_mode === 'always') {
|
|
42
|
-
throw new Error(LOGGER_PREFIX + ' cannot be used with cookieless_mode="always"');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
get _isRecordingEnabled() {
|
|
46
|
-
const persistedConfig = this._instance.getPersistedProperty(SESSION_RECORDING_REMOTE_CONFIG);
|
|
47
|
-
const enabled_server_side = !!persistedConfig?.enabled;
|
|
48
|
-
const enabled_client_side = !this._instance.config.disable_session_recording;
|
|
49
|
-
const consentOptedOut = this._instance.consent?.isOptedOut?.();
|
|
50
|
-
if (!this._instance.consent?.isOptedOut && !this._warnedMissingConsent) {
|
|
51
|
-
log.warn('consent API missing; disabling session recording');
|
|
52
|
-
this._warnedMissingConsent = true;
|
|
53
|
-
}
|
|
54
|
-
const isDisabled = this._instance.config.disable_session_recording || consentOptedOut !== false;
|
|
55
|
-
return window && enabled_server_side && enabled_client_side && !isDisabled;
|
|
56
|
-
}
|
|
57
|
-
startIfEnabledOrStop(startReason) {
|
|
58
|
-
if (this._isRecordingEnabled && this._lazyLoadedSessionRecording?.isStarted) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const canRunReplay = !isUndefined(Object.assign) && !isUndefined(Array.from);
|
|
62
|
-
// According to the rrweb docs, rrweb is not supported on IE11 and below:
|
|
63
|
-
// "rrweb does not support IE11 and below because it uses the MutationObserver API, which was supported by these browsers."
|
|
64
|
-
// https://github.com/rrweb-io/rrweb/blob/master/guide.md#compatibility-note
|
|
65
|
-
//
|
|
66
|
-
// However, MutationObserver does exist on IE11, it just doesn't work well and does not detect all changes.
|
|
67
|
-
// Instead, when we load "recorder.js", the first JS error is about "Object.assign" and "Array.from" being undefined.
|
|
68
|
-
// Thus instead of MutationObserver, we look for this function and block recording if it's undefined.
|
|
69
|
-
if (this._isRecordingEnabled && canRunReplay) {
|
|
70
|
-
this._lazyLoadAndStart(startReason);
|
|
71
|
-
log.info('starting');
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.stopRecording();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* session recording waits until it receives remote config before loading the script
|
|
79
|
-
* this is to ensure we can control the script name remotely
|
|
80
|
-
* and because we wait until we have local and remote config to determine if we should start at all
|
|
81
|
-
* if start is called and there is no remote config then we wait until there is
|
|
82
|
-
*/
|
|
83
|
-
_lazyLoadAndStart(startReason) {
|
|
84
|
-
// by checking `_isRecordingEnabled` here we know that
|
|
85
|
-
// we have stored remote config and client config to read
|
|
86
|
-
// replay waits for both local and remote config before starting
|
|
87
|
-
if (!this._isRecordingEnabled) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (this._bootstrapFailed) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (assignableWindow.__LeanbaseExtensions__?.rrweb?.record &&
|
|
94
|
-
assignableWindow.__LeanbaseExtensions__?.initSessionRecording) {
|
|
95
|
-
this._onScriptLoaded(startReason);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const loadExternalDependency = assignableWindow.__LeanbaseExtensions__?.loadExternalDependency;
|
|
99
|
-
if (!loadExternalDependency && !this._warnedMissingLoader) {
|
|
100
|
-
log.warn('Session recording disabled: __LeanbaseExtensions__.loadExternalDependency missing');
|
|
101
|
-
this._warnedMissingLoader = true;
|
|
102
|
-
this._bootstrapFailed = true;
|
|
103
|
-
this.stopRecording();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (loadExternalDependency) {
|
|
107
|
-
loadExternalDependency(this._instance, this._scriptName, (err) => {
|
|
108
|
-
if (err) {
|
|
109
|
-
log.error('could not load recorder', err);
|
|
110
|
-
this._bootstrapFailed = true;
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this._onScriptLoaded(startReason);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
stopRecording() {
|
|
118
|
-
this._persistFlagsOnSessionListener?.();
|
|
119
|
-
this._persistFlagsOnSessionListener = undefined;
|
|
120
|
-
this._lazyLoadedSessionRecording?.stop();
|
|
121
|
-
}
|
|
122
|
-
_resetSampling() {
|
|
123
|
-
this._instance.persistence?.unregister(SESSION_RECORDING_IS_SAMPLED);
|
|
124
|
-
}
|
|
125
|
-
_persistRemoteConfig(response) {
|
|
126
|
-
if (this._instance.persistence) {
|
|
127
|
-
const persistence = this._instance.persistence;
|
|
128
|
-
const persistResponse = () => {
|
|
129
|
-
const sessionRecordingConfigResponse = response.sessionRecording === false ? undefined : response.sessionRecording;
|
|
130
|
-
const receivedSampleRate = sessionRecordingConfigResponse?.sampleRate;
|
|
131
|
-
const parsedSampleRate = isNullish(receivedSampleRate) ? null : parseFloat(receivedSampleRate);
|
|
132
|
-
if (isNullish(parsedSampleRate)) {
|
|
133
|
-
this._resetSampling();
|
|
134
|
-
}
|
|
135
|
-
const receivedMinimumDuration = sessionRecordingConfigResponse?.minimumDurationMilliseconds;
|
|
136
|
-
persistence.register({
|
|
137
|
-
[SESSION_RECORDING_REMOTE_CONFIG]: {
|
|
138
|
-
enabled: !!sessionRecordingConfigResponse,
|
|
139
|
-
...sessionRecordingConfigResponse,
|
|
140
|
-
networkPayloadCapture: {
|
|
141
|
-
capturePerformance: response.capturePerformance,
|
|
142
|
-
...sessionRecordingConfigResponse?.networkPayloadCapture,
|
|
143
|
-
},
|
|
144
|
-
canvasRecording: {
|
|
145
|
-
enabled: sessionRecordingConfigResponse?.recordCanvas,
|
|
146
|
-
fps: sessionRecordingConfigResponse?.canvasFps,
|
|
147
|
-
quality: sessionRecordingConfigResponse?.canvasQuality,
|
|
148
|
-
},
|
|
149
|
-
sampleRate: parsedSampleRate,
|
|
150
|
-
minimumDurationMilliseconds: isUndefined(receivedMinimumDuration)
|
|
151
|
-
? null
|
|
152
|
-
: receivedMinimumDuration,
|
|
153
|
-
endpoint: sessionRecordingConfigResponse?.endpoint,
|
|
154
|
-
triggerMatchType: sessionRecordingConfigResponse?.triggerMatchType,
|
|
155
|
-
masking: sessionRecordingConfigResponse?.masking,
|
|
156
|
-
urlTriggers: sessionRecordingConfigResponse?.urlTriggers,
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
persistResponse();
|
|
161
|
-
// in case we see multiple flags responses, we should only use the response from the most recent one
|
|
162
|
-
this._persistFlagsOnSessionListener?.();
|
|
163
|
-
// we 100% know there is a session manager by this point
|
|
164
|
-
this._persistFlagsOnSessionListener = this._instance.sessionManager?.onSessionId(persistResponse);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
_clearRemoteConfig() {
|
|
168
|
-
this._instance.persistence?.unregister(SESSION_RECORDING_REMOTE_CONFIG);
|
|
169
|
-
this._resetSampling();
|
|
170
|
-
}
|
|
171
|
-
onRemoteConfig(response) {
|
|
172
|
-
if (!('sessionRecording' in response)) {
|
|
173
|
-
// if sessionRecording is not in the response, we do nothing
|
|
174
|
-
log.info('skipping remote config with no sessionRecording', response);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
this._receivedFlags = true;
|
|
178
|
-
if (response.sessionRecording === false) {
|
|
179
|
-
// remotely disabled
|
|
180
|
-
this._receivedFlags = true;
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
this._persistRemoteConfig(response);
|
|
184
|
-
this.startIfEnabledOrStop();
|
|
185
|
-
}
|
|
186
|
-
log(message, level = 'log') {
|
|
187
|
-
if (this._lazyLoadedSessionRecording?.log) {
|
|
188
|
-
this._lazyLoadedSessionRecording.log(message, level);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
logger.warn('log called before recorder was ready');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
get _scriptName() {
|
|
195
|
-
const remoteConfig = this._instance?.persistence?.get_property(SESSION_RECORDING_REMOTE_CONFIG);
|
|
196
|
-
return remoteConfig?.scriptConfig?.script || 'lazy-recorder';
|
|
197
|
-
}
|
|
198
|
-
_onScriptLoaded(startReason) {
|
|
199
|
-
if (this._bootstrapFailed) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const initSessionRecording = assignableWindow.__LeanbaseExtensions__?.initSessionRecording;
|
|
203
|
-
if (!initSessionRecording) {
|
|
204
|
-
if (!this._warnedMissingLoader) {
|
|
205
|
-
log.warn('Session recording disabled: initSessionRecording missing');
|
|
206
|
-
this._warnedMissingLoader = true;
|
|
207
|
-
}
|
|
208
|
-
this._bootstrapFailed = true;
|
|
209
|
-
this.stopRecording();
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (!this._lazyLoadedSessionRecording) {
|
|
213
|
-
this._lazyLoadedSessionRecording = initSessionRecording(this._instance);
|
|
214
|
-
this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture =
|
|
215
|
-
this._forceAllowLocalhostNetworkCapture;
|
|
216
|
-
}
|
|
217
|
-
this._lazyLoadedSessionRecording.start(startReason);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* this is maintained on the public API only because it has always been on the public API
|
|
221
|
-
* if you are calling this directly you are certainly doing something wrong
|
|
222
|
-
* @deprecated
|
|
223
|
-
*/
|
|
224
|
-
onRRwebEmit(rawEvent) {
|
|
225
|
-
this._lazyLoadedSessionRecording?.onRRwebEmit?.(rawEvent);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* this ignores the linked flag config and (if other conditions are met) causes capture to start
|
|
229
|
-
*
|
|
230
|
-
* It is not usual to call this directly,
|
|
231
|
-
* instead call `posthog.startSessionRecording({linked_flag: true})`
|
|
232
|
-
* */
|
|
233
|
-
overrideLinkedFlag() {
|
|
234
|
-
// TODO what if this gets called before lazy loading is done
|
|
235
|
-
this._lazyLoadedSessionRecording?.overrideLinkedFlag();
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* this ignores the sampling config and (if other conditions are met) causes capture to start
|
|
239
|
-
*
|
|
240
|
-
* It is not usual to call this directly,
|
|
241
|
-
* instead call `posthog.startSessionRecording({sampling: true})`
|
|
242
|
-
* */
|
|
243
|
-
overrideSampling() {
|
|
244
|
-
// TODO what if this gets called before lazy loading is done
|
|
245
|
-
this._lazyLoadedSessionRecording?.overrideSampling();
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* this ignores the URL/Event trigger config and (if other conditions are met) causes capture to start
|
|
249
|
-
*
|
|
250
|
-
* It is not usual to call this directly,
|
|
251
|
-
* instead call `posthog.startSessionRecording({trigger: 'url' | 'event'})`
|
|
252
|
-
* */
|
|
253
|
-
overrideTrigger(triggerType) {
|
|
254
|
-
// TODO what if this gets called before lazy loading is done
|
|
255
|
-
this._lazyLoadedSessionRecording?.overrideTrigger(triggerType);
|
|
256
|
-
}
|
|
257
|
-
/*
|
|
258
|
-
* whenever we capture an event, we add these properties to the event
|
|
259
|
-
* these are used to debug issues with the session recording
|
|
260
|
-
* when looking at the event feed for a session
|
|
261
|
-
*/
|
|
262
|
-
get sdkDebugProperties() {
|
|
263
|
-
return (this._lazyLoadedSessionRecording?.sdkDebugProperties || {
|
|
264
|
-
$recording_status: this.status,
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* This adds a custom event to the session recording
|
|
269
|
-
*
|
|
270
|
-
* It is not intended for arbitrary public use - playback only displays known custom events
|
|
271
|
-
* And is exposed on the public interface only so that other parts of the SDK are able to use it
|
|
272
|
-
*
|
|
273
|
-
* if you are calling this from client code, you're probably looking for `posthog.capture('$custom_event', {...})`
|
|
274
|
-
*/
|
|
275
|
-
tryAddCustomEvent(tag, payload) {
|
|
276
|
-
return !!this._lazyLoadedSessionRecording?.tryAddCustomEvent(tag, payload);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
//# sourceMappingURL=session-recording.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-recording.js","sourceRoot":"","sources":["../../../src/extensions/replay/session-recording.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAA;AAK/F,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,Y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