@statsig/react-bindings 2.1.1-beta.1 → 2.1.1-beta.3

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,15 +1,15 @@
1
1
  {
2
2
  "name": "@statsig/react-bindings",
3
- "version": "2.1.1-beta.1",
3
+ "version": "2.1.1-beta.3",
4
4
  "dependencies": {
5
- "@statsig/client-core": "2.1.1-beta.1"
5
+ "@statsig/client-core": "2.1.1-beta.3"
6
6
  },
7
7
  "peerDependencies": {
8
8
  "react": "^16.6.3 || ^17.0.0 || ^18.0.0"
9
9
  },
10
10
  "optionalDependencies": {
11
- "@statsig/js-client": "2.1.1-beta.1",
12
- "@statsig/js-on-device-eval-client": "2.1.1-beta.1"
11
+ "@statsig/js-client": "2.1.1-beta.3",
12
+ "@statsig/js-on-device-eval-client": "2.1.1-beta.3"
13
13
  },
14
14
  "type": "commonjs",
15
15
  "main": "./src/index.js",
@@ -3,18 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireOptionalOnDeviceClientDependency = exports.requireOptionalClientDependency = void 0;
4
4
  const client_core_1 = require("@statsig/client-core");
5
5
  const NoopEvaluationsClient_1 = require("./NoopEvaluationsClient");
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- function _unsafeRequire(modName) {
8
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
9
- return require(modName);
6
+ let jsClientMod = null;
7
+ try {
8
+ // import {StatsigClient} from '@statsig/js-client';
9
+ // jsClientMod = {StatsigClient};
10
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
11
+ jsClientMod = require('@statsig/js-client');
12
+ }
13
+ catch (error) {
14
+ // noop
15
+ }
16
+ let jsOnDeviceEvalClientMod = null;
17
+ try {
18
+ jsOnDeviceEvalClientMod =
19
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
20
+ require('@statsig/js-on-device-eval-client');
21
+ }
22
+ catch (error) {
23
+ // noop
10
24
  }
11
25
  function requireOptionalClientDependency(sdkKey, initialUser, statsigOptions) {
12
26
  let client;
13
- try {
14
- const { StatsigClient } = _unsafeRequire('@statsig/js-client');
27
+ if (jsClientMod) {
28
+ const { StatsigClient } = jsClientMod;
15
29
  client = new StatsigClient(sdkKey, initialUser, statsigOptions);
16
30
  }
17
- catch (error) {
31
+ else {
18
32
  client = NoopEvaluationsClient_1.NoopEvaluationsClient;
19
33
  client_core_1.Log.error('Failed to load StatsigClient. Do you have @statsig/js-client installed?');
20
34
  }
@@ -23,11 +37,11 @@ function requireOptionalClientDependency(sdkKey, initialUser, statsigOptions) {
23
37
  exports.requireOptionalClientDependency = requireOptionalClientDependency;
24
38
  function requireOptionalOnDeviceClientDependency(sdkKey, statsigOptions) {
25
39
  let client;
26
- try {
27
- const { StatsigOnDeviceEvalClient } = _unsafeRequire('@statsig/js-on-device-eval-client');
40
+ if (jsOnDeviceEvalClientMod) {
41
+ const { StatsigOnDeviceEvalClient } = jsOnDeviceEvalClientMod;
28
42
  client = new StatsigOnDeviceEvalClient(sdkKey, statsigOptions);
29
43
  }
30
- catch (error) {
44
+ else {
31
45
  client = NoopEvaluationsClient_1.NoopEvaluationsClient;
32
46
  client_core_1.Log.error('Failed to load StatsigOnDeviceEvalClient. Do you have @statsig/js-on-device-eval-client installed?');
33
47
  }