@statsig/expo-bindings 0.0.1-beta.9 → 1.0.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 +42 -5
- package/package.json +5 -4
- package/src/StatsigMetadataAdditions.d.ts +1 -1
- package/src/StatsigMetadataAdditions.js +19 -16
- package/src/StatsigProviderExpo.d.ts +4 -0
- package/src/StatsigProviderExpo.js +15 -0
- package/src/index.d.ts +4 -3
- package/src/index.js +20 -10
package/README.md
CHANGED
|
@@ -1,8 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://github.com/statsig-io/js-client-monorepo/assets/95646168/ae5499ed-20ff-4584-bf21-8857f800d485" />
|
|
3
|
+
<div />
|
|
4
|
+
<a href="https://statsig.com/?ref=gh_jsm">Statsig</a>
|
|
5
|
+
</h1>
|
|
2
6
|
|
|
3
|
-
>
|
|
4
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/statsig-io/js-client-monorepo/blob/main/LICENSE">
|
|
9
|
+
<img src="https://img.shields.io/badge/license-ISC-blue.svg?colorA=1b2528&colorB=ccfbc7&style=for-the-badge">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@statsig/js-client">
|
|
12
|
+
<img src="https://img.shields.io/npm/v/@statsig/js-client.svg?colorA=1b2528&colorB=b2d3ff&style=for-the-badge">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://statsig.com/community?ref=gh_jsm">
|
|
15
|
+
<img src="https://img.shields.io/badge/slack-statsig-brightgreen.svg?logo=slack&colorA=1b2528&colorB=FFF8BA&style=for-the-badge">
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
5
18
|
|
|
6
|
-
|
|
19
|
+
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).
|
|
7
20
|
|
|
8
|
-
|
|
21
|
+
## Getting Started
|
|
22
|
+
|
|
23
|
+
Read through the [Documentation](https://docs.statsig.com/client/javascript-sdk?ref=gh_jsm) or check out the [Samples](samples/).
|
|
24
|
+
|
|
25
|
+
## Packages
|
|
26
|
+
|
|
27
|
+
Clients
|
|
28
|
+
|
|
29
|
+
- [Precomputed Evaluations (Recommended)](packages/js-client/README.md)
|
|
30
|
+
- [On Device Evaluations](packages/js-on-device-eval-client/README.md)
|
|
31
|
+
|
|
32
|
+
Product Bundles
|
|
33
|
+
|
|
34
|
+
- [Session Replay](packages/session-replay/README.md)
|
|
35
|
+
- [Web Analytics](packages/web-analytics/README.md)
|
|
36
|
+
|
|
37
|
+
Framework Specific Bindings
|
|
38
|
+
|
|
39
|
+
- [React](packages/react-bindings/README.md)
|
|
40
|
+
- [React Native](packages/react-native-bindings/README.md)
|
|
41
|
+
- [React Native (Expo)](packages/expo-bindings/README.md)
|
|
42
|
+
|
|
43
|
+
## Community
|
|
44
|
+
|
|
45
|
+
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
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/expo-bindings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@statsig/client-core": "
|
|
6
|
-
"@statsig/react-bindings": "
|
|
5
|
+
"@statsig/client-core": "1.0.1",
|
|
6
|
+
"@statsig/react-bindings": "1.0.1",
|
|
7
|
+
"@statsig/react-native-core": "1.0.1"
|
|
7
8
|
},
|
|
8
9
|
"peerDependencies": {
|
|
10
|
+
"react": "^16.6.3 || ^17.0.0 || ^18.0.0",
|
|
9
11
|
"react-native": "0.*",
|
|
10
|
-
"@react-native-async-storage/async-storage": "1.*",
|
|
11
12
|
"expo-application": "5.*",
|
|
12
13
|
"expo-device": "5.*"
|
|
13
14
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function GetStatsigMetadataAdditions(): Record<string, string | undefined>;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b, _c, _d;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
exports.GetStatsigMetadataAdditions = void 0;
|
|
5
|
+
const expo_application_1 = require("expo-application");
|
|
6
|
+
const expo_device_1 = require("expo-device");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
let locale = undefined;
|
|
9
9
|
if (react_native_1.Platform.OS === 'android') {
|
|
10
|
-
|
|
10
|
+
const i18nManager = react_native_1.NativeModules['I18nManager'];
|
|
11
11
|
locale = (_a = i18nManager === null || i18nManager === void 0 ? void 0 : i18nManager.localIdentifer) !== null && _a !== void 0 ? _a : undefined;
|
|
12
12
|
}
|
|
13
13
|
if (react_native_1.Platform.OS === 'ios') {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const settingsManager = react_native_1.NativeModules['SettingsManager'];
|
|
15
|
+
const settings = settingsManager === null || settingsManager === void 0 ? void 0 : settingsManager.settings;
|
|
16
16
|
locale = (_d = (_b = settings === null || settings === void 0 ? void 0 : settings.AppLocale) !== null && _b !== void 0 ? _b : (_c = settings === null || settings === void 0 ? void 0 : settings.AppleLanguages) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : undefined;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
function GetStatsigMetadataAdditions() {
|
|
19
|
+
return {
|
|
20
|
+
appVersion: expo_application_1.nativeApplicationVersion !== null && expo_application_1.nativeApplicationVersion !== void 0 ? expo_application_1.nativeApplicationVersion : undefined,
|
|
21
|
+
systemVersion: expo_device_1.osVersion !== null && expo_device_1.osVersion !== void 0 ? expo_device_1.osVersion : undefined,
|
|
22
|
+
systemName: expo_device_1.osName !== null && expo_device_1.osName !== void 0 ? expo_device_1.osName : undefined,
|
|
23
|
+
deviceModelName: expo_device_1.modelName !== null && expo_device_1.modelName !== void 0 ? expo_device_1.modelName : undefined,
|
|
24
|
+
deviceModel: expo_device_1.modelId != null ? String(expo_device_1.modelId) : undefined,
|
|
25
|
+
locale,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.GetStatsigMetadataAdditions = GetStatsigMetadataAdditions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatsigProviderExpo = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const client_core_1 = require("@statsig/client-core");
|
|
6
|
+
const react_native_core_1 = require("@statsig/react-native-core");
|
|
7
|
+
const StatsigMetadataAdditions_1 = require("./StatsigMetadataAdditions");
|
|
8
|
+
function StatsigProviderExpo(props) {
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
client_core_1.SDKType._setBindingType('expo');
|
|
11
|
+
client_core_1.StatsigMetadataProvider.add((0, StatsigMetadataAdditions_1.GetStatsigMetadataAdditions)());
|
|
12
|
+
}, []);
|
|
13
|
+
return (0, react_native_core_1.StatsigProviderWithCacheWarming)(props);
|
|
14
|
+
}
|
|
15
|
+
exports.StatsigProviderExpo = StatsigProviderExpo;
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import '@react-native-
|
|
2
|
-
import './
|
|
3
|
-
export
|
|
1
|
+
import { warmCachingFromAsyncStorage } from '@statsig/react-native-core';
|
|
2
|
+
import { StatsigProviderExpo } from './StatsigProviderExpo';
|
|
3
|
+
export * from '@statsig/react-bindings';
|
|
4
|
+
export { StatsigProviderExpo, warmCachingFromAsyncStorage };
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
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
|
-
exports.
|
|
4
|
-
require("@react-native-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "useGate", { enumerable: true, get: function () { return react_bindings_1.useGate; } });
|
|
10
|
-
Object.defineProperty(exports, "useDynamicConfig", { enumerable: true, get: function () { return react_bindings_1.useDynamicConfig; } });
|
|
11
|
-
Object.defineProperty(exports, "useExperiment", { enumerable: true, get: function () { return react_bindings_1.useExperiment; } });
|
|
12
|
-
Object.defineProperty(exports, "useLayer", { enumerable: true, get: function () { return react_bindings_1.useLayer; } });
|
|
17
|
+
exports.warmCachingFromAsyncStorage = exports.StatsigProviderExpo = void 0;
|
|
18
|
+
const react_native_core_1 = require("@statsig/react-native-core");
|
|
19
|
+
Object.defineProperty(exports, "warmCachingFromAsyncStorage", { enumerable: true, get: function () { return react_native_core_1.warmCachingFromAsyncStorage; } });
|
|
20
|
+
const StatsigProviderExpo_1 = require("./StatsigProviderExpo");
|
|
21
|
+
Object.defineProperty(exports, "StatsigProviderExpo", { enumerable: true, get: function () { return StatsigProviderExpo_1.StatsigProviderExpo; } });
|
|
22
|
+
__exportStar(require("@statsig/react-bindings"), exports);
|