posthog-node 2.5.1 → 2.5.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 CHANGED
@@ -1,10 +1,20 @@
1
+ # 2.5.3 - 2023-02-21
2
+
3
+ 1. Allow passing in a distinctId to `groupIdentify()`.
4
+ 2. Fix a bug with active feature flags on capture events, where non-active flags would be added to the list as well.
5
+ # 2.5.2 - 2023-02-17
6
+
7
+ 1. Fix issue where properties passed to `.identify` were not set correctly
8
+
1
9
  # 2.5.1 - 2023-02-16
2
10
 
3
11
  1. Make sure shutdown waits for pending promises to resolve. Fixes a problem with using PostHog Node in serverless environments.
12
+
4
13
  # 2.5.0 - 2023-02-15
5
14
 
6
15
  1. Removes shared client from `posthog-node`, getting rid of some race condition bugs when capturing events.
7
16
  2. Sets minimum version of node.js to 15
17
+
8
18
  # 2.4.0 - 2023-02-02
9
19
 
10
20
  1. Adds support for overriding timestamp of capture events
package/lib/index.cjs.js CHANGED
@@ -163,7 +163,7 @@ function __spreadArray(to, from, pack) {
163
163
  return to.concat(ar || Array.prototype.slice.call(from));
164
164
  }
165
165
 
166
- var version = "2.5.1";
166
+ var version = "2.5.3";
167
167
 
168
168
  var PostHogPersistedProperty;
169
169
  (function (PostHogPersistedProperty) {
@@ -2355,12 +2355,19 @@ function (_super) {
2355
2355
  var _b = _a[_i],
2356
2356
  feature = _b[0],
2357
2357
  variant = _b[1];
2358
- featureVariantProperties["$feature/".concat(feature)] = variant;
2358
+
2359
+ if (variant !== false) {
2360
+ featureVariantProperties["$feature/".concat(feature)] = variant;
2361
+ }
2359
2362
  }
2360
2363
  }
2361
2364
 
2365
+ var activeFlags = Object.keys(flags || {}).filter(function (flag) {
2366
+ return (flags === null || flags === void 0 ? void 0 : flags[flag]) !== false;
2367
+ });
2368
+
2362
2369
  var flagProperties = __assign({
2363
- $active_feature_flags: flags ? Object.keys(flags) : undefined
2370
+ $active_feature_flags: activeFlags || undefined
2364
2371
  }, featureVariantProperties);
2365
2372
 
2366
2373
  _capture(__assign(__assign(__assign({}, properties), {
@@ -2376,9 +2383,13 @@ function (_super) {
2376
2383
 
2377
2384
  PostHog.prototype.identify = function (_a) {
2378
2385
  var distinctId = _a.distinctId,
2379
- properties = _a.properties;
2386
+ properties = _a.properties; // Catch properties passed as $set and move them to the top level
2380
2387
 
2381
- _super.prototype.identifyStateless.call(this, distinctId, properties);
2388
+ var personProperties = (properties === null || properties === void 0 ? void 0 : properties.$set) || properties;
2389
+
2390
+ _super.prototype.identifyStateless.call(this, distinctId, {
2391
+ $set: personProperties
2392
+ });
2382
2393
  };
2383
2394
 
2384
2395
  PostHog.prototype.alias = function (data) {
@@ -2643,9 +2654,10 @@ function (_super) {
2643
2654
  PostHog.prototype.groupIdentify = function (_a) {
2644
2655
  var groupType = _a.groupType,
2645
2656
  groupKey = _a.groupKey,
2646
- properties = _a.properties;
2657
+ properties = _a.properties,
2658
+ distinctId = _a.distinctId;
2647
2659
 
2648
- _super.prototype.groupIdentifyStateless.call(this, groupType, groupKey, properties);
2660
+ _super.prototype.groupIdentifyStateless.call(this, groupType, groupKey, properties, undefined, distinctId);
2649
2661
  };
2650
2662
 
2651
2663
  PostHog.prototype.reloadFeatureFlags = function () {