posthog-js 1.46.0 → 1.46.2

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/dist/es.js CHANGED
@@ -917,7 +917,7 @@ var LZString = {
917
917
  }
918
918
  };
919
919
 
920
- var version = "1.46.0";
920
+ var version = "1.46.2";
921
921
 
922
922
  // e.g. Config.DEBUG = Config.DEBUG || instance.get_config('debug')
923
923
 
@@ -1403,7 +1403,7 @@ var _UUID = function () {
1403
1403
  };
1404
1404
 
1405
1405
  return function () {
1406
- var se = (window.screen.height * window.screen.width).toString(16);
1406
+ var se = typeof window !== 'undefined' ? (window.screen.height * window.screen.width).toString(16) : '0';
1407
1407
  return T() + '-' + R() + '-' + UA() + '-' + se + '-' + T();
1408
1408
  };
1409
1409
  }(); // _.isBlockedUA()
@@ -1752,19 +1752,19 @@ var _info = {
1752
1752
  properties: function properties() {
1753
1753
  return _extend(_strip_empty_properties({
1754
1754
  $os: _info.os(),
1755
- $browser: _info.browser(userAgent, navigator.vendor, window.opera),
1755
+ $browser: _info.browser(userAgent, navigator.vendor, win.opera),
1756
1756
  $device: _info.device(userAgent),
1757
1757
  $device_type: _info.deviceType(userAgent)
1758
1758
  }), {
1759
- $current_url: window.location.href,
1760
- $host: window.location.host,
1761
- $pathname: window.location.pathname,
1762
- $browser_version: _info.browserVersion(userAgent, navigator.vendor, window.opera),
1759
+ $current_url: win === null || win === void 0 ? void 0 : win.location.href,
1760
+ $host: win === null || win === void 0 ? void 0 : win.location.host,
1761
+ $pathname: win === null || win === void 0 ? void 0 : win.location.pathname,
1762
+ $browser_version: _info.browserVersion(userAgent, navigator.vendor, win.opera),
1763
1763
  $browser_language: _info.browserLanguage(),
1764
- $screen_height: window.screen.height,
1765
- $screen_width: window.screen.width,
1766
- $viewport_height: window.innerHeight,
1767
- $viewport_width: window.innerWidth,
1764
+ $screen_height: win === null || win === void 0 ? void 0 : win.screen.height,
1765
+ $screen_width: win === null || win === void 0 ? void 0 : win.screen.width,
1766
+ $viewport_height: win === null || win === void 0 ? void 0 : win.innerHeight,
1767
+ $viewport_width: win === null || win === void 0 ? void 0 : win.innerWidth,
1768
1768
  $lib: 'web',
1769
1769
  $lib_version: Config.LIB_VERSION,
1770
1770
  $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
@@ -1775,9 +1775,9 @@ var _info = {
1775
1775
  people_properties: function people_properties() {
1776
1776
  return _extend(_strip_empty_properties({
1777
1777
  $os: _info.os(),
1778
- $browser: _info.browser(userAgent, navigator.vendor, window.opera)
1778
+ $browser: _info.browser(userAgent, navigator.vendor, win.opera)
1779
1779
  }), {
1780
- $browser_version: _info.browserVersion(userAgent, navigator.vendor, window.opera)
1780
+ $browser_version: _info.browserVersion(userAgent, navigator.vendor, win.opera)
1781
1781
  });
1782
1782
  }
1783
1783
  };
@@ -2527,7 +2527,7 @@ var localStore = {
2527
2527
 
2528
2528
  var supported = true;
2529
2529
 
2530
- if (window) {
2530
+ if (typeof window !== 'undefined') {
2531
2531
  try {
2532
2532
  var key = '__mplssupport__',
2533
2533
  val = 'xyz';
@@ -2669,7 +2669,7 @@ var sessionStore = {
2669
2669
 
2670
2670
  sessionStorageSupported = true;
2671
2671
 
2672
- if (window) {
2672
+ if (typeof window !== 'undefined') {
2673
2673
  try {
2674
2674
  var key = '__support__',
2675
2675
  val = 'xyz';
@@ -5888,7 +5888,7 @@ var RetryQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
5888
5888
  _this.areWeOnline = true;
5889
5889
  _this.onXHRError = onXHRError;
5890
5890
 
5891
- if ('onLine' in window.navigator) {
5891
+ if (typeof window !== 'undefined' && 'onLine' in window.navigator) {
5892
5892
  _this.areWeOnline = window.navigator.onLine;
5893
5893
  window.addEventListener('online', function () {
5894
5894
  _this._handleWeAreNowOnline();
@@ -6237,12 +6237,19 @@ var SessionIdManager = /*#__PURE__*/function () {
6237
6237
  * @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry
6238
6238
  * @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)
6239
6239
  */
6240
+ // NOTE - we can't import from @sentry/types because it changes frequently and causes clashes
6241
+ // We only use a small subset of the types, so we can just define the integration overall and use any for the rest
6242
+ // import {
6243
+ // Event as _SentryEvent,
6244
+ // EventProcessor as _SentryEventProcessor,
6245
+ // Hub as _SentryHub,
6246
+ // Integration as _SentryIntegration,
6247
+ // } from '@sentry/types'
6248
+ // Uncomment the above and comment the below to get type checking for development
6240
6249
  var SentryIntegration = /*#__PURE__*/_createClass(function SentryIntegration(_posthog, organization, projectId, prefix) {
6241
6250
  _classCallCheck(this, SentryIntegration);
6242
6251
 
6243
6252
  // setupOnce gets called by Sentry when it intializes the plugin
6244
- // 'this' is not this: PostHogLib object, but the new class that's created.
6245
- // TODO: refactor to a real class. The types
6246
6253
  this.name = 'posthog-js';
6247
6254
 
6248
6255
  this.setupOnce = function (addGlobalEventProcessor) {