@microsoft/omnichannel-chat-sdk 1.11.2 → 1.11.3-main.48240b1
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 +49 -22
- package/package.json +1 -1
package/README.md
CHANGED
@@ -150,7 +150,11 @@ npm install @microsoft/omnichannel-chat-sdk --save
|
|
150
150
|
|
151
151
|
## Installation on React Native
|
152
152
|
|
153
|
-
|
153
|
+
***Important Note:***
|
154
|
+
- For React Native versions **0.71 and above**: Steps 1, 2, 3 are **required only for iOS**. Not needed for Android.
|
155
|
+
- For React Native versions **below 0.71**: Steps 1, 2, 3 are **required for both Android and iOS**.
|
156
|
+
|
157
|
+
### Steps
|
154
158
|
|
155
159
|
1. Install `node-libs-react-native`
|
156
160
|
|
@@ -158,46 +162,69 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
|
|
158
162
|
npm install node-libs-react-native --save-dev
|
159
163
|
```
|
160
164
|
|
161
|
-
|
162
|
-
|
165
|
+
2. Install `react-native-randombytes`
|
163
166
|
```console
|
164
167
|
npm install react-native-randombytes --save-dev
|
165
168
|
```
|
166
169
|
|
167
|
-
|
168
|
-
|
170
|
+
3. Install `react-native-get-random-values`
|
169
171
|
```console
|
170
172
|
npm install react-native-get-random-values --save-dev
|
171
173
|
```
|
172
|
-
|
173
|
-
|
174
|
+
|
175
|
+
4. Install `react-native-url-polyfill`
|
174
176
|
|
175
177
|
```console
|
176
178
|
npm install react-native-url-polyfill --save-dev
|
177
179
|
```
|
178
180
|
|
179
|
-
|
181
|
+
5. Install `@azure/core-asynciterator-polyfill`
|
180
182
|
|
181
183
|
```console
|
182
184
|
npm install @azure/core-asynciterator-polyfill --save-dev
|
183
185
|
```
|
184
|
-
|
185
|
-
|
186
|
-
|
186
|
+
**iOS and Android Platforms**
|
187
|
+
|
188
|
+
| React Native Version | Libraries | iOS | Android |
|
189
|
+
| ----------------------- | -------------------------------- | --------- | ----------- |
|
190
|
+
| 0.71 and above | | | |
|
191
|
+
| | node-libs-react-native | ✅ Yes | ❌ No |
|
192
|
+
| | react-native-randombytes | ✅ Yes | ❌ No |
|
193
|
+
| | react-native-get-random-values | ✅ Yes | ❌ No |
|
194
|
+
| | react-native-url-polyfill | ✅ Yes | ✅ Yes |
|
195
|
+
| | @azure/core-asynciterator-polyfill | ✅ Yes | ✅ Yes |
|
196
|
+
|
197
|
+
Below 0.71 version you need to add all above libraries.
|
198
|
+
|
199
|
+
**Required file changes**
|
200
|
+
1. In metro.config.js
|
201
|
+
- Update *metro.config.js* to use React Native compatible Node Core modules.
|
187
202
|
```ts
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
}
|
203
|
+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
204
|
+
const nodeLibs = require('node-libs-react-native'); // Import node-libs-react-native
|
205
|
+
const config = {
|
206
|
+
resolver: {
|
207
|
+
extraNodeModules: {
|
208
|
+
...nodeLibs,
|
209
|
+
net: require.resolve('node-libs-react-native/mock/net'),
|
210
|
+
tls: require.resolve('node-libs-react-native/mock/tls'),
|
211
|
+
},
|
212
|
+
},
|
197
213
|
};
|
198
214
|
```
|
199
|
-
|
200
|
-
|
215
|
+
- If you encounter a crypto issue for iOS (e.g. error "crypto.getRandomValues() not supported") you should install crypto-browserify and stream-browserify, then add the following lines to your *metro.config.js* file.
|
216
|
+
|
217
|
+
```ts
|
218
|
+
const config = {
|
219
|
+
resolver: {
|
220
|
+
extraNodeModules: {
|
221
|
+
crypto: require.resolve("crypto-browserify"),
|
222
|
+
stream: require.resolve("stream-browserify"),
|
223
|
+
},
|
224
|
+
},
|
225
|
+
};
|
226
|
+
```
|
227
|
+
2. Add the following *import* on top of your entry point file
|
201
228
|
|
202
229
|
```ts
|
203
230
|
import 'node-libs-react-native/globals';
|