Skip to content

Commit 60e0cb1

Browse files
Restructure mobile SDK documentation for React Native
1 parent dfb5c62 commit 60e0cb1

File tree

1 file changed

+75
-25
lines changed

1 file changed

+75
-25
lines changed

fern/docs/pages/plug-sdk/react-native.mdx

Lines changed: 75 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
This section describes the process of integrating the DevRev SDK with your React Native app.
22

3-
## Installation
3+
## Quickstart Guide
4+
### Installation
45

56
To install the DevRev SDK, run the following command:
67

78
```sh
89
npm install @devrev/sdk-react-native
910
```
1011

11-
## Set up the DevRev SDK
12+
### Set up the DevRev SDK
1213

1314
In DevRev, go to **Settings** > **PLuG Chat** copy the value under **Your unique App ID**. After obtaining the credentials, you can configure the DevRev SDK in your app.
1415

@@ -22,7 +23,8 @@ The SDK will be ready for use once you execute the following configuration metho
2223
DevRev.configure(appID: string)
2324
```
2425

25-
## Identification
26+
## Features
27+
### Identification
2628

2729
To access certain features of the DevRev SDK, user identification is required.
2830

@@ -38,23 +40,30 @@ The `Identity` structure allows for custom fields in the user, organization, and
3840

3941
You can select from the following methods to identify users within your application:
4042

41-
### Anonymous identification
43+
#### Anonymous identification
4244

4345
The anonymous identification method allows you to create an anonymous user with an optional user identifier, ensuring that no other data is stored or associated with the user.
4446

4547
```typescript
4648
DevRev.identifyAnonymousUser(userID: string)
4749
```
4850

49-
### Unverified identification
51+
#### Unverified identification
5052

5153
The unverified identification method identifies users with a unique identifier, but it does not verify their identity with the DevRev backend.
5254

5355
```typescript
5456
DevRev.identifyUnverifiedUser(userID: string, organizationID?: string)
5557
```
5658

57-
### Update the user
59+
#### Verified identification
60+
The verified identification method identifies users with a unique identifier and verifies their identity with the DevRev backend.
61+
62+
```typescript
63+
DevRev.identifyVerifiedUser(userID: string, sessionToken: string)
64+
```
65+
66+
#### Update the user
5867

5968
You can update the user's information using the following method:
6069

@@ -66,7 +75,7 @@ DevRev.updateUser(identity: Identity)
6675
The `userID` property cannot be updated.
6776
</Callout>
6877

69-
## PLuG support chat
78+
### PLuG support chat
7079

7180
Once user identification is complete, you can start using the chat (conversations) dialog supported by our DevRev SDK. The support chat feature can be shown as a modal screen from the top-most screen. 
7281

@@ -80,15 +89,15 @@ To show the support chat screen in your app, you can use the following method:
8089
DevRev.showSupport()
8190
```
8291

83-
### Creating a new support conversation
92+
#### Creating a new support conversation
8493

8594
You can initiate a new support conversation directly from your app. This method displays the support chat screen and simultaneously creates a new conversation.
8695

8796
```typescript
8897
DevRev.createSupportConversation()
8998
```
9099

91-
### In-app link handling
100+
#### In-app link handling
92101

93102
In some instances, links opened from the support chat are displayed within the app rather than in a browser. You can manage whether the chat modal should close after a link is opened by using the following method:
94103

@@ -98,7 +107,7 @@ DevRev.setShouldDismissModalsOnOpenLink(value: boolean)
98107

99108
Setting this flag to `true` applies the system's default behavior for opening links, which includes dismissing any DevRev modal screens to facilitate handling your own deep links.
100109

101-
### In-app link callback
110+
#### In-app link callback
102111

103112
<Callout intent="note">
104113
This functionality is for Android only.
@@ -114,7 +123,7 @@ DevRev.setInAppLinkHandler((url) => {
114123

115124
If a custom handler is not defined, all external and in-app links from the support chat will open using the system's default browser, such as Chrome.
116125

117-
## Analytics
126+
### Analytics
118127

119128
The DevRev SDK allows you to send custom analytic events by using a properties map. You can track these events using the following function:
120129

@@ -126,11 +135,11 @@ This functionality requires the SDK to be configured and the user to be identifi
126135
DevRev.trackEvent(name: string, properties?: Map<string, string>)
127136
```
128137

129-
## Session analytics
138+
### Session analytics
130139

131140
The DevRev SDK offers session analytics features to help you understand how users interact with your app.
132141

133-
### Opting-in or out
142+
#### Opting-in or out
134143

135144
Session analytics features are opted-in by default, enabling them from the start. However, you can opt-out using the following method:
136145

@@ -144,7 +153,7 @@ To opt back in, use the following method:
144153
DevRev.resumeAllMonitoring()
145154
```
146155

147-
### Session recording
156+
#### Session recording
148157

149158
You can enable session recording to capture user interactions with your app.
150159

@@ -161,7 +170,7 @@ The session recording feature includes the following methods to control the reco
161170
|`DevRev.pauseRecording()` | Pauses the ongoing session recording. |
162171
|`DevRev.resumeRecording()` | Resumes a paused session recording. |
163172

164-
### Session properties
173+
#### Session properties
165174

166175
You can add custom properties to the session recording to help you understand the context of the session. The properties are defined as a map of string values.
167176

@@ -175,7 +184,7 @@ To clear the session properties in scenarios such as user logout or when the ses
175184
DevRev.clearSessionProperties()
176185
```
177186

178-
### Masking sensitive data
187+
#### Masking sensitive data
179188

180189
To protect sensitive data, the DevRev SDK provides an auto-masking feature that masks data before sending to the server. Input views such as text fields, text views, and web views are automatically masked.
181190

@@ -191,7 +200,7 @@ If any previously masked views need to be unmasked, you can use the following me
191200
DevRev.unmarkSensitiveViews(tags: any[])
192201
```
193202

194-
### Timers
203+
#### Timers
195204

196205
The DevRev SDK offers a timer mechanism to measure the time spent on specific tasks, allowing you to track events such as response time, loading time, or any other duration-based metrics.
197206

@@ -209,25 +218,25 @@ To stop a timer, use the following method:
209218
DevRev.stopTimer(name: string, properties: Map<string, string>)
210219
```
211220

212-
### Screen tracking
221+
#### Screen tracking
213222

214223
The DevRev SDK offers automatic screen tracking to help you understand how users navigate through your app. Although view controllers are automatically tracked, you can manually track screens using the following method:
215224

216225
```typescript
217226
DevRev.trackScreen(name: string)
218227
```
219228

220-
## Push notifications
229+
### Push notifications
221230

222231
You can configure your app to receive push notifications from the DevRev SDK. The SDK is designed to handle push notifications and execute actions based on the notification's content.
223232

224233
The DevRev backend sends push notifications to your app to alert users about new messages in the PLuG support chat.
225234

226-
### Configuration
235+
#### Configuration
227236

228237
To receive push notifications, you need to configure your DevRev organization by following the instructions in the [push notifications](./push-notification) section.
229238

230-
### Register for push notifications
239+
#### Register for push notifications
231240

232241
<Callout intent="note">
233242
Push notifications require SDK configuration and user identification, whether unverified or anonymous, to ensure delivery to the correct user.
@@ -254,9 +263,9 @@ DevRev.unregisterDevice(deviceID: string)
254263
The method requires the device identifier, which should be the same as the one used when registering the device.
255264

256265

257-
### Processing push notifications
266+
#### Processing push notifications
258267

259-
#### Android
268+
##### Android
260269

261270
On Android, notifications are implemented as data messages to offer flexibility. However, this means that automatic click processing isn't available. To handle notification clicks, developers need to intercept the click event, extract the payload, and pass it to a designated method for processing. This custom approach enables tailored notification handling in Android applications.
262271

@@ -280,7 +289,7 @@ const notificationPayload = {
280289
const messageJson = notificationPayload["message"];
281290
DevRev.processPushNotification(JSON.stringify(messageJson));
282291
```
283-
#### iOS
292+
##### iOS
284293

285294
On iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.
286295

@@ -294,6 +303,47 @@ For example:
294303
DevRev.processPushNotification(JSON.stringify(payload));
295304
```
296305

297-
## License
306+
#### Screen transition tracking (Android only)
307+
On Android, the DevRev SDK provides methods to manually track the screen transitions.
308+
309+
When a screen transition begins, you must call the following method:
310+
311+
```typescript
312+
DevRev.startScreenTransition()
313+
```
314+
315+
When a screen transition ends, you must call the following method:
316+
317+
```typescript
318+
DevRev.endScreenTransition()
319+
```
320+
321+
## Troubleshooting
322+
- **Issue**: Support chat won't show.
323+
**Solution**: Ensure you have correctly called one of the identification methods: `DevRev.identifyUnverifiedUser(...)`, `DevRev.identifyVerifiedUser(...)`, or `DevRev.identifyAnonymousUser(...)`.
324+
325+
- **Issue**: Not receiving push notifications.
326+
**Solution**: The DevRev SDK reports all errors in the console using Apple's Unified Logging System. Look for error messages in the subsystem `ai.devrev.sdk`.
327+
328+
329+
## Migration Guide
330+
This guide and chart should help facilitate the transition from the legacy UserExperior SDK to the new DevRev SDK in your React Native application, providing insights into feature equivalents and method changes.
331+
332+
### Feature Equivalence Chart
333+
| Feature | UserExperior SDK | DevRev SDK |
334+
|-|-|-|
335+
| Installation | `npm install react-native-userexperior` | `npm install @devrev/sdk-react-native` |
336+
| Initialization | `UserExperior.startRecording(string)` | `DevRev.configure(appID: string)` |
337+
| User Identification | `UserExperior.setUserIdentifier(string)` | `DevRev.identifyAnonymousUser(userID: string)`<br> `DevRev.identifyUnverifiedUser(identity: Identity)`<br> `DevRev.updateUser(identity: Identity)`<br> `DevRev.identifyVerifiedUser(userID: string, sessionToken: string)`<br> `DevRev.logout(deviceID: string)` |
338+
| Event Tracking | `UserExperior.logEvent(string, Map<string, string>)` | `DevRev.trackEvent(name: string, properties?: Map<string, string>)` |
339+
| Session Recording | `UserExperior.stopRecording()`<br />`UserExperior.pauseRecording()`<br />`UserExperior.resumeRecording()` | `DevRev.startRecording()`<br />`DevRev.stopRecording()`<br />`DevRev.pauseRecording()`<br />`DevRev.resumeRecording()`<br />`DevRev.processAllOnDemandSessions()` |
340+
| Opting in/out | Not supported. | `DevRev.stopAllMonitoring()`<br> `DevRev.resumeAllMonitoring()` |
341+
| Session Properties | `UserExperior.setUserProperties(Map<string, string>)` | `DevRev.addSessionProperties(properties: Map<string, string>)`<br> `DevRev.clearSessionProperties()` |
342+
| Masking Sensitive Data | `UserExperior.addInSecureViewBucket(any[])`<br />`UserExperior.removeFromSecureViewBucket(any[])` | `DevRev.markSensitiveViews(tags: any[])`<br />`DevRev.unmarkSensitiveViews(tags: any[])` |
343+
| Timers | Not supported. | `DevRev.startTimer()`<br> `DevRev.stopTimer()` |
344+
| PLuG support chat | Not supported. | `DevRev.showSupport()`<br> `DevRev.createSupportConversation()`<br> `DevRev.setShouldDismissModalsOnOpenLink()`<br> `DevRev.setInAppLinkHandler()` |
345+
| Push Notifications | Not supported. | `DevRev.registerDeviceToken()`<br> `DevRev.unregisterDevice(deviceID: string)`<br> `DevRev.processPushNotification()` |
346+
347+
### License
298348

299349
Apache 2.0

0 commit comments

Comments
 (0)