@statsig/react-native-bindings-on-device-eval 3.0.0-beta.1

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/README.md ADDED
@@ -0,0 +1,49 @@
1
+ Statsig helps you move faster with feature gates (feature flags), and/or dynamic configs. It also allows you to run A/B/n tests to validate your new features and understand their impact on your KPIs. If you're new to Statsig, check out our product and create an account at [statsig.com](https://www.statsig.com/?ref=gh_jsm).
2
+
3
+ <h1 align="center">
4
+ <a href="https://statsig.com/?ref=gh_jsm">
5
+ <img src="https://github.com/statsig-io/js-client-monorepo/assets/95646168/ae5499ed-20ff-4584-bf21-8857f800d485" />
6
+ </a>
7
+ <div />
8
+ <a href="https://statsig.com/?ref=gh_jsm">Statsig</a>
9
+ </h1>
10
+
11
+ <p align="center">
12
+ <a href="https://github.com/statsig-io/js-client-monorepo/blob/main/LICENSE">
13
+ <img src="https://img.shields.io/badge/license-ISC-blue.svg?colorA=1b2528&colorB=ccfbc7&style=for-the-badge">
14
+ </a>
15
+ <a href="https://www.npmjs.com/package/@statsig/js-client">
16
+ <img src="https://img.shields.io/npm/v/@statsig/js-client.svg?colorA=1b2528&colorB=b2d3ff&style=for-the-badge">
17
+ </a>
18
+ <a href="https://statsig.com/community?ref=gh_jsm">
19
+ <img src="https://img.shields.io/badge/slack-statsig-brightgreen.svg?logo=slack&colorA=1b2528&colorB=FFF8BA&style=for-the-badge">
20
+ </a>
21
+ </p>
22
+
23
+ ## Getting Started
24
+
25
+ Read through the [Documentation](https://docs.statsig.com/client/javascript-sdk?ref=gh_jsm) or check out the [Samples](samples/).
26
+
27
+ ## Packages
28
+
29
+ Clients
30
+
31
+ - Precomputed Evaluations (Recommended) [[npm](https://www.npmjs.com/package/@statsig/js-client)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/js-client)]
32
+ - On Device Evaluations [[npm](https://www.npmjs.com/package/@statsig/js-on-device-eval-client)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/js-on-device-eval-client)]
33
+
34
+ Product Bundles
35
+
36
+ - Session Replay [[npm](https://www.npmjs.com/package/@statsig/session-replay)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/session-replay)]
37
+ - Web Analytics [[npm](https://www.npmjs.com/package/@statsig/web-analytics)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/web-analytics)]
38
+
39
+ Framework Specific Bindings
40
+
41
+ - React [[npm](https://www.npmjs.com/package/@statsig/react-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/react-bindings)]
42
+
43
+ - React Native [[npm](https://www.npmjs.com/package/@statsig/react-native-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/react-native-bindings)]
44
+
45
+ - React Native (Expo) [[npm](https://www.npmjs.com/package/@statsig/expo-bindings)] [[source](https://github.com/statsig-io/js-client-monorepo/tree/main/packages/expo-bindings)]
46
+
47
+ ## Community
48
+
49
+ If you need any assitance or just have a question, feel free to reach out to us on [Slack](https://statsig.com/community?ref=gh_jsm).
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@statsig/react-native-bindings-on-device-eval",
3
+ "version": "3.0.0-beta.1",
4
+ "dependencies": {
5
+ "@statsig/client-core": "3.0.0-beta.1",
6
+ "@statsig/js-on-device-eval-client": "3.0.0-beta.1",
7
+ "@statsig/react-bindings-on-device-eval": "3.0.0-beta.1",
8
+ "@statsig/react-native-core": "3.0.0-beta.1"
9
+ },
10
+ "peerDependencies": {
11
+ "react": "^16.6.3 || ^17.0.0 || ^18.0.0"
12
+ },
13
+ "type": "commonjs",
14
+ "main": "./src/index.js",
15
+ "typings": "./src/index.d.ts"
16
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatsigOnDeviceEvalClientRN = void 0;
4
+ const js_on_device_eval_client_1 = require("@statsig/js-on-device-eval-client");
5
+ const react_native_core_1 = require("@statsig/react-native-core");
6
+ class StatsigOnDeviceEvalClientRN extends js_on_device_eval_client_1.StatsigOnDeviceEvalClient {
7
+ constructor(sdkKey, options = null) {
8
+ const opts = options !== null && options !== void 0 ? options : {};
9
+ (0, react_native_core_1._setupStatsigForReactNative)('rn', null, opts);
10
+ super(sdkKey, opts);
11
+ this.__isRnClient = true;
12
+ }
13
+ }
14
+ exports.StatsigOnDeviceEvalClientRN = StatsigOnDeviceEvalClientRN;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatsigProviderOnDeviceEvalRN = void 0;
4
+ const react_1 = require("react");
5
+ const client_core_1 = require("@statsig/client-core");
6
+ const react_bindings_on_device_eval_1 = require("@statsig/react-bindings-on-device-eval");
7
+ const StatsigOnDeviceEvalClientRN_1 = require("./StatsigOnDeviceEvalClientRN");
8
+ function useClientFactory(sdkKey, statsigOptions = null) {
9
+ const [client] = (0, react_1.useState)(() => {
10
+ const client = new StatsigOnDeviceEvalClientRN_1.StatsigOnDeviceEvalClientRN(sdkKey, statsigOptions);
11
+ client.initializeAsync().catch(client_core_1.Log.error);
12
+ return client;
13
+ });
14
+ return client;
15
+ }
16
+ function StatsigProviderOnDeviceEvalRN(props) {
17
+ const { children, loadingComponent } = props;
18
+ const client = 'client' in props
19
+ ? props.client
20
+ : useClientFactory(props.sdkKey, props.options);
21
+ return (0, react_bindings_on_device_eval_1.StatsigProviderOnDeviceEval)({ children, loadingComponent, client });
22
+ }
23
+ exports.StatsigProviderOnDeviceEvalRN = StatsigProviderOnDeviceEvalRN;
package/src/index.js ADDED
@@ -0,0 +1,27 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.StatsigProviderOnDeviceEvalRN = exports.StatsigOnDeviceEvalClientRN = exports.StatsigOnDeviceEvalClient = exports.StatsigProviderOnDeviceEval = void 0;
18
+ __exportStar(require("@statsig/react-bindings-on-device-eval"), exports);
19
+ // RN environments should use the RN specific variants
20
+ const StatsigProviderOnDeviceEval = undefined;
21
+ exports.StatsigProviderOnDeviceEval = StatsigProviderOnDeviceEval;
22
+ const StatsigOnDeviceEvalClient = undefined;
23
+ exports.StatsigOnDeviceEvalClient = StatsigOnDeviceEvalClient;
24
+ var StatsigOnDeviceEvalClientRN_1 = require("./StatsigOnDeviceEvalClientRN");
25
+ Object.defineProperty(exports, "StatsigOnDeviceEvalClientRN", { enumerable: true, get: function () { return StatsigOnDeviceEvalClientRN_1.StatsigOnDeviceEvalClientRN; } });
26
+ var StatsigProviderOnDeviceEvalRN_1 = require("./StatsigProviderOnDeviceEvalRN");
27
+ Object.defineProperty(exports, "StatsigProviderOnDeviceEvalRN", { enumerable: true, get: function () { return StatsigProviderOnDeviceEvalRN_1.StatsigProviderOnDeviceEvalRN; } });