@statsig/expo-bindings 0.0.1-beta.8 → 1.0.0

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 CHANGED
@@ -1,8 +1,5 @@
1
1
  # Statsig - Expo
2
2
 
3
- > [!IMPORTANT]
4
- > This version of the SDK is still in beta. The non-beta version can be found [here](https://github.com/statsig-io/react-native-expo).
5
-
6
3
  Expo specific additions for use with a Statsig Javascript SDK.
7
4
 
8
5
  Learn more by visiting: https://docs.statsig.com/client/javascript-sdk
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@statsig/expo-bindings",
3
- "version": "0.0.1-beta.8",
3
+ "version": "1.0.0",
4
4
  "dependencies": {
5
- "@statsig/client-core": "0.0.1-beta.8",
6
- "@statsig/react-bindings": "0.0.1-beta.8"
5
+ "@statsig/client-core": "1.0.0",
6
+ "@statsig/react-bindings": "1.0.0",
7
+ "@statsig/react-native-core": "1.0.0"
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
- var expo_application_1 = require("expo-application");
5
- var expo_device_1 = require("expo-device");
6
- var react_native_1 = require("react-native");
7
- var client_core_1 = require("@statsig/client-core");
8
- var locale = undefined;
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
- var i18nManager = react_native_1.NativeModules['I18nManager'];
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
- var settingsManager = react_native_1.NativeModules['SettingsManager'];
15
- var settings = settingsManager === null || settingsManager === void 0 ? void 0 : settingsManager.settings;
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
- client_core_1.StatsigMetadataProvider.add({
19
- appVersion: expo_application_1.nativeApplicationVersion !== null && expo_application_1.nativeApplicationVersion !== void 0 ? expo_application_1.nativeApplicationVersion : undefined,
20
- systemVersion: expo_device_1.osVersion !== null && expo_device_1.osVersion !== void 0 ? expo_device_1.osVersion : undefined,
21
- systemName: expo_device_1.osName !== null && expo_device_1.osName !== void 0 ? expo_device_1.osName : undefined,
22
- deviceModelName: expo_device_1.modelName !== null && expo_device_1.modelName !== void 0 ? expo_device_1.modelName : undefined,
23
- deviceModel: expo_device_1.modelId != null ? String(expo_device_1.modelId) : undefined,
24
- locale: locale,
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,4 @@
1
+ import type { StatsigProviderWithCacheWarmingProps } from '@statsig/react-native-core';
2
+ type Props = StatsigProviderWithCacheWarmingProps;
3
+ export declare function StatsigProviderExpo(props: Props): JSX.Element | null;
4
+ export {};
@@ -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-async-storage/async-storage';
2
- import './StatsigMetadataAdditions';
3
- export { StatsigContext, StatsigProvider, useGate, useDynamicConfig, useExperiment, useLayer, } from '@statsig/react-bindings';
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.useLayer = exports.useExperiment = exports.useDynamicConfig = exports.useGate = exports.StatsigProvider = exports.StatsigContext = void 0;
4
- require("@react-native-async-storage/async-storage");
5
- require("./StatsigMetadataAdditions");
6
- var react_bindings_1 = require("@statsig/react-bindings");
7
- Object.defineProperty(exports, "StatsigContext", { enumerable: true, get: function () { return react_bindings_1.StatsigContext; } });
8
- Object.defineProperty(exports, "StatsigProvider", { enumerable: true, get: function () { return react_bindings_1.StatsigProvider; } });
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);