@statsig/react-bindings 0.0.1-beta.4 → 0.0.1-beta.6

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,8 +1,8 @@
1
1
  {
2
2
  "name": "@statsig/react-bindings",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.6",
4
4
  "dependencies": {
5
- "@statsig/client-core": "0.0.1-beta.4"
5
+ "@statsig/client-core": "0.0.1-beta.6"
6
6
  },
7
7
  "peerDependencies": {
8
8
  "react": "^16.6.3 || ^17.0.0 || ^18.0.0"
@@ -5,6 +5,7 @@ var client_core_1 = require("@statsig/client-core");
5
5
  var noop = function () {
6
6
  // noop
7
7
  };
8
+ var NOOP_DETAILS = { reason: 'Error' };
8
9
  var defaultEvaluation = function (type) {
9
10
  return function () {
10
11
  var args = [];
@@ -14,20 +15,20 @@ var defaultEvaluation = function (type) {
14
15
  var name = typeof args[0] === 'string' ? args[0] : args[1];
15
16
  switch (type) {
16
17
  case 'gate':
17
- return (0, client_core_1.makeFeatureGate)(name, 'Error');
18
+ return (0, client_core_1.makeFeatureGate)(name, NOOP_DETAILS);
18
19
  case 'config':
19
- return (0, client_core_1.makeDynamicConfig)(name, 'Error');
20
+ return (0, client_core_1.makeDynamicConfig)(name, NOOP_DETAILS);
20
21
  case 'layer':
21
- return (0, client_core_1.makeLayer)(name, 'Error');
22
+ return (0, client_core_1.makeLayer)(name, NOOP_DETAILS);
22
23
  }
23
24
  };
24
25
  };
25
26
  var client = {
26
27
  isNoop: true,
27
28
  loadingStatus: 'Uninitialized',
28
- initialize: function () { return Promise.resolve(); },
29
+ initialize: noop,
29
30
  shutdown: function () { return Promise.resolve(); },
30
- updateUser: function () { return Promise.resolve(); },
31
+ updateUser: noop,
31
32
  getCurrentUser: function () { return ({ userID: '' }); },
32
33
  checkGate: function () { return false; },
33
34
  getFeatureGate: defaultEvaluation('gate'),
@@ -14,9 +14,7 @@ function StatsigProvider(props) {
14
14
  }
15
15
  };
16
16
  client.on('status_change', onStatusChange);
17
- client.initialize().catch(function (error) {
18
- client_core_1.Log.error('An error occurred during initialization', error);
19
- });
17
+ client.initialize();
20
18
  return function () {
21
19
  client.shutdown().catch(function (error) {
22
20
  client_core_1.Log.error('An error occured during shutdown', error);
@@ -1,6 +1,6 @@
1
1
  import { StatsigUser } from '@statsig/client-core';
2
2
  export type UseStatsigUserResult = {
3
3
  user: StatsigUser;
4
- updateUser: (fn: (prevState: StatsigUser) => StatsigUser) => Promise<void>;
4
+ updateUser: (fn: (prevState: StatsigUser) => StatsigUser) => void;
5
5
  };
6
6
  export default function (): UseStatsigUserResult;
@@ -7,7 +7,7 @@ function default_1() {
7
7
  user: client.getCurrentUser(),
8
8
  updateUser: function (fn) {
9
9
  var user = fn(client.getCurrentUser());
10
- return client.updateUser(user);
10
+ client.updateUser(user);
11
11
  },
12
12
  };
13
13
  }