@leanbase-giangnd/js 0.1.0 → 0.1.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/dist/index.cjs +190 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4990 -313
- package/dist/index.mjs +191 -173
- package/dist/index.mjs.map +1 -1
- package/dist/leanbase.iife.js +190 -172
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/extensions/replay/extension-shim.ts +35 -0
- package/src/extensions/replay/external/lazy-loaded-session-recorder.ts +12 -1
- package/src/extensions/replay/session-recording.ts +11 -29
- package/src/leanbase.ts +8 -0
- package/src/types.ts +9 -0
- package/src/version.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1185,7 +1185,7 @@ const detectDeviceType = function (user_agent) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
};
|
|
1187
1187
|
|
|
1188
|
-
var version = "0.1.
|
|
1188
|
+
var version = "0.1.1";
|
|
1189
1189
|
var packageInfo = {
|
|
1190
1190
|
version: version};
|
|
1191
1191
|
|
|
@@ -3123,89 +3123,6 @@ const isLikelyBot = function (navigator, customBlockedUserAgents) {
|
|
|
3123
3123
|
// It would be very bad if posthog-js caused a permission prompt to appear on every page load.
|
|
3124
3124
|
};
|
|
3125
3125
|
|
|
3126
|
-
// Type definitions copied from @rrweb/types@2.0.0-alpha.17 and rrweb-snapshot@2.0.0-alpha.17
|
|
3127
|
-
// Both packages are MIT licensed: https://github.com/rrweb-io/rrweb
|
|
3128
|
-
//
|
|
3129
|
-
// These types are copied here to avoid requiring users to install peer dependencies
|
|
3130
|
-
// solely for TypeScript type information.
|
|
3131
|
-
//
|
|
3132
|
-
// Original sources:
|
|
3133
|
-
// - @rrweb/types: https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/types
|
|
3134
|
-
// - rrweb-snapshot: https://github.com/rrweb-io/rrweb/tree/main/packages/rrweb-snapshot
|
|
3135
|
-
var NodeType;
|
|
3136
|
-
(function (NodeType) {
|
|
3137
|
-
NodeType[NodeType["Document"] = 0] = "Document";
|
|
3138
|
-
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
3139
|
-
NodeType[NodeType["Element"] = 2] = "Element";
|
|
3140
|
-
NodeType[NodeType["Text"] = 3] = "Text";
|
|
3141
|
-
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
3142
|
-
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
3143
|
-
})(NodeType || (NodeType = {}));
|
|
3144
|
-
var EventType;
|
|
3145
|
-
(function (EventType) {
|
|
3146
|
-
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
3147
|
-
EventType[EventType["Load"] = 1] = "Load";
|
|
3148
|
-
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
3149
|
-
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
3150
|
-
EventType[EventType["Meta"] = 4] = "Meta";
|
|
3151
|
-
EventType[EventType["Custom"] = 5] = "Custom";
|
|
3152
|
-
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
3153
|
-
})(EventType || (EventType = {}));
|
|
3154
|
-
var IncrementalSource;
|
|
3155
|
-
(function (IncrementalSource) {
|
|
3156
|
-
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
3157
|
-
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
3158
|
-
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
3159
|
-
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
3160
|
-
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
3161
|
-
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
3162
|
-
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
3163
|
-
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
3164
|
-
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
3165
|
-
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
3166
|
-
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
3167
|
-
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
3168
|
-
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
3169
|
-
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
3170
|
-
IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
|
|
3171
|
-
IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
3172
|
-
IncrementalSource[IncrementalSource["CustomElement"] = 16] = "CustomElement";
|
|
3173
|
-
})(IncrementalSource || (IncrementalSource = {}));
|
|
3174
|
-
var MouseInteractions;
|
|
3175
|
-
(function (MouseInteractions) {
|
|
3176
|
-
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
3177
|
-
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
3178
|
-
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
3179
|
-
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
3180
|
-
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
3181
|
-
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
3182
|
-
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
3183
|
-
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
3184
|
-
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
3185
|
-
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
3186
|
-
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
3187
|
-
})(MouseInteractions || (MouseInteractions = {}));
|
|
3188
|
-
var PointerTypes;
|
|
3189
|
-
(function (PointerTypes) {
|
|
3190
|
-
PointerTypes[PointerTypes["Mouse"] = 0] = "Mouse";
|
|
3191
|
-
PointerTypes[PointerTypes["Pen"] = 1] = "Pen";
|
|
3192
|
-
PointerTypes[PointerTypes["Touch"] = 2] = "Touch";
|
|
3193
|
-
})(PointerTypes || (PointerTypes = {}));
|
|
3194
|
-
var MediaInteractions;
|
|
3195
|
-
(function (MediaInteractions) {
|
|
3196
|
-
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
3197
|
-
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
3198
|
-
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
3199
|
-
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
3200
|
-
MediaInteractions[MediaInteractions["RateChange"] = 4] = "RateChange";
|
|
3201
|
-
})(MediaInteractions || (MediaInteractions = {}));
|
|
3202
|
-
var CanvasContext;
|
|
3203
|
-
(function (CanvasContext) {
|
|
3204
|
-
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
3205
|
-
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
3206
|
-
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
3207
|
-
})(CanvasContext || (CanvasContext = {}));
|
|
3208
|
-
|
|
3209
3126
|
const _createLogger = prefix => {
|
|
3210
3127
|
return {
|
|
3211
3128
|
info: (...args) => logger$3.info(prefix, ...args),
|
|
@@ -3221,6 +3138,69 @@ const _createLogger = prefix => {
|
|
|
3221
3138
|
const logger$2 = _createLogger('[Leanbase]');
|
|
3222
3139
|
const createLogger = _createLogger;
|
|
3223
3140
|
|
|
3141
|
+
function patch(source, name, replacement) {
|
|
3142
|
+
try {
|
|
3143
|
+
if (!(name in source)) {
|
|
3144
|
+
return () => {
|
|
3145
|
+
//
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
const original = source[name];
|
|
3149
|
+
const wrapped = replacement(original);
|
|
3150
|
+
if (core.isFunction(wrapped)) {
|
|
3151
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3152
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
3153
|
+
Object.defineProperties(wrapped, {
|
|
3154
|
+
__posthog_wrapped__: {
|
|
3155
|
+
enumerable: false,
|
|
3156
|
+
value: true
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
}
|
|
3160
|
+
source[name] = wrapped;
|
|
3161
|
+
return () => {
|
|
3162
|
+
source[name] = original;
|
|
3163
|
+
};
|
|
3164
|
+
} catch {
|
|
3165
|
+
return () => {
|
|
3166
|
+
//
|
|
3167
|
+
};
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
function hostnameFromURL(url) {
|
|
3172
|
+
try {
|
|
3173
|
+
if (typeof url === 'string') {
|
|
3174
|
+
return new URL(url).hostname;
|
|
3175
|
+
}
|
|
3176
|
+
if ('url' in url) {
|
|
3177
|
+
return new URL(url.url).hostname;
|
|
3178
|
+
}
|
|
3179
|
+
return url.hostname;
|
|
3180
|
+
} catch {
|
|
3181
|
+
return null;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
function isHostOnDenyList(url, options) {
|
|
3185
|
+
const hostname = hostnameFromURL(url);
|
|
3186
|
+
const defaultNotDenied = {
|
|
3187
|
+
hostname,
|
|
3188
|
+
isHostDenied: false
|
|
3189
|
+
};
|
|
3190
|
+
if (!options.payloadHostDenyList?.length || !hostname?.trim().length) {
|
|
3191
|
+
return defaultNotDenied;
|
|
3192
|
+
}
|
|
3193
|
+
for (const deny of options.payloadHostDenyList) {
|
|
3194
|
+
if (hostname.endsWith(deny)) {
|
|
3195
|
+
return {
|
|
3196
|
+
hostname,
|
|
3197
|
+
isHostDenied: true
|
|
3198
|
+
};
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
return defaultNotDenied;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3224
3204
|
const LOGGER_PREFIX$2 = '[SessionRecording]';
|
|
3225
3205
|
const REDACTED = 'redacted';
|
|
3226
3206
|
const defaultNetworkOptions = {
|
|
@@ -3377,69 +3357,6 @@ const buildNetworkRequestOptions = (instanceConfig, remoteNetworkOptions = {}) =
|
|
|
3377
3357
|
};
|
|
3378
3358
|
};
|
|
3379
3359
|
|
|
3380
|
-
function patch(source, name, replacement) {
|
|
3381
|
-
try {
|
|
3382
|
-
if (!(name in source)) {
|
|
3383
|
-
return () => {
|
|
3384
|
-
//
|
|
3385
|
-
};
|
|
3386
|
-
}
|
|
3387
|
-
const original = source[name];
|
|
3388
|
-
const wrapped = replacement(original);
|
|
3389
|
-
if (core.isFunction(wrapped)) {
|
|
3390
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3391
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
3392
|
-
Object.defineProperties(wrapped, {
|
|
3393
|
-
__posthog_wrapped__: {
|
|
3394
|
-
enumerable: false,
|
|
3395
|
-
value: true
|
|
3396
|
-
}
|
|
3397
|
-
});
|
|
3398
|
-
}
|
|
3399
|
-
source[name] = wrapped;
|
|
3400
|
-
return () => {
|
|
3401
|
-
source[name] = original;
|
|
3402
|
-
};
|
|
3403
|
-
} catch {
|
|
3404
|
-
return () => {
|
|
3405
|
-
//
|
|
3406
|
-
};
|
|
3407
|
-
}
|
|
3408
|
-
}
|
|
3409
|
-
|
|
3410
|
-
function hostnameFromURL(url) {
|
|
3411
|
-
try {
|
|
3412
|
-
if (typeof url === 'string') {
|
|
3413
|
-
return new URL(url).hostname;
|
|
3414
|
-
}
|
|
3415
|
-
if ('url' in url) {
|
|
3416
|
-
return new URL(url.url).hostname;
|
|
3417
|
-
}
|
|
3418
|
-
return url.hostname;
|
|
3419
|
-
} catch {
|
|
3420
|
-
return null;
|
|
3421
|
-
}
|
|
3422
|
-
}
|
|
3423
|
-
function isHostOnDenyList(url, options) {
|
|
3424
|
-
const hostname = hostnameFromURL(url);
|
|
3425
|
-
const defaultNotDenied = {
|
|
3426
|
-
hostname,
|
|
3427
|
-
isHostDenied: false
|
|
3428
|
-
};
|
|
3429
|
-
if (!options.payloadHostDenyList?.length || !hostname?.trim().length) {
|
|
3430
|
-
return defaultNotDenied;
|
|
3431
|
-
}
|
|
3432
|
-
for (const deny of options.payloadHostDenyList) {
|
|
3433
|
-
if (hostname.endsWith(deny)) {
|
|
3434
|
-
return {
|
|
3435
|
-
hostname,
|
|
3436
|
-
isHostDenied: true
|
|
3437
|
-
};
|
|
3438
|
-
}
|
|
3439
|
-
}
|
|
3440
|
-
return defaultNotDenied;
|
|
3441
|
-
}
|
|
3442
|
-
|
|
3443
3360
|
/// <reference lib="dom" />
|
|
3444
3361
|
const logger$1 = createLogger('[Recorder]');
|
|
3445
3362
|
const isNavigationTiming = entry => entry.entryType === 'navigation';
|
|
@@ -3998,6 +3915,108 @@ const getRecordNetworkPlugin = options => {
|
|
|
3998
3915
|
};
|
|
3999
3916
|
// rrweb/networ@1 ends
|
|
4000
3917
|
|
|
3918
|
+
// Use a safe global target (prefer `win`, fallback to globalThis)
|
|
3919
|
+
const _target = win ?? globalThis;
|
|
3920
|
+
_target.__PosthogExtensions__ = _target.__PosthogExtensions__ || {};
|
|
3921
|
+
// Expose rrweb.record under the same contract
|
|
3922
|
+
_target.__PosthogExtensions__.rrweb = _target.__PosthogExtensions__.rrweb || {
|
|
3923
|
+
record: record.record
|
|
3924
|
+
};
|
|
3925
|
+
// Provide initSessionRecording if not present — return a new LazyLoadedSessionRecording when called
|
|
3926
|
+
_target.__PosthogExtensions__.initSessionRecording = _target.__PosthogExtensions__.initSessionRecording || (instance => {
|
|
3927
|
+
return new LazyLoadedSessionRecording(instance);
|
|
3928
|
+
});
|
|
3929
|
+
// Provide a no-op loadExternalDependency that calls the callback immediately (since rrweb is bundled)
|
|
3930
|
+
_target.__PosthogExtensions__.loadExternalDependency = _target.__PosthogExtensions__.loadExternalDependency || ((instance, scriptName, cb) => {
|
|
3931
|
+
if (cb) cb(undefined);
|
|
3932
|
+
});
|
|
3933
|
+
// Provide rrwebPlugins object with network plugin factory if not present
|
|
3934
|
+
_target.__PosthogExtensions__.rrwebPlugins = _target.__PosthogExtensions__.rrwebPlugins || {};
|
|
3935
|
+
_target.__PosthogExtensions__.rrwebPlugins.getRecordNetworkPlugin = _target.__PosthogExtensions__.rrwebPlugins.getRecordNetworkPlugin || (() => getRecordNetworkPlugin);
|
|
3936
|
+
|
|
3937
|
+
// Type definitions copied from @rrweb/types@2.0.0-alpha.17 and rrweb-snapshot@2.0.0-alpha.17
|
|
3938
|
+
// Both packages are MIT licensed: https://github.com/rrweb-io/rrweb
|
|
3939
|
+
//
|
|
3940
|
+
// These types are copied here to avoid requiring users to install peer dependencies
|
|
3941
|
+
// solely for TypeScript type information.
|
|
3942
|
+
//
|
|
3943
|
+
// Original sources:
|
|
3944
|
+
// - @rrweb/types: https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/types
|
|
3945
|
+
// - rrweb-snapshot: https://github.com/rrweb-io/rrweb/tree/main/packages/rrweb-snapshot
|
|
3946
|
+
var NodeType;
|
|
3947
|
+
(function (NodeType) {
|
|
3948
|
+
NodeType[NodeType["Document"] = 0] = "Document";
|
|
3949
|
+
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
3950
|
+
NodeType[NodeType["Element"] = 2] = "Element";
|
|
3951
|
+
NodeType[NodeType["Text"] = 3] = "Text";
|
|
3952
|
+
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
3953
|
+
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
3954
|
+
})(NodeType || (NodeType = {}));
|
|
3955
|
+
var EventType;
|
|
3956
|
+
(function (EventType) {
|
|
3957
|
+
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
3958
|
+
EventType[EventType["Load"] = 1] = "Load";
|
|
3959
|
+
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
3960
|
+
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
3961
|
+
EventType[EventType["Meta"] = 4] = "Meta";
|
|
3962
|
+
EventType[EventType["Custom"] = 5] = "Custom";
|
|
3963
|
+
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
3964
|
+
})(EventType || (EventType = {}));
|
|
3965
|
+
var IncrementalSource;
|
|
3966
|
+
(function (IncrementalSource) {
|
|
3967
|
+
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
3968
|
+
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
3969
|
+
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
3970
|
+
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
3971
|
+
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
3972
|
+
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
3973
|
+
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
3974
|
+
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
3975
|
+
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
3976
|
+
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
3977
|
+
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
3978
|
+
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
3979
|
+
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
3980
|
+
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
3981
|
+
IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
|
|
3982
|
+
IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
3983
|
+
IncrementalSource[IncrementalSource["CustomElement"] = 16] = "CustomElement";
|
|
3984
|
+
})(IncrementalSource || (IncrementalSource = {}));
|
|
3985
|
+
var MouseInteractions;
|
|
3986
|
+
(function (MouseInteractions) {
|
|
3987
|
+
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
3988
|
+
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
3989
|
+
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
3990
|
+
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
3991
|
+
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
3992
|
+
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
3993
|
+
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
3994
|
+
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
3995
|
+
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
3996
|
+
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
3997
|
+
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
3998
|
+
})(MouseInteractions || (MouseInteractions = {}));
|
|
3999
|
+
var PointerTypes;
|
|
4000
|
+
(function (PointerTypes) {
|
|
4001
|
+
PointerTypes[PointerTypes["Mouse"] = 0] = "Mouse";
|
|
4002
|
+
PointerTypes[PointerTypes["Pen"] = 1] = "Pen";
|
|
4003
|
+
PointerTypes[PointerTypes["Touch"] = 2] = "Touch";
|
|
4004
|
+
})(PointerTypes || (PointerTypes = {}));
|
|
4005
|
+
var MediaInteractions;
|
|
4006
|
+
(function (MediaInteractions) {
|
|
4007
|
+
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
4008
|
+
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
4009
|
+
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
4010
|
+
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
4011
|
+
MediaInteractions[MediaInteractions["RateChange"] = 4] = "RateChange";
|
|
4012
|
+
})(MediaInteractions || (MediaInteractions = {}));
|
|
4013
|
+
var CanvasContext;
|
|
4014
|
+
(function (CanvasContext) {
|
|
4015
|
+
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
4016
|
+
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
4017
|
+
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
4018
|
+
})(CanvasContext || (CanvasContext = {}));
|
|
4019
|
+
|
|
4001
4020
|
const DISABLED = 'disabled';
|
|
4002
4021
|
const SAMPLED = 'sampled';
|
|
4003
4022
|
const ACTIVE = 'active';
|
|
@@ -4454,6 +4473,15 @@ const newQueuedEvent = rrwebMethod => ({
|
|
|
4454
4473
|
attempt: 1
|
|
4455
4474
|
});
|
|
4456
4475
|
function getRRWebRecord() {
|
|
4476
|
+
try {
|
|
4477
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4478
|
+
const ext = globalThis.__PosthogExtensions__;
|
|
4479
|
+
if (ext && ext.rrweb && ext.rrweb.record) {
|
|
4480
|
+
return ext.rrweb.record;
|
|
4481
|
+
}
|
|
4482
|
+
} catch {
|
|
4483
|
+
// ignore
|
|
4484
|
+
}
|
|
4457
4485
|
return record.record;
|
|
4458
4486
|
}
|
|
4459
4487
|
function gzipToString(data) {
|
|
@@ -5165,7 +5193,7 @@ class LazyLoadedSessionRecording {
|
|
|
5165
5193
|
_captureSnapshot(properties) {
|
|
5166
5194
|
// :TRICKY: Make sure we batch these requests, use a custom endpoint and don't truncate the strings.
|
|
5167
5195
|
this._instance.capture('$snapshot', properties, {
|
|
5168
|
-
_url: this.
|
|
5196
|
+
_url: this._instance.requestRouter.endpointFor('api', this._endpoint),
|
|
5169
5197
|
_noTruncate: true,
|
|
5170
5198
|
_batchKey: SESSION_RECORDING_BATCH_KEY,
|
|
5171
5199
|
skip_client_rate_limiting: true
|
|
@@ -5497,35 +5525,22 @@ class SessionRecording {
|
|
|
5497
5525
|
}
|
|
5498
5526
|
}
|
|
5499
5527
|
get _isRecordingEnabled() {
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
return false;
|
|
5505
|
-
}
|
|
5506
|
-
if (this._instance.config.disable_session_recording) {
|
|
5507
|
-
return false;
|
|
5508
|
-
}
|
|
5509
|
-
return true;
|
|
5528
|
+
const enabled_server_side = !!this._instance.get_property(SESSION_RECORDING_REMOTE_CONFIG)?.enabled;
|
|
5529
|
+
const enabled_client_side = !this._instance.config.disable_session_recording;
|
|
5530
|
+
const isDisabled = this._instance.config.disable_session_recording || this._instance.consent?.isOptedOut?.();
|
|
5531
|
+
return win && enabled_server_side && enabled_client_side && !isDisabled;
|
|
5510
5532
|
}
|
|
5511
5533
|
startIfEnabledOrStop(startReason) {
|
|
5512
|
-
|
|
5513
|
-
if (!this._isRecordingEnabled || !canRunReplay) {
|
|
5514
|
-
this.stopRecording();
|
|
5534
|
+
if (this._isRecordingEnabled && this._lazyLoadedSessionRecording?.isStarted) {
|
|
5515
5535
|
return;
|
|
5516
5536
|
}
|
|
5517
|
-
|
|
5518
|
-
|
|
5537
|
+
const canRunReplay = !core.isUndefined(Object.assign) && !core.isUndefined(Array.from);
|
|
5538
|
+
if (this._isRecordingEnabled && canRunReplay) {
|
|
5539
|
+
this._lazyLoadAndStart(startReason);
|
|
5540
|
+
log.info('starting');
|
|
5541
|
+
} else {
|
|
5542
|
+
this.stopRecording();
|
|
5519
5543
|
}
|
|
5520
|
-
// According to the rrweb docs, rrweb is not supported on IE11 and below:
|
|
5521
|
-
// "rrweb does not support IE11 and below because it uses the MutationObserver API, which was supported by these browsers."
|
|
5522
|
-
// https://github.com/rrweb-io/rrweb/blob/master/guide.md#compatibility-note
|
|
5523
|
-
//
|
|
5524
|
-
// However, MutationObserver does exist on IE11, it just doesn't work well and does not detect all changes.
|
|
5525
|
-
// Instead, when we load "recorder.js", the first JS error is about "Object.assign" and "Array.from" being undefined.
|
|
5526
|
-
// Thus instead of MutationObserver, we look for this function and block recording if it's undefined.
|
|
5527
|
-
this._lazyLoadAndStart(startReason);
|
|
5528
|
-
log.info('starting');
|
|
5529
5544
|
}
|
|
5530
5545
|
/**
|
|
5531
5546
|
* session recording waits until it receives remote config before loading the script
|
|
@@ -5830,6 +5845,9 @@ class Leanbase extends core.PostHogCore {
|
|
|
5830
5845
|
};
|
|
5831
5846
|
if (core.isObject(config)) {
|
|
5832
5847
|
extend(this.config, config);
|
|
5848
|
+
if (!this.config.api_host && this.config.host) {
|
|
5849
|
+
this.config.api_host = this.config.host;
|
|
5850
|
+
}
|
|
5833
5851
|
this.persistence?.update_config(this.config, oldConfig);
|
|
5834
5852
|
this.replayAutocapture?.startIfEnabled();
|
|
5835
5853
|
this.sessionRecording?.startIfEnabledOrStop();
|