@statsig/react-bindings 2.2.0-beta.1 → 2.2.0-beta.5

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,9 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/react-bindings",
3
- "version": "2.2.0-beta.1",
3
+ "version": "2.2.0-beta.5",
4
4
  "dependencies": {
5
- "@statsig/client-core": "2.2.0-beta.1",
6
- "@statsig/js-client": "2.2.0-beta.1"
5
+ "@statsig/client-core": "2.2.0-beta.5",
6
+ "@statsig/js-client": "2.2.0-beta.5"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "react": "^16.6.3 || ^17.0.0 || ^18.0.0"
@@ -1,17 +1,17 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { StatsigUser } from '@statsig/client-core';
3
3
  import { StatsigClient, StatsigOptions } from '@statsig/js-client';
4
- type WithClient = {
5
- client: StatsigClient;
4
+ type WithClient<T extends StatsigClient> = {
5
+ client: T;
6
6
  };
7
7
  type WithConfiguration = {
8
8
  sdkKey: string;
9
9
  user: StatsigUser;
10
10
  options?: StatsigOptions;
11
11
  };
12
- export type StatsigProviderProps = {
12
+ export type StatsigProviderProps<T extends StatsigClient> = {
13
13
  children: ReactNode | ReactNode[];
14
14
  loadingComponent?: ReactNode | ReactNode[];
15
- } & (WithClient | WithConfiguration);
16
- export declare function StatsigProvider(props: StatsigProviderProps): JSX.Element;
15
+ } & (WithClient<T> | WithConfiguration);
16
+ export declare function StatsigProvider(props: StatsigProviderProps<StatsigClient>): JSX.Element;
17
17
  export {};
@@ -10,7 +10,7 @@ function StatsigProvider(props) {
10
10
  const [renderVersion, setRenderVersion] = (0, react_1.useState)(0);
11
11
  const client = 'client' in props
12
12
  ? props.client
13
- : (0, useClientAsyncInit_1.useClientAsyncInit)(props.sdkKey, props.user).client;
13
+ : (0, useClientAsyncInit_1.useClientAsyncInit)(props.sdkKey, props.user, props.options).client;
14
14
  (0, react_1.useEffect)(() => {
15
15
  const onValuesUpdated = () => {
16
16
  setRenderVersion((v) => v + 1);
package/src/index.d.ts CHANGED
@@ -11,4 +11,5 @@ import useParameterStore from './useParameterStore';
11
11
  import { useStatsigClient } from './useStatsigClient';
12
12
  import { useStatsigUser } from './useStatsigUser';
13
13
  export type { StatsigProviderProps };
14
+ export * from '@statsig/js-client';
14
15
  export { StatsigContext, StatsigProvider, useClientAsyncInit, useClientBootstrapInit, useDynamicConfig, useExperiment, useFeatureGate, useGateValue, useLayer, useParameterStore, useStatsigClient, useStatsigUser, };
package/src/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.useStatsigUser = exports.useStatsigClient = exports.useParameterStore = exports.useLayer = exports.useGateValue = exports.useFeatureGate = exports.useExperiment = exports.useDynamicConfig = exports.useClientBootstrapInit = exports.useClientAsyncInit = exports.StatsigProvider = exports.StatsigContext = void 0;
4
18
  const StatsigContext_1 = require("./StatsigContext");
@@ -25,6 +39,7 @@ const useStatsigClient_1 = require("./useStatsigClient");
25
39
  Object.defineProperty(exports, "useStatsigClient", { enumerable: true, get: function () { return useStatsigClient_1.useStatsigClient; } });
26
40
  const useStatsigUser_1 = require("./useStatsigUser");
27
41
  Object.defineProperty(exports, "useStatsigUser", { enumerable: true, get: function () { return useStatsigUser_1.useStatsigUser; } });
42
+ __exportStar(require("@statsig/js-client"), exports);
28
43
  __STATSIG__ = Object.assign(Object.assign({}, (__STATSIG__ !== null && __STATSIG__ !== void 0 ? __STATSIG__ : {})), { StatsigContext: StatsigContext_1.default,
29
44
  StatsigProvider: StatsigProvider_1.StatsigProvider,
30
45
  useClientAsyncInit: useClientAsyncInit_1.useClientAsyncInit,
@@ -1,6 +1,6 @@
1
- import { AnyStatsigOptions, StatsigUser } from '@statsig/client-core';
2
- import { StatsigClient } from '@statsig/js-client';
3
- export declare function useClientAsyncInit(sdkKey: string, initialUser: StatsigUser, statsigOptions?: AnyStatsigOptions | null): {
1
+ import { StatsigUser } from '@statsig/client-core';
2
+ import { StatsigClient, StatsigOptions } from '@statsig/js-client';
3
+ export declare function useClientAsyncInit(sdkKey: string, initialUser: StatsigUser, statsigOptions?: StatsigOptions | null): {
4
4
  isLoading: boolean;
5
5
  client: StatsigClient;
6
6
  };
@@ -1,5 +1,5 @@
1
- import { AnyStatsigOptions, StatsigUser } from '@statsig/client-core';
2
- import { StatsigClient } from '@statsig/js-client';
3
- export declare function useClientBootstrapInit(sdkKey: string, initialUser: StatsigUser, initialValues: string, statsigOptions?: AnyStatsigOptions | null): {
1
+ import { StatsigUser } from '@statsig/client-core';
2
+ import { StatsigClient, StatsigOptions } from '@statsig/js-client';
3
+ export declare function useClientBootstrapInit(sdkKey: string, initialUser: StatsigUser, initialValues: string, statsigOptions?: StatsigOptions | null): {
4
4
  client: StatsigClient;
5
5
  };