@launchdarkly/react-native-client-sdk 0.1.5 → 0.2.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/CHANGELOG.md +37 -0
- package/README.md +2 -2
- package/dist/package.json +8 -5
- package/dist/src/ReactNativeLDClient.d.ts +7 -3
- package/dist/src/ReactNativeLDClient.d.ts.map +1 -1
- package/dist/src/ReactNativeLDClient.js +10 -6
- package/dist/src/ReactNativeLDClient.js.map +1 -1
- package/dist/src/fromExternal/js-sha256/index.d.ts +17 -0
- package/dist/src/fromExternal/js-sha256/index.d.ts.map +1 -0
- package/dist/src/fromExternal/js-sha256/index.js +572 -0
- package/dist/src/fromExternal/js-sha256/index.js.map +1 -0
- package/dist/src/{react-native-sse → fromExternal/react-native-sse}/EventSource.d.ts +8 -5
- package/dist/src/fromExternal/react-native-sse/EventSource.d.ts.map +1 -0
- package/dist/src/{react-native-sse → fromExternal/react-native-sse}/EventSource.js +47 -32
- package/dist/src/fromExternal/react-native-sse/EventSource.js.map +1 -0
- package/dist/src/fromExternal/react-native-sse/index.d.ts.map +1 -0
- package/dist/src/fromExternal/react-native-sse/index.js.map +1 -0
- package/dist/src/{react-native-sse → fromExternal/react-native-sse}/types.d.ts +3 -3
- package/dist/src/fromExternal/react-native-sse/types.d.ts.map +1 -0
- package/dist/src/fromExternal/react-native-sse/types.js.map +1 -0
- package/dist/src/platform/autoEnv.d.ts +4 -0
- package/dist/src/platform/autoEnv.d.ts.map +1 -0
- package/dist/src/platform/autoEnv.js +36 -0
- package/dist/src/platform/autoEnv.js.map +1 -0
- package/dist/src/platform/crypto/PlatformHasher.d.ts +9 -0
- package/dist/src/platform/crypto/PlatformHasher.d.ts.map +1 -0
- package/dist/src/platform/crypto/PlatformHasher.js +28 -0
- package/dist/src/platform/crypto/PlatformHasher.js.map +1 -0
- package/dist/src/platform/crypto/index.d.ts +14 -0
- package/dist/src/platform/crypto/index.d.ts.map +1 -0
- package/dist/src/platform/crypto/index.js +34 -0
- package/dist/src/platform/crypto/index.js.map +1 -0
- package/dist/src/platform/crypto/types.d.ts +3 -0
- package/dist/src/platform/crypto/types.d.ts.map +1 -0
- package/dist/src/platform/crypto/types.js +2 -0
- package/dist/src/{react-native-sse → platform/crypto}/types.js.map +1 -1
- package/dist/src/platform/index.d.ts +9 -1
- package/dist/src/platform/index.d.ts.map +1 -1
- package/dist/src/platform/index.js +24 -19
- package/dist/src/platform/index.js.map +1 -1
- package/dist/src/platform/locale.d.ts +7 -0
- package/dist/src/platform/locale.d.ts.map +1 -0
- package/dist/src/platform/locale.js +10 -0
- package/dist/src/platform/locale.js.map +1 -0
- package/dist/src/polyfills/CustomEvent.d.ts +1 -1
- package/dist/src/polyfills/CustomEvent.d.ts.map +1 -1
- package/dist/src/polyfills/CustomEvent.js +1 -1
- package/dist/src/polyfills/CustomEvent.js.map +1 -1
- package/dist/src/polyfills/btoa.d.ts +2 -1
- package/dist/src/polyfills/btoa.d.ts.map +1 -1
- package/dist/src/polyfills/btoa.js +4 -1
- package/dist/src/polyfills/btoa.js.map +1 -1
- package/dist/src/polyfills/index.d.ts +3 -3
- package/dist/src/polyfills/index.d.ts.map +1 -1
- package/dist/src/polyfills/index.js +3 -3
- package/dist/src/polyfills/index.js.map +1 -1
- package/dist/src/provider/LDProvider.d.ts +2 -6
- package/dist/src/provider/LDProvider.d.ts.map +1 -1
- package/dist/src/provider/LDProvider.js +4 -9
- package/dist/src/provider/LDProvider.js.map +1 -1
- package/dist/src/provider/useAppState.d.ts +13 -0
- package/dist/src/provider/useAppState.d.ts.map +1 -0
- package/dist/src/provider/useAppState.js +50 -0
- package/dist/src/provider/useAppState.js.map +1 -0
- package/package.json +8 -5
- package/dist/jest.config.d.ts +0 -4
- package/dist/jest.config.d.ts.map +0 -1
- package/dist/jest.config.js +0 -15
- package/dist/jest.config.js.map +0 -1
- package/dist/src/react-native-sse/EventSource.d.ts.map +0 -1
- package/dist/src/react-native-sse/EventSource.js.map +0 -1
- package/dist/src/react-native-sse/index.d.ts.map +0 -1
- package/dist/src/react-native-sse/index.js.map +0 -1
- package/dist/src/react-native-sse/types.d.ts.map +0 -1
- /package/dist/src/{react-native-sse → fromExternal/react-native-sse}/index.d.ts +0 -0
- /package/dist/src/{react-native-sse → fromExternal/react-native-sse}/index.js +0 -0
- /package/dist/src/{react-native-sse → fromExternal/react-native-sse}/types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.1](https://github.com/launchdarkly/js-core/compare/react-native-client-sdk-v0.2.0...react-native-client-sdk-v0.2.1) (2024-02-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Babel TypeError due to event-target-shim ([#365](https://github.com/launchdarkly/js-core/issues/365)) ([c1c0086](https://github.com/launchdarkly/js-core/commit/c1c008610f36c8dd0c1e3da3cf9450c64d41874f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @launchdarkly/js-client-sdk-common bumped from 0.2.0 to 0.2.1
|
|
16
|
+
|
|
17
|
+
## [0.2.0](https://github.com/launchdarkly/js-core/compare/react-native-client-sdk-v0.1.5...react-native-client-sdk-v0.2.0) (2024-02-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* React-native support for auto-env attributes. Only affects react-native package. ([deea99c](https://github.com/launchdarkly/js-core/commit/deea99ca2fbb3865f2ce55a83b2cf12e0ae2db5e))
|
|
23
|
+
* Update eslint jest configuration and versions. ([deea99c](https://github.com/launchdarkly/js-core/commit/deea99ca2fbb3865f2ce55a83b2cf12e0ae2db5e))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* Add RN SDK offline support through ConnectionMode. ([#361](https://github.com/launchdarkly/js-core/issues/361)) ([d97ce82](https://github.com/launchdarkly/js-core/commit/d97ce82861438a1b79b93799a9d061cdfa1ab027))
|
|
29
|
+
* Implement RN SDK EventSource jitter backoff. ([#359](https://github.com/launchdarkly/js-core/issues/359)) ([95e58bd](https://github.com/launchdarkly/js-core/commit/95e58bd666772b30b31ac98a462ca19407bc2bac))
|
|
30
|
+
* Improvements and fixes from docs review. ([#362](https://github.com/launchdarkly/js-core/issues/362)) ([ba07fbf](https://github.com/launchdarkly/js-core/commit/ba07fbf4ea0b505c4bdc6376b6b36d7a9c1e5fda))
|
|
31
|
+
* RN streamer connection in background and foreground. ([#360](https://github.com/launchdarkly/js-core/issues/360)) ([c69b768](https://github.com/launchdarkly/js-core/commit/c69b7686eed1971288adfbe527b4bf53ba5fe2b7))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Dependencies
|
|
35
|
+
|
|
36
|
+
* The following workspace dependencies were updated
|
|
37
|
+
* dependencies
|
|
38
|
+
* @launchdarkly/js-client-sdk-common bumped from 0.1.2 to 0.2.0
|
|
39
|
+
|
|
3
40
|
## [0.1.5](https://github.com/launchdarkly/js-core/compare/react-native-client-sdk-v0.1.4...react-native-client-sdk-v0.1.5) (2024-01-16)
|
|
4
41
|
|
|
5
42
|
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ and re-run pod install for [auto-linking to work](https://github.com/react-nativ
|
|
|
42
42
|
// App.tsx
|
|
43
43
|
import { LDProvider, ReactNativeLDClient } from '@launchdarkly/react-native-client-sdk';
|
|
44
44
|
|
|
45
|
-
const featureClient = new ReactNativeLDClient('mobile-key');
|
|
45
|
+
const featureClient = new ReactNativeLDClient('mobile-key', AutoEnvAttributes.Enabled);
|
|
46
46
|
const userContext = { kind: 'user', key: 'test-user-1' };
|
|
47
47
|
|
|
48
48
|
const App = () => (
|
|
@@ -100,7 +100,7 @@ yarn && yarn ios-go
|
|
|
100
100
|
|
|
101
101
|
## Verifying SDK build provenance with the SLSA framework
|
|
102
102
|
|
|
103
|
-
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
|
|
103
|
+
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
|
|
104
104
|
|
|
105
105
|
## About LaunchDarkly
|
|
106
106
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@launchdarkly/react-native-client-sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React Native LaunchDarkly SDK",
|
|
5
5
|
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/react-native",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": "npx tsc && yarn link-dev",
|
|
31
31
|
"tsw": "yarn tsc --watch",
|
|
32
32
|
"start": "rimraf dist && yarn tsw",
|
|
33
|
-
"lint": "eslint . --ext .ts",
|
|
33
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
34
34
|
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore",
|
|
35
35
|
"test": "jest",
|
|
36
36
|
"coverage": "yarn test --coverage",
|
|
@@ -44,26 +44,29 @@
|
|
|
44
44
|
"react-native": "*"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@launchdarkly/js-client-sdk-common": "0.1
|
|
47
|
+
"@launchdarkly/js-client-sdk-common": "0.2.1",
|
|
48
48
|
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
49
49
|
"base64-js": "^1.5.1",
|
|
50
50
|
"event-target-shim": "^6.0.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@launchdarkly/private-js-mocks": "0.0.1",
|
|
53
54
|
"@testing-library/react": "^14.1.2",
|
|
54
55
|
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
|
55
56
|
"@types/jest": "^29.5.11",
|
|
56
57
|
"@types/react": "^18.2.31",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
58
|
-
"@typescript-eslint/parser": "^6.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
59
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
59
60
|
"eslint": "^8.45.0",
|
|
60
61
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
61
62
|
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
62
63
|
"eslint-config-prettier": "^8.8.0",
|
|
63
64
|
"eslint-plugin-import": "^2.27.5",
|
|
65
|
+
"eslint-plugin-jest": "^27.6.3",
|
|
64
66
|
"eslint-plugin-prettier": "^5.0.0",
|
|
65
67
|
"jest": "^29.7.0",
|
|
66
68
|
"launchdarkly-js-test-helpers": "^2.2.0",
|
|
69
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
67
70
|
"prettier": "^3.0.0",
|
|
68
71
|
"react": "^18.2.0",
|
|
69
72
|
"react-dom": "^18.2.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { LDClientImpl, type LDContext, type LDOptions } from '@launchdarkly/js-client-sdk-common';
|
|
1
|
+
import { AutoEnvAttributes, LDClientImpl, type LDContext, type LDOptions } from '@launchdarkly/js-client-sdk-common';
|
|
2
2
|
/**
|
|
3
3
|
* The React Native LaunchDarkly client. Instantiate this class to create an
|
|
4
4
|
* instance of the ReactNativeLDClient and pass it to the {@link LDProvider}.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
-
* const featureClient = new ReactNativeLDClient(MOBILE_KEY);
|
|
8
|
+
* const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled);
|
|
9
9
|
*
|
|
10
10
|
* <LDProvider client={featureClient}>
|
|
11
11
|
* <Welcome />
|
|
@@ -17,9 +17,13 @@ export default class ReactNativeLDClient extends LDClientImpl {
|
|
|
17
17
|
* Creates an instance of the LaunchDarkly client.
|
|
18
18
|
*
|
|
19
19
|
* @param sdkKey The LaunchDarkly mobile key.
|
|
20
|
+
* @param autoEnvAttributes Enable / disable Auto environment attributes. When enabled, the SDK will automatically
|
|
21
|
+
* provide data about the mobile environment where the application is running. To learn more,
|
|
22
|
+
* read [Automatic environment attributes](https://docs.launchdarkly.com/sdk/features/environment-attributes).
|
|
23
|
+
* for more documentation.
|
|
20
24
|
* @param options {@link LDOptions} to initialize the client with.
|
|
21
25
|
*/
|
|
22
|
-
constructor(sdkKey: string, options?: LDOptions);
|
|
26
|
+
constructor(sdkKey: string, autoEnvAttributes: AutoEnvAttributes, options?: LDOptions);
|
|
23
27
|
createStreamUriPath(context: LDContext): string;
|
|
24
28
|
}
|
|
25
29
|
//# sourceMappingURL=ReactNativeLDClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeLDClient.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLDClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ReactNativeLDClient.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLDClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAIjB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,oCAAoC,CAAC;AAI5C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,YAAY;IAC3D;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,GAAE,SAAc;IAwBhF,mBAAmB,CAAC,OAAO,EAAE,SAAS;CAGhD"}
|
|
@@ -6,7 +6,7 @@ import createPlatform from './platform';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
|
-
* const featureClient = new ReactNativeLDClient(MOBILE_KEY);
|
|
9
|
+
* const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled);
|
|
10
10
|
*
|
|
11
11
|
* <LDProvider client={featureClient}>
|
|
12
12
|
* <Welcome />
|
|
@@ -18,12 +18,16 @@ export default class ReactNativeLDClient extends LDClientImpl {
|
|
|
18
18
|
* Creates an instance of the LaunchDarkly client.
|
|
19
19
|
*
|
|
20
20
|
* @param sdkKey The LaunchDarkly mobile key.
|
|
21
|
+
* @param autoEnvAttributes Enable / disable Auto environment attributes. When enabled, the SDK will automatically
|
|
22
|
+
* provide data about the mobile environment where the application is running. To learn more,
|
|
23
|
+
* read [Automatic environment attributes](https://docs.launchdarkly.com/sdk/features/environment-attributes).
|
|
24
|
+
* for more documentation.
|
|
21
25
|
* @param options {@link LDOptions} to initialize the client with.
|
|
22
26
|
*/
|
|
23
|
-
constructor(sdkKey, options = {}) {
|
|
24
|
-
|
|
25
|
-
const logger =
|
|
26
|
-
level: 'debug',
|
|
27
|
+
constructor(sdkKey, autoEnvAttributes, options = {}) {
|
|
28
|
+
const { logger: customLogger, debug } = options;
|
|
29
|
+
const logger = customLogger !== null && customLogger !== void 0 ? customLogger : new BasicLogger({
|
|
30
|
+
level: debug ? 'debug' : 'info',
|
|
27
31
|
// eslint-disable-next-line no-console
|
|
28
32
|
destination: console.log,
|
|
29
33
|
});
|
|
@@ -31,7 +35,7 @@ export default class ReactNativeLDClient extends LDClientImpl {
|
|
|
31
35
|
analyticsEventPath: `/mobile`,
|
|
32
36
|
diagnosticEventPath: `/mobile/events/diagnostic`,
|
|
33
37
|
};
|
|
34
|
-
super(sdkKey, createPlatform(logger), Object.assign(Object.assign({}, options), { logger }), internalOptions);
|
|
38
|
+
super(sdkKey, autoEnvAttributes, createPlatform(logger), Object.assign(Object.assign({}, options), { logger }), internalOptions);
|
|
35
39
|
}
|
|
36
40
|
createStreamUriPath(context) {
|
|
37
41
|
return `/meval/${base64UrlEncode(JSON.stringify(context), this.platform.encoding)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeLDClient.js","sourceRoot":"","sources":["../../src/ReactNativeLDClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ReactNativeLDClient.js","sourceRoot":"","sources":["../../src/ReactNativeLDClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,WAAW,EAEX,YAAY,GAGb,MAAM,oCAAoC,CAAC;AAE5C,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,YAAY;IAC3D;;;;;;;;;OASG;IACH,YAAY,MAAc,EAAE,iBAAoC,EAAE,UAAqB,EAAE;QACvF,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAChD,MAAM,MAAM,GACV,YAAY,aAAZ,YAAY,cAAZ,YAAY,GACZ,IAAI,WAAW,CAAC;YACd,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;YAC/B,sCAAsC;YACtC,WAAW,EAAE,OAAO,CAAC,GAAG;SACzB,CAAC,CAAC;QAEL,MAAM,eAAe,GAA+B;YAClD,kBAAkB,EAAE,SAAS;YAC7B,mBAAmB,EAAE,2BAA2B;SACjD,CAAC;QAEF,KAAK,CACH,MAAM,EACN,iBAAiB,EACjB,cAAc,CAAC,MAAM,CAAC,kCACjB,OAAO,KAAE,MAAM,KACpB,eAAe,CAChB,CAAC;IACJ,CAAC;IAEQ,mBAAmB,CAAC,OAAkB;QAC7C,OAAO,UAAU,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAS,CAAC,EAAE,CAAC;IACvF,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export = sha256;
|
|
2
|
+
declare function exports(message: any): any;
|
|
3
|
+
declare namespace exports {
|
|
4
|
+
export { exports as sha256, sha224 };
|
|
5
|
+
}
|
|
6
|
+
declare namespace ___home_runner_work_js_core_js_core_packages_sdk_react_native_src_fromExternal_js_sha256_index_ {
|
|
7
|
+
export namespace sha256 {
|
|
8
|
+
function hmac(key: any, message: any): any;
|
|
9
|
+
}
|
|
10
|
+
export { exports as sha256 };
|
|
11
|
+
export function sha224(message: any): any;
|
|
12
|
+
export namespace sha224 {
|
|
13
|
+
export function hmac_1(key: any, message: any): any;
|
|
14
|
+
export { hmac_1 as hmac };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fromExternal/js-sha256/index.js"],"names":[],"mappings":";AA8DW,4CAEN;;;;;;QAmBM,2CAEN;;;IAvBM,0CAEN;;QAmBM,oDAEN"}
|