posthog-js 1.81.3 → 1.82.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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.81.3",
3
+ "version": "1.82.0",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
35
35
  return to.concat(ar || Array.prototype.slice.call(from));
36
36
  };
37
37
  import Config from './config';
38
- import { _copyAndTruncateStrings, _each, _eachArray, _extend, _info, _isArray, _isBlockedUA, _isObject, _isUndefined, _register_event, _safewrap_class, document, logger, userAgent, window, } from './utils';
38
+ import { _copyAndTruncateStrings, _each, _eachArray, _extend, _info, _isArray, _isBlockedUA, _isEmptyObject, _isObject, _isUndefined, _register_event, _safewrap_class, document, logger, userAgent, window, } from './utils';
39
39
  import { autocapture } from './autocapture';
40
40
  import { PostHogFeatureFlags } from './posthog-featureflags';
41
41
  import { PostHogPersistence } from './posthog-persistence';
@@ -752,6 +752,12 @@ var PostHog = /** @class */ (function () {
752
752
  }
753
753
  data = _copyAndTruncateStrings(data, options._noTruncate ? null : this.config.properties_string_max_length);
754
754
  data.timestamp = options.timestamp || new Date();
755
+ // Top-level $set overriding values from the one from properties is taken from the plugin-server normalizeEvent
756
+ // This doesn't handle $set_once, because posthog-people doesn't either
757
+ var finalSet = __assign(__assign({}, data.properties['$set']), data['$set']);
758
+ if (!_isEmptyObject(finalSet)) {
759
+ this.setPersonPropertiesForFlags(finalSet);
760
+ }
755
761
  if (this.config.debug) {
756
762
  logger.log('PostHog.js send', data);
757
763
  }