@statsig/client-core 3.15.1 → 3.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/client-core",
3
- "version": "3.15.1",
3
+ "version": "3.15.2",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -5,7 +5,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports._getInstance = exports._getStatsigGlobalFlag = exports._getStatsigGlobal = void 0;
6
6
  const Log_1 = require("./Log");
7
7
  const _getStatsigGlobal = () => {
8
- return __STATSIG__ ? __STATSIG__ : statsigGlobal;
8
+ // Avoid ReferenceError, which is happening with Cloudflare pages
9
+ try {
10
+ return typeof __STATSIG__ !== 'undefined' ? __STATSIG__ : statsigGlobal;
11
+ }
12
+ catch (e) {
13
+ return statsigGlobal;
14
+ }
9
15
  };
10
16
  exports._getStatsigGlobal = _getStatsigGlobal;
11
17
  const _getStatsigGlobalFlag = (flag) => {
package/src/SessionID.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StatsigSession = exports.SessionID = void 0;
4
+ const __StatsigGlobal_1 = require("./$_StatsigGlobal");
4
5
  const CacheKey_1 = require("./CacheKey");
5
6
  const Log_1 = require("./Log");
6
7
  const StorageProvider_1 = require("./StorageProvider");
@@ -74,7 +75,8 @@ function _bumpSession(session) {
74
75
  }
75
76
  function _createSessionTimeout(sdkKey, duration) {
76
77
  return setTimeout(() => {
77
- const client = __STATSIG__ === null || __STATSIG__ === void 0 ? void 0 : __STATSIG__.instance(sdkKey);
78
+ var _a;
79
+ const client = (_a = (0, __StatsigGlobal_1._getStatsigGlobal)()) === null || _a === void 0 ? void 0 : _a.instance(sdkKey);
78
80
  if (client) {
79
81
  client.$emt({ name: 'session_expired' });
80
82
  }
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "3.15.1";
1
+ export declare const SDK_VERSION = "3.15.2";
2
2
  export type StatsigMetadata = {
3
3
  readonly [key: string]: string | undefined;
4
4
  readonly appVersion?: string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StatsigMetadataProvider = exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '3.15.1';
4
+ exports.SDK_VERSION = '3.15.2';
5
5
  let metadata = {
6
6
  sdkVersion: exports.SDK_VERSION,
7
7
  sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Storage = exports.Log = exports.EventLogger = exports.Diagnostics = void 0;
18
18
  /** Statsig Global should go first */
19
19
  require("./$_StatsigGlobal");
20
+ const __StatsigGlobal_1 = require("./$_StatsigGlobal");
20
21
  const Diagnostics_1 = require("./Diagnostics");
21
22
  Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return Diagnostics_1.Diagnostics; } });
22
23
  const EventLogger_1 = require("./EventLogger");
@@ -65,5 +66,4 @@ __exportStar(require("./UUID"), exports);
65
66
  __exportStar(require("./VisibilityObserving"), exports);
66
67
  __exportStar(require("./StatsigUpdateDetails"), exports);
67
68
  __exportStar(require("./SDKFlags"), exports);
68
- __STATSIG__ = Object.assign(Object.assign({}, (__STATSIG__ !== null && __STATSIG__ !== void 0 ? __STATSIG__ : {})), { Log: Log_1.Log,
69
- SDK_VERSION: StatsigMetadata_1.SDK_VERSION });
69
+ Object.assign((0, __StatsigGlobal_1._getStatsigGlobal)(), { Log: Log_1.Log, SDK_VERSION: StatsigMetadata_1.SDK_VERSION });