posthog-js-lite 2.3.0 → 2.4.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/lib/index.cjs.js +12 -12
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +12 -12
- package/lib/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/posthog-web.ts +4 -0
- package/test/posthog-web.spec.ts +72 -10
package/CHANGELOG.md
CHANGED
package/lib/index.cjs.js
CHANGED
|
@@ -1132,7 +1132,11 @@ var PostHogCoreStateless = /** @class */ (function () {
|
|
|
1132
1132
|
return [4 /*yield*/, this.flushAsync()];
|
|
1133
1133
|
case 2:
|
|
1134
1134
|
_a.sent();
|
|
1135
|
-
return [4 /*yield*/, Promise.
|
|
1135
|
+
return [4 /*yield*/, Promise.all(Object.values(this.pendingPromises).map(function (x) {
|
|
1136
|
+
return x.catch(function () {
|
|
1137
|
+
// ignore errors as we are shutting down and can't deal with them anyways.
|
|
1138
|
+
});
|
|
1139
|
+
}))];
|
|
1136
1140
|
case 3:
|
|
1137
1141
|
_a.sent();
|
|
1138
1142
|
return [3 /*break*/, 5];
|
|
@@ -1164,12 +1168,6 @@ var PostHogCore = /** @class */ (function (_super) {
|
|
|
1164
1168
|
_this.flagCallReported = {};
|
|
1165
1169
|
_this.sendFeatureFlagEvent = (_b = options === null || options === void 0 ? void 0 : options.sendFeatureFlagEvent) !== null && _b !== void 0 ? _b : true;
|
|
1166
1170
|
_this._sessionExpirationTimeSeconds = (_c = options === null || options === void 0 ? void 0 : options.sessionExpirationTimeSeconds) !== null && _c !== void 0 ? _c : 1800; // 30 minutes
|
|
1167
|
-
// NOTE: It is important we don't initiate anything in the constructor as some async IO may still be underway on the parent
|
|
1168
|
-
if ((options === null || options === void 0 ? void 0 : options.preloadFeatureFlags) !== false) {
|
|
1169
|
-
safeSetTimeout(function () {
|
|
1170
|
-
_this.reloadFeatureFlags();
|
|
1171
|
-
}, 1);
|
|
1172
|
-
}
|
|
1173
1171
|
return _this;
|
|
1174
1172
|
}
|
|
1175
1173
|
PostHogCore.prototype.setupBootstrap = function (options) {
|
|
@@ -1284,9 +1282,7 @@ var PostHogCore = /** @class */ (function (_super) {
|
|
|
1284
1282
|
// We keep the AnonymousId to be used by decide calls and identify to link the previousId
|
|
1285
1283
|
this.setPersistedProperty(PostHogPersistedProperty.AnonymousId, previousDistinctId);
|
|
1286
1284
|
this.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId);
|
|
1287
|
-
|
|
1288
|
-
this.reloadFeatureFlags();
|
|
1289
|
-
}
|
|
1285
|
+
this.reloadFeatureFlags();
|
|
1290
1286
|
}
|
|
1291
1287
|
_super.prototype.identifyStateless.call(this, distinctId, allProperties, options);
|
|
1292
1288
|
return this;
|
|
@@ -1326,7 +1322,7 @@ var PostHogCore = /** @class */ (function (_super) {
|
|
|
1326
1322
|
this.register({
|
|
1327
1323
|
$groups: __assign(__assign({}, existingGroups), groups),
|
|
1328
1324
|
});
|
|
1329
|
-
if (Object.keys(groups).find(function (type) { return existingGroups[type] !== groups[type]; })
|
|
1325
|
+
if (Object.keys(groups).find(function (type) { return existingGroups[type] !== groups[type]; })) {
|
|
1330
1326
|
this.reloadFeatureFlags();
|
|
1331
1327
|
}
|
|
1332
1328
|
return this;
|
|
@@ -1559,7 +1555,7 @@ var PostHogCore = /** @class */ (function (_super) {
|
|
|
1559
1555
|
return PostHogCore;
|
|
1560
1556
|
}(PostHogCoreStateless));
|
|
1561
1557
|
|
|
1562
|
-
var version = "2.
|
|
1558
|
+
var version = "2.4.0";
|
|
1563
1559
|
|
|
1564
1560
|
function getContext(window) {
|
|
1565
1561
|
var context = {};
|
|
@@ -1924,6 +1920,10 @@ function (_super) {
|
|
|
1924
1920
|
|
|
1925
1921
|
_this.setupBootstrap(options);
|
|
1926
1922
|
|
|
1923
|
+
if ((options === null || options === void 0 ? void 0 : options.preloadFeatureFlags) !== false) {
|
|
1924
|
+
_this.reloadFeatureFlags();
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
1927
|
return _this;
|
|
1928
1928
|
}
|
|
1929
1929
|
|