@feedvalue/react 0.1.1 → 0.1.4
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 +42 -1
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -153,9 +153,46 @@ export function FeedbackForm() {
|
|
|
153
153
|
}
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
+
### Custom Fields
|
|
157
|
+
|
|
158
|
+
Custom fields allow you to collect structured data beyond the main feedback message. **Custom fields must be defined in your widget configuration on the FeedValue dashboard before use.**
|
|
159
|
+
|
|
160
|
+
1. Go to your widget settings in the FeedValue dashboard
|
|
161
|
+
2. Add custom fields with types: `text`, `email`, or `emoji`
|
|
162
|
+
3. Use `customFieldValues` when submitting:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
'use client';
|
|
166
|
+
|
|
167
|
+
import { useFeedValue } from '@feedvalue/react';
|
|
168
|
+
|
|
169
|
+
export function DetailedFeedback() {
|
|
170
|
+
const { submit, isReady } = useFeedValue();
|
|
171
|
+
|
|
172
|
+
const handleSubmit = async () => {
|
|
173
|
+
await submit({
|
|
174
|
+
message: 'Detailed feedback',
|
|
175
|
+
customFieldValues: {
|
|
176
|
+
// Field IDs must match those defined in your widget configuration
|
|
177
|
+
name: 'John Doe',
|
|
178
|
+
category: 'feature',
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<button onClick={handleSubmit} disabled={!isReady}>
|
|
185
|
+
Submit Feedback
|
|
186
|
+
</button>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> **Important**: The field IDs in `customFieldValues` must match the field IDs defined in your widget configuration on the dashboard.
|
|
192
|
+
|
|
156
193
|
### User Identification
|
|
157
194
|
|
|
158
|
-
|
|
195
|
+
Attach user context to feedback submissions. This data is **not shown in the widget UI** but is stored with the submission and visible in your FeedValue dashboard:
|
|
159
196
|
|
|
160
197
|
```tsx
|
|
161
198
|
'use client';
|
|
@@ -183,6 +220,10 @@ export function UserIdentifier({ user }) {
|
|
|
183
220
|
}
|
|
184
221
|
```
|
|
185
222
|
|
|
223
|
+
> **User Data vs Custom Fields**
|
|
224
|
+
> - **User data** (`identify`/`setData`): Hidden from users, automatically attached to submissions. Use for internal context like user IDs, subscription plans, etc.
|
|
225
|
+
> - **Custom fields** (`customFieldValues`): Shown as form inputs in the widget. Users fill these in themselves. Must be defined in widget configuration first.
|
|
226
|
+
|
|
186
227
|
## API Reference
|
|
187
228
|
|
|
188
229
|
### `<FeedValueProvider>`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedvalue/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "FeedValue React SDK - Provider, Hooks, and Components for React 18+",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,35 +23,25 @@
|
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": false,
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsup",
|
|
28
|
-
"dev": "tsup --watch",
|
|
29
|
-
"lint": "eslint src",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:watch": "vitest",
|
|
32
|
-
"test:coverage": "vitest run --coverage",
|
|
33
|
-
"typecheck": "tsc --noEmit",
|
|
34
|
-
"clean": "rm -rf dist"
|
|
35
|
-
},
|
|
36
26
|
"peerDependencies": {
|
|
37
27
|
"react": ">=18.0.0",
|
|
38
28
|
"react-dom": ">=18.0.0"
|
|
39
29
|
},
|
|
40
30
|
"dependencies": {
|
|
41
|
-
"@feedvalue/core": "
|
|
31
|
+
"@feedvalue/core": "^0.1.2"
|
|
42
32
|
},
|
|
43
33
|
"devDependencies": {
|
|
44
34
|
"@testing-library/jest-dom": "^6.9.1",
|
|
45
35
|
"@testing-library/react": "^16.1.0",
|
|
46
36
|
"@types/react": "^19.0.0",
|
|
47
37
|
"@types/react-dom": "^19.0.0",
|
|
48
|
-
"@vitest/coverage-v8": "^
|
|
49
|
-
"happy-dom": "^
|
|
38
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
39
|
+
"happy-dom": "^20.3.9",
|
|
50
40
|
"react": "^19.0.0",
|
|
51
41
|
"react-dom": "^19.0.0",
|
|
52
42
|
"tsup": "^8.3.0",
|
|
53
43
|
"typescript": "^5.7.0",
|
|
54
|
-
"vitest": "^
|
|
44
|
+
"vitest": "^4.0.18"
|
|
55
45
|
},
|
|
56
46
|
"publishConfig": {
|
|
57
47
|
"access": "public"
|
|
@@ -77,5 +67,15 @@
|
|
|
77
67
|
],
|
|
78
68
|
"engines": {
|
|
79
69
|
"node": ">=18"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsup",
|
|
73
|
+
"dev": "tsup --watch",
|
|
74
|
+
"lint": "eslint src",
|
|
75
|
+
"test": "vitest run",
|
|
76
|
+
"test:watch": "vitest",
|
|
77
|
+
"test:coverage": "vitest run --coverage",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"clean": "rm -rf dist"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|