posthog-js 1.46.2 → 1.47.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/CHANGELOG.md +5 -0
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +33 -19
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.js +33 -19
- package/dist/module.js.map +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/dist/es.js
CHANGED
|
@@ -917,7 +917,7 @@ var LZString = {
|
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
919
|
|
|
920
|
-
var version = "1.
|
|
920
|
+
var version = "1.47.0";
|
|
921
921
|
|
|
922
922
|
// e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
|
|
923
923
|
|
|
@@ -3534,6 +3534,8 @@ var CAMPAIGN_IDS_KEY = '__cmpns';
|
|
|
3534
3534
|
var EVENT_TIMERS_KEY = '__timers';
|
|
3535
3535
|
var SESSION_RECORDING_ENABLED_SERVER_SIDE = '$session_recording_enabled_server_side';
|
|
3536
3536
|
var CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = '$console_log_recording_enabled_server_side';
|
|
3537
|
+
var SESSION_RECORDING_RECORDER_VERSION_SERVER_SIDE = '$session_recording_recorder_version_server_side'; // follows rrweb versioning
|
|
3538
|
+
|
|
3537
3539
|
var SESSION_ID = '$sesid';
|
|
3538
3540
|
var ENABLED_FEATURE_FLAGS = '$enabled_feature_flags';
|
|
3539
3541
|
var USER_STATE = '$user_state';
|
|
@@ -3987,26 +3989,35 @@ var SessionRecording = /*#__PURE__*/function () {
|
|
|
3987
3989
|
var enabled_client_side = this.instance.get_config('enable_recording_console_log');
|
|
3988
3990
|
return enabled_client_side !== null && enabled_client_side !== void 0 ? enabled_client_side : enabled_server_side;
|
|
3989
3991
|
}
|
|
3992
|
+
}, {
|
|
3993
|
+
key: "getRecordingVersion",
|
|
3994
|
+
value: function getRecordingVersion() {
|
|
3995
|
+
var _this$instance$get_co;
|
|
3996
|
+
|
|
3997
|
+
var recordingVersion_server_side = this.instance.get_property(SESSION_RECORDING_RECORDER_VERSION_SERVER_SIDE);
|
|
3998
|
+
var recordingVersion_client_side = (_this$instance$get_co = this.instance.get_config('session_recording')) === null || _this$instance$get_co === void 0 ? void 0 : _this$instance$get_co.recorderVersion;
|
|
3999
|
+
return recordingVersion_client_side || recordingVersion_server_side || 'v1';
|
|
4000
|
+
}
|
|
3990
4001
|
}, {
|
|
3991
4002
|
key: "afterDecideResponse",
|
|
3992
4003
|
value: function afterDecideResponse(response) {
|
|
3993
|
-
var _response$
|
|
4004
|
+
var _response$sessionReco3, _response$sessionReco5;
|
|
3994
4005
|
|
|
3995
4006
|
this.receivedDecide = true;
|
|
3996
4007
|
|
|
3997
4008
|
if (this.instance.persistence) {
|
|
3998
|
-
var _response$sessionReco, _this$instance$persis;
|
|
4009
|
+
var _response$sessionReco, _response$sessionReco2, _this$instance$persis;
|
|
3999
4010
|
|
|
4000
|
-
this.instance.persistence.register((_this$instance$persis = {}, _defineProperty(_this$instance$persis, SESSION_RECORDING_ENABLED_SERVER_SIDE, !!response['sessionRecording']), _defineProperty(_this$instance$persis, CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE, (_response$sessionReco = response.sessionRecording) === null || _response$sessionReco === void 0 ? void 0 : _response$sessionReco.consoleLogRecordingEnabled), _this$instance$persis));
|
|
4011
|
+
this.instance.persistence.register((_this$instance$persis = {}, _defineProperty(_this$instance$persis, SESSION_RECORDING_ENABLED_SERVER_SIDE, !!response['sessionRecording']), _defineProperty(_this$instance$persis, CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE, (_response$sessionReco = response.sessionRecording) === null || _response$sessionReco === void 0 ? void 0 : _response$sessionReco.consoleLogRecordingEnabled), _defineProperty(_this$instance$persis, SESSION_RECORDING_RECORDER_VERSION_SERVER_SIDE, (_response$sessionReco2 = response.sessionRecording) === null || _response$sessionReco2 === void 0 ? void 0 : _response$sessionReco2.recorderVersion), _this$instance$persis));
|
|
4001
4012
|
}
|
|
4002
4013
|
|
|
4003
|
-
if ((_response$
|
|
4004
|
-
var _response$
|
|
4014
|
+
if ((_response$sessionReco3 = response.sessionRecording) !== null && _response$sessionReco3 !== void 0 && _response$sessionReco3.endpoint) {
|
|
4015
|
+
var _response$sessionReco4;
|
|
4005
4016
|
|
|
4006
|
-
this.endpoint = (_response$
|
|
4017
|
+
this.endpoint = (_response$sessionReco4 = response.sessionRecording) === null || _response$sessionReco4 === void 0 ? void 0 : _response$sessionReco4.endpoint;
|
|
4007
4018
|
}
|
|
4008
4019
|
|
|
4009
|
-
if ((_response$
|
|
4020
|
+
if ((_response$sessionReco5 = response.sessionRecording) !== null && _response$sessionReco5 !== void 0 && _response$sessionReco5.recorderVersion) {
|
|
4010
4021
|
this.recorderVersion = response.sessionRecording.recorderVersion;
|
|
4011
4022
|
}
|
|
4012
4023
|
|
|
@@ -4040,17 +4051,16 @@ var SessionRecording = /*#__PURE__*/function () {
|
|
|
4040
4051
|
// Thus instead of MutationObserver, we look for this function and block recording if it's undefined.
|
|
4041
4052
|
if (typeof Object.assign === 'undefined') {
|
|
4042
4053
|
return;
|
|
4043
|
-
}
|
|
4054
|
+
} // Nested if block ensures we do not switch recorder versions midway through a recording.
|
|
4044
4055
|
|
|
4045
|
-
if (!this.captureStarted && !this.instance.get_config('disable_session_recording')) {
|
|
4046
|
-
var userSessionRecordingOptions = this.instance.get_config('session_recording'); // Always use the client side setting if given, otherwise use the server side setting
|
|
4047
4056
|
|
|
4048
|
-
|
|
4049
|
-
var recorderJS = this.
|
|
4050
|
-
this.captureStarted = true; // If recorder.js is already loaded (if array.full.js snippet is used or posthog-js/dist/recorder is
|
|
4051
|
-
//
|
|
4057
|
+
if (!this.captureStarted && !this.instance.get_config('disable_session_recording')) {
|
|
4058
|
+
var recorderJS = this.getRecordingVersion() === 'v2' ? 'recorder-v2.js' : 'recorder.js';
|
|
4059
|
+
this.captureStarted = true; // If recorder.js is already loaded (if array.full.js snippet is used or posthog-js/dist/recorder is
|
|
4060
|
+
// imported) or matches the requested recorder version, don't load script. Otherwise, remotely import
|
|
4061
|
+
// recorder.js from cdn since it hasn't been loaded.
|
|
4052
4062
|
|
|
4053
|
-
if (
|
|
4063
|
+
if (this.instance.__loaded_recorder_version !== this.getRecordingVersion()) {
|
|
4054
4064
|
loadScript(this.instance.get_config('api_host') + "/static/".concat(recorderJS, "?v=").concat(Config.LIB_VERSION), this._onScriptLoaded.bind(this));
|
|
4055
4065
|
}
|
|
4056
4066
|
|
|
@@ -6572,7 +6582,7 @@ var create_mplib = function create_mplib(token, config, name) {
|
|
|
6572
6582
|
|
|
6573
6583
|
|
|
6574
6584
|
var PostHog = /*#__PURE__*/function () {
|
|
6575
|
-
// flag that
|
|
6585
|
+
// flag that keeps track of which version of recorder is loaded
|
|
6576
6586
|
function PostHog() {
|
|
6577
6587
|
var _this = this;
|
|
6578
6588
|
|
|
@@ -6590,7 +6600,7 @@ var PostHog = /*#__PURE__*/function () {
|
|
|
6590
6600
|
this.__captureHooks = [];
|
|
6591
6601
|
this.__request_queue = [];
|
|
6592
6602
|
this.__loaded = false;
|
|
6593
|
-
this.
|
|
6603
|
+
this.__loaded_recorder_version = undefined;
|
|
6594
6604
|
this.__autocapture = undefined;
|
|
6595
6605
|
|
|
6596
6606
|
this._jsc = function () {};
|
|
@@ -6676,7 +6686,11 @@ var PostHog = /*#__PURE__*/function () {
|
|
|
6676
6686
|
|
|
6677
6687
|
|
|
6678
6688
|
if (win !== null && win !== void 0 && (_window$rrweb = win.rrweb) !== null && _window$rrweb !== void 0 && _window$rrweb.record || win !== null && win !== void 0 && win.rrwebRecord) {
|
|
6679
|
-
|
|
6689
|
+
var _window$rrweb2;
|
|
6690
|
+
|
|
6691
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6692
|
+
// @ts-ignore
|
|
6693
|
+
this.__loaded_recorder_version = win === null || win === void 0 ? void 0 : (_window$rrweb2 = win.rrweb) === null || _window$rrweb2 === void 0 ? void 0 : _window$rrweb2.version;
|
|
6680
6694
|
}
|
|
6681
6695
|
|
|
6682
6696
|
this._captureMetrics = new CaptureMetrics(this.get_config('_capture_metrics'));
|