@configdirector/react-native-sdk 1.9.0 → 1.9.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
CHANGED
|
@@ -11,10 +11,13 @@ npm install --save @configdirector/react-native-sdk
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Install `@react-native-async-storage/async-storage` as well, so the SDK recognizes the app install
|
|
14
|
-
across app starts
|
|
15
|
-
the SDK stores for the install, so the context
|
|
16
|
-
active user, however often the app is opened.
|
|
17
|
-
|
|
14
|
+
across app starts and keeps the last values it received on the device. For a context without an
|
|
15
|
+
`id`, ConfigDirector derives an identifier from an ID the SDK stores for the install, so the context
|
|
16
|
+
keeps that identifier, and counts as one monthly active user, however often the app is opened. The
|
|
17
|
+
last values are served on the next app start of the same context until live values arrive, so an
|
|
18
|
+
app opened without a network shows them instead of the in-code default values. It is an optional
|
|
19
|
+
peer dependency and works in Expo Go. Without it, every app start looks like a new install, nothing
|
|
20
|
+
is kept on the device, and the SDK logs a warning.
|
|
18
21
|
|
|
19
22
|
```bash
|
|
20
23
|
npm install --save @react-native-async-storage/async-storage
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createDefaultLogger, d as ConfigDirectorConnectionError, f as ConfigDirectorValidationError, l as nativeValueConfigState, m as _defineProperty, p as Emitter, r as DefaultConfigDirectorClient, s as discardingTelemetryClient, t as INSTALLED_TEST_CLIENT_SLOT } from "./installedTestClient-
|
|
1
|
+
import { c as createDefaultLogger, d as ConfigDirectorConnectionError, f as ConfigDirectorValidationError, l as nativeValueConfigState, m as _defineProperty, p as Emitter, r as DefaultConfigDirectorClient, s as discardingTelemetryClient, t as INSTALLED_TEST_CLIENT_SLOT } from "./installedTestClient-CNYgzQuj.mjs";
|
|
2
2
|
//#region ../js-client-core/src/testing/InMemoryConnection.ts
|
|
3
3
|
const TEST_ENVIRONMENT = {
|
|
4
4
|
environmentId: "test-environment",
|
|
@@ -295,7 +295,7 @@ const installTestClient = (testClient) => {
|
|
|
295
295
|
const createTestClient = (options) => {
|
|
296
296
|
return createTestClient$1({
|
|
297
297
|
sdkName: "react-native-sdk",
|
|
298
|
-
sdkVersion: "1.9.
|
|
298
|
+
sdkVersion: "1.9.1"
|
|
299
299
|
}, options);
|
|
300
300
|
};
|
|
301
301
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DEFAULT_CACHING_SIZE_LIMIT_BYTES, c as createDefaultLogger, i as CACHED_VALUES_STORAGE_KEY_PREFIX, m as _defineProperty, n as readInstalledTestClient, o as fetchWithTimeout, r as DefaultConfigDirectorClient, u as isFetchErrorFatal } from "./installedTestClient-
|
|
1
|
+
import { a as DEFAULT_CACHING_SIZE_LIMIT_BYTES, c as createDefaultLogger, i as CACHED_VALUES_STORAGE_KEY_PREFIX, m as _defineProperty, n as readInstalledTestClient, o as fetchWithTimeout, r as DefaultConfigDirectorClient, u as isFetchErrorFatal } from "./installedTestClient-CNYgzQuj.mjs";
|
|
2
2
|
import React, { Component, useContext as useContext$1 } from "react";
|
|
3
3
|
import { AppState, NativeModules } from "react-native";
|
|
4
4
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
@@ -65,20 +65,24 @@ var ClientEventReporter = class {
|
|
|
65
65
|
_defineProperty(this, "metaContext", void 0);
|
|
66
66
|
_defineProperty(this, "logger", void 0);
|
|
67
67
|
_defineProperty(this, "url", void 0);
|
|
68
|
+
_defineProperty(this, "clientSession", void 0);
|
|
68
69
|
_defineProperty(this, "executeRequests", true);
|
|
69
70
|
this.sdkKey = options.sdkKey;
|
|
70
71
|
this.logger = options.logger;
|
|
71
72
|
this.sdkIdentity = options.sdkIdentity;
|
|
72
73
|
this.metaContext = options.metaContext;
|
|
73
74
|
this.url = options.urlFactory("client/telemetry/v1", options.baseUrl);
|
|
75
|
+
this.clientSession = options.clientSession;
|
|
74
76
|
}
|
|
75
77
|
async report({ context, discreteEvents, aggregatedEvents, droppedEvents }) {
|
|
76
78
|
if (!this.executeRequests) return {
|
|
77
79
|
success: false,
|
|
78
80
|
fatalError: true
|
|
79
81
|
};
|
|
82
|
+
const { instanceId } = await this.clientSession;
|
|
80
83
|
const eventReport = {
|
|
81
84
|
clientSdkKey: this.sdkKey,
|
|
85
|
+
instanceId,
|
|
82
86
|
metaContext: {
|
|
83
87
|
sdkName: this.sdkIdentity.sdkName,
|
|
84
88
|
sdkVersion: this.sdkIdentity.sdkVersion,
|
|
@@ -771,7 +775,7 @@ const createReactNativeClient = (clientSdkKey, clientOptions) => {
|
|
|
771
775
|
var _clientOptions$logger;
|
|
772
776
|
const sdkIdentity = {
|
|
773
777
|
sdkName: "react-native-sdk",
|
|
774
|
-
sdkVersion: "1.9.
|
|
778
|
+
sdkVersion: "1.9.1"
|
|
775
779
|
};
|
|
776
780
|
const logger = (_clientOptions$logger = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.logger) !== null && _clientOptions$logger !== void 0 ? _clientOptions$logger : createConsoleLogger("warn");
|
|
777
781
|
const metadata = resolveMetadata(clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.metadata, logger);
|
|
@@ -782,7 +786,8 @@ const createReactNativeClient = (clientSdkKey, clientOptions) => {
|
|
|
782
786
|
metaContext: metadata,
|
|
783
787
|
baseUrl: liveTelemetry.baseUrl,
|
|
784
788
|
logger,
|
|
785
|
-
urlFactory
|
|
789
|
+
urlFactory,
|
|
790
|
+
clientSession: liveTelemetry.clientSession
|
|
786
791
|
}), clientSdkKey, sdkIdentity, {
|
|
787
792
|
...clientOptions,
|
|
788
793
|
logger,
|
|
@@ -1655,7 +1655,8 @@ var DefaultConfigDirectorClient = class DefaultConfigDirectorClient {
|
|
|
1655
1655
|
clientSdkKey: plan.clientSdkKey,
|
|
1656
1656
|
baseUrl: plan.baseUrl,
|
|
1657
1657
|
logger: this.logger,
|
|
1658
|
-
metadata: clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.metadata
|
|
1658
|
+
metadata: clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.metadata,
|
|
1659
|
+
clientSession: this.clientSession
|
|
1659
1660
|
});
|
|
1660
1661
|
}
|
|
1661
1662
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configdirector/react-native-sdk",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "React Native client SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ConfigDirector",
|