@launchdarkly/react-native-client-sdk 0.2.0 → 10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## [10.0.0](https://github.com/launchdarkly/js-core/compare/react-native-client-sdk-v0.2.1...react-native-client-sdk-v10.0.0) (2024-02-08)
4
+
5
+ ### Introducing `@launchdarkly/react-native-client-sdk` as a replacement for `launchdarkly-react-native-client-sdk`.
6
+
7
+ * The SDK has been re-written in Typescript.
8
+ * Supports Expo.
9
+ * The SDK has been moved to a new [repository](https://github.com/launchdarkly/js-core/tree/main/packages/sdk/react-native) in github.
10
+ * The SDK has a new [package name](https://www.npmjs.com/package/@launchdarkly/react-native-client-sdk).
11
+
12
+
13
+ ### Features
14
+
15
+ * React Native SDK major release. ([#369](https://github.com/launchdarkly/js-core/issues/369)) ([1d5ca40](https://github.com/launchdarkly/js-core/commit/1d5ca40888c4db4bb938884ca55732750fb10614))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Fix Detox e2e tests broken after 0.73 update. ([#366](https://github.com/launchdarkly/js-core/issues/366)) ([6349b98](https://github.com/launchdarkly/js-core/commit/6349b98e70554d8240f0e8d6b1090e4c37bde6eb))
21
+
22
+
23
+ ### Dependencies
24
+
25
+ * The following workspace dependencies were updated
26
+ * dependencies
27
+ * @launchdarkly/js-client-sdk-common bumped from 0.2.1 to 1.0.0
28
+
29
+ ## [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)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * 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))
35
+
36
+
37
+ ### Dependencies
38
+
39
+ * The following workspace dependencies were updated
40
+ * dependencies
41
+ * @launchdarkly/js-client-sdk-common bumped from 0.2.0 to 0.2.1
42
+
3
43
  ## [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)
4
44
 
5
45
 
package/README.md CHANGED
@@ -6,17 +6,15 @@
6
6
  [![NPM][sdk-react-native-dm-badge]][sdk-react-native-npm-link]
7
7
  [![NPM][sdk-react-native-dt-badge]][sdk-react-native-npm-link]
8
8
 
9
- > [!WARNING]
10
- > UNSUPPORTED This SDK is in pre-release development and is not supported.
9
+ The LaunchDarkly React Native SDK is designed primarily for use in mobile environments. It follows the client-side
10
+ LaunchDarkly model for multi-user contexts.
11
11
 
12
- The LaunchDarkly React Native SDK is designed primarily for use in mobile environments. It follows the client-side LaunchDarkly model for multi-user contexts.
13
-
14
- This SDK is a replacement of [launchdarkly-react-native-client-sdk](https://github.com/launchdarkly/react-native-client-sdk). Please consider updating your application to use this package instead.
12
+ This SDK is a complete rewrite of the React Native SDK and replaces [launchdarkly-react-native-client-sdk](https://github.com/launchdarkly/react-native-client-sdk). The
13
+ APIs are based on the JS SDK rather than the iOS and Android SDKs. It is not a wrapper of the iOS and Android SDKs.
14
+ It is implemented purely in JS and supports Expo. Please consider updating your application to use this package instead.
15
15
 
16
16
  For more information, see the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/client-side/react-native).
17
17
 
18
- This library is an alpha version and should not be considered ready for production use while this message is visible.
19
-
20
18
  ## Install
21
19
 
22
20
  ```shell
@@ -35,21 +33,27 @@ and re-run pod install for [auto-linking to work](https://github.com/react-nativ
35
33
 
36
34
  ## Quickstart
37
35
 
38
- 1. Wrap your application with `LDProvider` passing it an LDClient and
39
- an LDContext:
36
+ 1. Wrap your application with `LDProvider` and set the `client` prop to an instance of `ReactNativeLDClient`. Call
37
+ `identify` at a later time to get flags. In the example below, `identify` is called on App mount:
40
38
 
41
- ```jsx
39
+ ```tsx
42
40
  // App.tsx
43
41
  import { LDProvider, ReactNativeLDClient } from '@launchdarkly/react-native-client-sdk';
44
42
 
45
43
  const featureClient = new ReactNativeLDClient('mobile-key', AutoEnvAttributes.Enabled);
46
44
  const userContext = { kind: 'user', key: 'test-user-1' };
47
45
 
48
- const App = () => (
49
- <LDProvider client={featureClient} context={userContext}>
50
- <Welcome />
51
- </LDProvider>
52
- );
46
+ const App = () => {
47
+ useEffect(() => {
48
+ featureClient.identify(userContext).catch((e) => console.error(e));
49
+ }, []);
50
+
51
+ return (
52
+ <LDProvider client={featureClient}>
53
+ <YourComponent />
54
+ </LDProvider>
55
+ );
56
+ };
53
57
 
54
58
  export default App;
55
59
  ```
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@launchdarkly/react-native-client-sdk",
3
- "version": "0.2.0",
3
+ "version": "10.0.0",
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": {
@@ -44,7 +44,7 @@
44
44
  "react-native": "*"
45
45
  },
46
46
  "dependencies": {
47
- "@launchdarkly/js-client-sdk-common": "0.2.0",
47
+ "@launchdarkly/js-client-sdk-common": "1.0.0",
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"
@@ -2,7 +2,7 @@
2
2
  * Ripped from:
3
3
  * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Events/CustomEvent.js#L21
4
4
  */
5
- import { Event } from 'event-target-shim';
5
+ import { Event } from 'event-target-shim/es5';
6
6
  type CustomEventOptions = {
7
7
  bubbles?: boolean;
8
8
  cancelable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CustomEvent.d.ts","sourceRoot":"","sources":["../../../src/polyfills/CustomEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;IAC5C,MAAM,EAAE,GAAG,CAAC;gBAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB;CAMzD"}
1
+ {"version":3,"file":"CustomEvent.d.ts","sourceRoot":"","sources":["../../../src/polyfills/CustomEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;IAC5C,MAAM,EAAE,GAAG,CAAC;gBAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB;CAMzD"}
@@ -2,7 +2,7 @@
2
2
  * Ripped from:
3
3
  * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Events/CustomEvent.js#L21
4
4
  */
5
- import { Event } from 'event-target-shim';
5
+ import { Event } from 'event-target-shim/es5';
6
6
  export default class CustomEvent extends Event {
7
7
  constructor(typeArg, options) {
8
8
  const { bubbles, cancelable, composed, detail } = options;
@@ -1 +1 @@
1
- {"version":3,"file":"CustomEvent.js","sourceRoot":"","sources":["../../../src/polyfills/CustomEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;IAG5C,YAAY,OAAe,EAAE,OAA2B;QACtD,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC1D,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,2DAA2D;IACnF,CAAC;CACF"}
1
+ {"version":3,"file":"CustomEvent.js","sourceRoot":"","sources":["../../../src/polyfills/CustomEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAS9C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;IAG5C,YAAY,OAAe,EAAE,OAA2B;QACtD,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC1D,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,2DAA2D;IACnF,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@launchdarkly/react-native-client-sdk",
3
- "version": "0.2.0",
3
+ "version": "10.0.0",
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": {
@@ -44,7 +44,7 @@
44
44
  "react-native": "*"
45
45
  },
46
46
  "dependencies": {
47
- "@launchdarkly/js-client-sdk-common": "0.2.0",
47
+ "@launchdarkly/js-client-sdk-common": "1.0.0",
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"
@@ -1,2 +0,0 @@
1
- export let presets: string[];
2
- //# sourceMappingURL=babel.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.config.d.ts","sourceRoot":"","sources":["../babel.config.js"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- module.exports = {
3
- presets: ['module:metro-react-native-babel-preset'],
4
- };
5
- //# sourceMappingURL=babel.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.config.js","sourceRoot":"","sources":["../babel.config.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,OAAO,EAAE,CAAC,wCAAwC,CAAC;CACpD,CAAC"}