posthog-js 1.155.2 → 1.155.4

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.155.2",
3
+ "version": "1.155.4",
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",
@@ -59,6 +59,7 @@ export declare class PostHog {
59
59
  __request_queue: QueuedRequestOptions[];
60
60
  decideEndpointWasHit: boolean;
61
61
  analyticsDefaultEndpoint: string;
62
+ version: string;
62
63
  SentryIntegration: typeof SentryIntegration;
63
64
  sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType<typeof sentryIntegration>;
64
65
  private _internalEventEmitter;
@@ -140,7 +141,7 @@ export declare class PostHog {
140
141
  */
141
142
  capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | void;
142
143
  _addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): void;
143
- _calculate_event_properties(event_name: string, event_properties: Properties, timestamp: Date): Properties;
144
+ _calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties;
144
145
  _calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined;
145
146
  /**
146
147
  * Register a set of super properties, which are included with all
@@ -204,6 +204,7 @@ var PostHog = /** @class */ (function () {
204
204
  function PostHog() {
205
205
  var _this = this;
206
206
  this.webPerformance = new DeprecatedWebPerformanceObserver();
207
+ this.version = Config.LIB_VERSION;
207
208
  this._internalEventEmitter = new SimpleEventEmitter();
208
209
  this.config = defaultConfig();
209
210
  this.decideEndpointWasHit = false;
@@ -303,7 +304,7 @@ var PostHog = /** @class */ (function () {
303
304
  if (this.config.on_xhr_error) {
304
305
  logger.error('[posthog] on_xhr_error is deprecated. Use on_request_error instead');
305
306
  }
306
- this.compression = config.disable_compression ? undefined : Compression.Base64;
307
+ this.compression = config.disable_compression ? undefined : Compression.GZipJS;
307
308
  this.persistence = new PostHogPersistence(this.config);
308
309
  this.sessionPersistence =
309
310
  this.config.persistence === 'sessionStorage'
@@ -711,6 +712,7 @@ var PostHog = /** @class */ (function () {
711
712
  this.on('eventCaptured', function (data) { return callback(data.event, data); });
712
713
  };
713
714
  PostHog.prototype._calculate_event_properties = function (event_name, event_properties, timestamp) {
715
+ timestamp = timestamp || new Date();
714
716
  if (!this.persistence || !this.sessionPersistence) {
715
717
  return event_properties;
716
718
  }