posthog-js 1.29.0 → 1.29.3
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 +12 -0
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +23 -12
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +427 -3
- package/dist/module.js +23 -12
- package/dist/module.js.map +1 -1
- package/lib/package.json +20 -9
- package/package.json +20 -9
package/dist/es.js
CHANGED
|
@@ -881,7 +881,7 @@ var LZString = {
|
|
|
881
881
|
}
|
|
882
882
|
};
|
|
883
883
|
|
|
884
|
-
var version = "1.29.
|
|
884
|
+
var version = "1.29.3";
|
|
885
885
|
|
|
886
886
|
// e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
|
|
887
887
|
|
|
@@ -4126,7 +4126,9 @@ var Toolbar = /*#__PURE__*/function () {
|
|
|
4126
4126
|
delete editorParams.userIntent;
|
|
4127
4127
|
}
|
|
4128
4128
|
|
|
4129
|
-
editorParams
|
|
4129
|
+
if (!editorParams.apiURL) {
|
|
4130
|
+
editorParams.apiURL = this.instance.get_config('api_host');
|
|
4131
|
+
}
|
|
4130
4132
|
|
|
4131
4133
|
if (editorParams['token'] && this.instance.get_config('token') === editorParams['token']) {
|
|
4132
4134
|
this._loadEditor(editorParams);
|
|
@@ -4339,19 +4341,27 @@ var RequestQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
|
|
|
4339
4341
|
}, {
|
|
4340
4342
|
key: "unload",
|
|
4341
4343
|
value: function unload() {
|
|
4344
|
+
var _this3 = this;
|
|
4345
|
+
|
|
4342
4346
|
clearTimeout(this._poller);
|
|
4343
4347
|
var requests = this._event_queue.length > 0 ? this.formatQueue() : {};
|
|
4344
4348
|
this._event_queue.length = 0;
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4349
|
+
var requestValues = Object.values(requests); // Always force events to be sent before recordings, as events are more important, and recordings are bigger and thus less likely to arrive
|
|
4350
|
+
|
|
4351
|
+
var sortedRequests = [].concat(_toConsumableArray(requestValues.filter(function (r) {
|
|
4352
|
+
return r.url.indexOf('/e') === 0;
|
|
4353
|
+
})), _toConsumableArray(requestValues.filter(function (r) {
|
|
4354
|
+
return r.url.indexOf('/e') !== 0;
|
|
4355
|
+
})));
|
|
4356
|
+
sortedRequests.map(function (_ref) {
|
|
4357
|
+
var url = _ref.url,
|
|
4358
|
+
data = _ref.data,
|
|
4359
|
+
options = _ref.options;
|
|
4360
|
+
|
|
4361
|
+
_this3.handlePollRequest(url, data, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
4352
4362
|
transport: 'sendBeacon'
|
|
4353
4363
|
}));
|
|
4354
|
-
}
|
|
4364
|
+
});
|
|
4355
4365
|
}
|
|
4356
4366
|
}, {
|
|
4357
4367
|
key: "formatQueue",
|
|
@@ -6126,10 +6136,11 @@ var PostHog = /*#__PURE__*/function () {
|
|
|
6126
6136
|
distinct_id: uuid,
|
|
6127
6137
|
$device_id: uuid
|
|
6128
6138
|
}, '');
|
|
6129
|
-
} // Set up
|
|
6139
|
+
} // Set up event handler for pageleave
|
|
6140
|
+
// Use `onpagehide` if available, see https://calendar.perfplanet.com/2020/beaconing-in-practice/#beaconing-reliability-avoiding-abandons
|
|
6130
6141
|
|
|
6131
6142
|
|
|
6132
|
-
win.addEventListener && win.addEventListener('unload', this._handle_unload.bind(this));
|
|
6143
|
+
win.addEventListener && win.addEventListener('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this));
|
|
6133
6144
|
} // Private methods
|
|
6134
6145
|
|
|
6135
6146
|
}, {
|