@statsig/client-core 3.15.2 → 3.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/client-core",
3
- "version": "3.15.2",
3
+ "version": "3.15.4",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -23,7 +23,7 @@ export type CommonContext = {
23
23
  options: AnyStatsigOptions;
24
24
  errorBoundary: ErrorBoundary;
25
25
  session: StatsigSession;
26
- stableID: string;
26
+ stableID: string | null;
27
27
  };
28
28
  export type OnDeviceEvaluationsContext = CommonContext & {
29
29
  values: DownloadConfigSpecsResponse | null;
package/src/StableID.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export declare const StableID: {
2
2
  cookiesEnabled: boolean;
3
3
  randomID: string;
4
- get: (sdkKey: string) => string;
4
+ get: (sdkKey: string) => string | null;
5
5
  setOverride: (override: string, sdkKey: string) => void;
6
6
  _setCookiesEnabled: (sdkKey: string, cookiesEnabled: boolean) => void;
7
+ _setDisabled: (sdkKey: string, disabled: boolean) => void;
7
8
  };
package/src/StableID.js CHANGED
@@ -8,10 +8,14 @@ const StorageProvider_1 = require("./StorageProvider");
8
8
  const UUID_1 = require("./UUID");
9
9
  const PROMISE_MAP = {};
10
10
  const COOKIE_ENABLED_MAP = {};
11
+ const DISABLED_MAP = {};
11
12
  exports.StableID = {
12
13
  cookiesEnabled: false,
13
14
  randomID: Math.random().toString(36),
14
15
  get: (sdkKey) => {
16
+ if (DISABLED_MAP[sdkKey]) {
17
+ return null;
18
+ }
15
19
  if (PROMISE_MAP[sdkKey] != null) {
16
20
  return PROMISE_MAP[sdkKey];
17
21
  }
@@ -39,6 +43,9 @@ exports.StableID = {
39
43
  _setCookiesEnabled: (sdkKey, cookiesEnabled) => {
40
44
  COOKIE_ENABLED_MAP[sdkKey] = cookiesEnabled;
41
45
  },
46
+ _setDisabled: (sdkKey, disabled) => {
47
+ DISABLED_MAP[sdkKey] = disabled;
48
+ },
42
49
  };
43
50
  function _getStableIDStorageKey(sdkKey) {
44
51
  return `statsig.stable_id.${(0, CacheKey_1._getStorageKey)(sdkKey)}`;
@@ -34,7 +34,8 @@ class StatsigClientBase {
34
34
  SessionID_1.StatsigSession.overrideInitialSessionID(options.initialSessionID, sdkKey);
35
35
  (options === null || options === void 0 ? void 0 : options.storageProvider) && StorageProvider_1.Storage._setProvider(options.storageProvider);
36
36
  (options === null || options === void 0 ? void 0 : options.enableCookies) &&
37
- this.updateRuntimeOptions({ enableCookies: options.enableCookies });
37
+ StableID_1.StableID._setCookiesEnabled(sdkKey, options.enableCookies);
38
+ (options === null || options === void 0 ? void 0 : options.disableStableID) && StableID_1.StableID._setDisabled(sdkKey, true);
38
39
  this._sdkKey = sdkKey;
39
40
  this._options = options !== null && options !== void 0 ? options : {};
40
41
  this._memoCache = {};
@@ -1,12 +1,12 @@
1
- export declare const SDK_VERSION = "3.15.2";
1
+ export declare const SDK_VERSION = "3.15.4";
2
2
  export type StatsigMetadata = {
3
- readonly [key: string]: string | undefined;
3
+ readonly [key: string]: string | undefined | null;
4
4
  readonly appVersion?: string;
5
5
  readonly deviceModel?: string;
6
6
  readonly deviceModelName?: string;
7
7
  readonly locale?: string;
8
8
  readonly sdkVersion: string;
9
- readonly stableID?: string;
9
+ readonly stableID?: string | null;
10
10
  readonly systemName?: string;
11
11
  readonly systemVersion?: string;
12
12
  };
@@ -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.2';
4
+ exports.SDK_VERSION = '3.15.4';
5
5
  let metadata = {
6
6
  sdkVersion: exports.SDK_VERSION,
7
7
  sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
@@ -73,6 +73,12 @@ export type StatsigOptionsCommon<NetworkConfig extends NetworkConfigCommon> = St
73
73
  * default: `false`
74
74
  */
75
75
  disableCompression?: boolean;
76
+ /**
77
+ * When true, the SDK will not generate a stableID for the user. Useful when bootstrapping from a server without a StableID.
78
+ *
79
+ * default: `false`
80
+ */
81
+ disableStableID?: boolean;
76
82
  /**
77
83
  * Whether or not Statsig should use raw JSON for network requests where possible.
78
84
  *