@encatch/react-native-sdk 1.0.0-beta.0 → 1.0.0-beta.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 +12 -193
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,204 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @encatch/react-native-sdk
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Ensight SDK provides a seamless way to integrate user feedback collection into your React Native applications. This SDK allows you to display customized feedback forms, collect user responses, and submit them to the Ensight backend.
|
|
3
|
+
The Encatch React Native SDK lets you collect user feedback in your React Native and Expo apps. Display feedback forms in using native with encatch hooks or a WebView overlay, identify users, track screens and events, and submit responses to the Encatch backend.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Quick Start
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
import Ensight, { EnsightConfig, EnsightTheme } from "ensight-react-native";
|
|
21
|
-
|
|
22
|
-
// Initialize the SDK
|
|
23
|
-
const config = new EnsightConfig({
|
|
24
|
-
host: "https://app.dev.en-gage.in",
|
|
25
|
-
themeMode: "light",
|
|
26
|
-
language: "en",
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
Ensight.instance.ensightApp.initialize({
|
|
30
|
-
apiKey: "YOUR_API_KEY_HERE",
|
|
31
|
-
config: config,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Open feedback form
|
|
35
|
-
Ensight.instance.ensightApp.openFeedback();
|
|
8
|
+
npm install @encatch/react-native-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add @encatch/react-native-sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @encatch/react-native-sdk
|
|
36
13
|
```
|
|
37
14
|
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
- In-app feedback collection
|
|
41
|
-
- Customizable feedback forms
|
|
42
|
-
- Theme support (light/dark)
|
|
43
|
-
- Multilingual support
|
|
44
|
-
- User identification
|
|
45
|
-
- Session management
|
|
46
|
-
- Event analytics
|
|
47
|
-
|
|
48
|
-
## SDK Initialization
|
|
49
|
-
|
|
50
|
-
Initialize the SDK early in your application lifecycle:
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const userInfo = {
|
|
54
|
-
user_name: "user@example.com",
|
|
55
|
-
properties: {
|
|
56
|
-
email: "user@example.com",
|
|
57
|
-
user_age: 30,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const config = new EnsightConfig({
|
|
62
|
-
host: "https://app.dev.en-gage.in",
|
|
63
|
-
identity: userInfo,
|
|
64
|
-
processAfterIdentitySet: false,
|
|
65
|
-
isAutoCaptureEnabled: true,
|
|
66
|
-
themeMode: "light",
|
|
67
|
-
language: "en",
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
Ensight.instance.ensightApp.initialize({
|
|
71
|
-
apiKey: "YOUR_API_KEY_HERE",
|
|
72
|
-
config: config,
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Displaying Feedback Forms
|
|
77
|
-
|
|
78
|
-
### Open Default Feedback
|
|
79
|
-
|
|
80
|
-
```javascript
|
|
81
|
-
await Ensight.instance.ensightApp.openFeedback();
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Open Feedback by ID
|
|
85
|
-
|
|
86
|
-
```javascript
|
|
87
|
-
await Ensight.instance.ensightApp.openFeedbackById("FEEDBACK_CONFIGURATION_ID");
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Open Feedback by Name
|
|
91
|
-
|
|
92
|
-
```javascript
|
|
93
|
-
await Ensight.instance.ensightApp.openFeedbackByName("Feedback Form Title");
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## User Identification
|
|
97
|
-
|
|
98
|
-
Identify users to personalize feedback forms:
|
|
99
|
-
|
|
100
|
-
```javascript
|
|
101
|
-
Ensight.instance.ensightApp.identify("user@example.com", {
|
|
102
|
-
email: "user@example.com",
|
|
103
|
-
user_age: 30,
|
|
104
|
-
});
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Session Management
|
|
108
|
-
|
|
109
|
-
Control and manage user sessions:
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
// Stop the current session and generate a new session ID
|
|
113
|
-
await Ensight.instance.ensightApp.stopSession();
|
|
114
|
-
|
|
115
|
-
// Reset the session, clear user data, and reinitialize
|
|
116
|
-
await Ensight.instance.ensightApp.resetSession();
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Theming
|
|
120
|
-
|
|
121
|
-
Customize the appearance of feedback forms:
|
|
122
|
-
|
|
123
|
-
```javascript
|
|
124
|
-
// Set theme to dark mode
|
|
125
|
-
Ensight.instance.ensightApp.setTheme(EnsightTheme.dark);
|
|
126
|
-
|
|
127
|
-
// Set theme to light mode
|
|
128
|
-
Ensight.instance.ensightApp.setTheme(EnsightTheme.light);
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Language Support
|
|
132
|
-
|
|
133
|
-
Change the language for feedback forms:
|
|
134
|
-
|
|
135
|
-
```javascript
|
|
136
|
-
// Set language to English
|
|
137
|
-
Ensight.instance.ensightApp.setLanguage("en");
|
|
138
|
-
|
|
139
|
-
// Set language to Spanish
|
|
140
|
-
Ensight.instance.ensightApp.setLanguage("es");
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Event Tracking
|
|
144
|
-
|
|
145
|
-
Track user events for analytics:
|
|
146
|
-
|
|
147
|
-
```javascript
|
|
148
|
-
const eventInfo = {
|
|
149
|
-
event_name: "button_click",
|
|
150
|
-
properties: {
|
|
151
|
-
button_id: "submit_form",
|
|
152
|
-
page: "checkout",
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
Ensight.instance.ensightApp.queueEvent(eventInfo);
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Path Observation
|
|
160
|
-
|
|
161
|
-
Track user navigation within your app:
|
|
162
|
-
|
|
163
|
-
```javascript
|
|
164
|
-
// Set the current path
|
|
165
|
-
Ensight.instance.ensightApp.setCurrentPath("/home/products");
|
|
166
|
-
|
|
167
|
-
// Add path change observer
|
|
168
|
-
const pathObserver = Ensight.instance.ensightApp.pathObserver;
|
|
169
|
-
pathObserver.addObserver((oldPath, newPath) => {
|
|
170
|
-
console.log(`Navigation changed from ${oldPath} to ${newPath}`);
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Troubleshooting
|
|
175
|
-
|
|
176
|
-
If you encounter issues with the SDK:
|
|
177
|
-
|
|
178
|
-
1. Check initialization parameters
|
|
179
|
-
2. Verify API key and host URL
|
|
180
|
-
3. Ensure network connectivity
|
|
181
|
-
4. Check console logs for error messages
|
|
15
|
+
## Documentation
|
|
182
16
|
|
|
183
|
-
|
|
17
|
+
For the full API reference, configuration options, and usage examples, visit the official documentation:
|
|
184
18
|
|
|
185
|
-
|
|
186
|
-
| ----------------------- | --------------------------------------- | -------------------------------------------------------------- | --------------- |
|
|
187
|
-
| `initialize` | Initializes the SDK | `apiKey: string, config?: EnsightConfig` | `void` |
|
|
188
|
-
| `openFeedback` | Opens the default feedback form | None | `Promise<void>` |
|
|
189
|
-
| `openFeedbackById` | Opens a feedback form by ID | `id: string` | `Promise<void>` |
|
|
190
|
-
| `openFeedbackByName` | Opens a feedback form by name | `name: string` | `Promise<void>` |
|
|
191
|
-
| `identify` | Identifies a user | `userId: string, traits?: Record<string, any>` | `void` |
|
|
192
|
-
| `submitFeedback` | Submits feedback data | `feedback?: Record<string, any>` | `Promise<void>` |
|
|
193
|
-
| `stopSession` | Stops the current session | None | `Promise<void>` |
|
|
194
|
-
| `resetSession` | Resets the session and clears user data | None | `Promise<void>` |
|
|
195
|
-
| `setTheme` | Sets the theme | `theme: EnsightTheme` | `void` |
|
|
196
|
-
| `setLanguage` | Sets the language | `language: string` | `void` |
|
|
197
|
-
| `queueEvent` | Adds an event to the analytics queue | `event: EventInfo` | `void` |
|
|
198
|
-
| `setCurrentPath` | Sets the current path for analytics | `path: string` | `void` |
|
|
199
|
-
| `addPopupStateListener` | Adds a listener for popup state changes | `listener: (isVisible: boolean, props?: PopupUIProps) => void` | `() => void` |
|
|
200
|
-
| `pathObserver` | Gets the path observer instance | None | `PathObserver` |
|
|
19
|
+
**[https://encatch.com/docs/sdk-reference/mobile-sdk/react-native](https://encatch.com/docs/sdk-reference/mobile-sdk/react-native)**
|
|
201
20
|
|
|
202
|
-
##
|
|
21
|
+
## License
|
|
203
22
|
|
|
204
|
-
|
|
23
|
+
MIT
|
package/package.json
CHANGED
|
@@ -5,17 +5,22 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/get-encatch/react-native-sdk"
|
|
7
7
|
},
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://encatch.com",
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/get-encatch/react-native-sdk/issues"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"module": "dist/index.mjs",
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
|
-
"version": "1.0.0-beta.
|
|
15
|
+
"version": "1.0.0-beta.1",
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"build:watch": "tsup --watch",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
19
24
|
"peerDependencies": {
|
|
20
25
|
"react": ">=18.0.0",
|
|
21
26
|
"react-native": ">=0.73.0",
|
|
@@ -62,10 +67,5 @@
|
|
|
62
67
|
"react-native": "0.84.1",
|
|
63
68
|
"typescript": "~5.9.3",
|
|
64
69
|
"tsup": "^8.5.1"
|
|
65
|
-
},
|
|
66
|
-
"scripts": {
|
|
67
|
-
"build": "tsup",
|
|
68
|
-
"build:watch": "tsup --watch",
|
|
69
|
-
"clean": "rm -rf dist"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|