@feedvalue/vue 0.1.0 → 0.1.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 +75 -5
- package/package.json +13 -14
package/README.md
CHANGED
|
@@ -50,6 +50,48 @@ const { open, isReady, isOpen } = useFeedValue();
|
|
|
50
50
|
</template>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### Headless Mode
|
|
54
|
+
|
|
55
|
+
For complete UI control, use headless mode. The SDK fetches config and provides all API methods but renders no DOM elements:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// main.ts
|
|
59
|
+
app.use(createFeedValue({
|
|
60
|
+
widgetId: 'your-widget-id',
|
|
61
|
+
headless: true, // No trigger button or modal rendered
|
|
62
|
+
}));
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<script setup>
|
|
67
|
+
import { ref } from 'vue';
|
|
68
|
+
import { useFeedValue } from '@feedvalue/vue';
|
|
69
|
+
|
|
70
|
+
const { isReady, isOpen, open, close, submit, isSubmitting, isHeadless } = useFeedValue();
|
|
71
|
+
const message = ref('');
|
|
72
|
+
|
|
73
|
+
async function handleSubmit() {
|
|
74
|
+
await submit({ message: message.value });
|
|
75
|
+
message.value = '';
|
|
76
|
+
close();
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<button @click="open" :disabled="!isReady">
|
|
82
|
+
Feedback
|
|
83
|
+
</button>
|
|
84
|
+
|
|
85
|
+
<div v-if="isOpen" class="my-modal">
|
|
86
|
+
<textarea v-model="message" placeholder="Your feedback..." />
|
|
87
|
+
<button @click="handleSubmit" :disabled="isSubmitting">
|
|
88
|
+
{{ isSubmitting ? 'Sending...' : 'Submit' }}
|
|
89
|
+
</button>
|
|
90
|
+
<button @click="close">Cancel</button>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
```
|
|
94
|
+
|
|
53
95
|
### Standalone Usage (No Plugin)
|
|
54
96
|
|
|
55
97
|
```vue
|
|
@@ -101,6 +143,8 @@ async function handleSubmit() {
|
|
|
101
143
|
|
|
102
144
|
### User Identification
|
|
103
145
|
|
|
146
|
+
User data is automatically included with feedback submissions:
|
|
147
|
+
|
|
104
148
|
```vue
|
|
105
149
|
<script setup>
|
|
106
150
|
import { watch } from 'vue';
|
|
@@ -149,11 +193,12 @@ export default {
|
|
|
149
193
|
|
|
150
194
|
Creates a Vue plugin for FeedValue.
|
|
151
195
|
|
|
152
|
-
| Option | Type | Required | Description |
|
|
153
|
-
|
|
154
|
-
| `widgetId` | `string` | Yes | Widget ID from FeedValue dashboard |
|
|
155
|
-
| `apiBaseUrl` | `string` | No | Custom API URL (for self-hosted) |
|
|
156
|
-
| `config` | `Partial<FeedValueConfig>` | No | Configuration overrides |
|
|
196
|
+
| Option | Type | Required | Default | Description |
|
|
197
|
+
|--------|------|----------|---------|-------------|
|
|
198
|
+
| `widgetId` | `string` | Yes | - | Widget ID from FeedValue dashboard |
|
|
199
|
+
| `apiBaseUrl` | `string` | No | Production URL | Custom API URL (for self-hosted) |
|
|
200
|
+
| `config` | `Partial<FeedValueConfig>` | No | - | Configuration overrides |
|
|
201
|
+
| `headless` | `boolean` | No | `false` | Disable all DOM rendering |
|
|
157
202
|
|
|
158
203
|
### `useFeedValue(widgetId?, config?)`
|
|
159
204
|
|
|
@@ -176,6 +221,7 @@ Composable to access FeedValue functionality.
|
|
|
176
221
|
| `isVisible` | `Readonly<Ref<boolean>>` | Trigger is visible |
|
|
177
222
|
| `error` | `Readonly<Ref<Error \| null>>` | Current error |
|
|
178
223
|
| `isSubmitting` | `Readonly<Ref<boolean>>` | Submission in progress |
|
|
224
|
+
| `isHeadless` | `Readonly<Ref<boolean>>` | Running in headless mode |
|
|
179
225
|
| `open` | `() => void` | Open modal |
|
|
180
226
|
| `close` | `() => void` | Close modal |
|
|
181
227
|
| `toggle` | `() => void` | Toggle modal |
|
|
@@ -216,6 +262,18 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
216
262
|
});
|
|
217
263
|
```
|
|
218
264
|
|
|
265
|
+
For headless mode in Nuxt:
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
// plugins/feedvalue.client.ts
|
|
269
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
270
|
+
nuxtApp.vueApp.use(createFeedValue({
|
|
271
|
+
widgetId: 'your-widget-id',
|
|
272
|
+
headless: true, // Build your own UI
|
|
273
|
+
}));
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
219
277
|
The `.client.ts` suffix ensures the plugin only runs on the client side.
|
|
220
278
|
|
|
221
279
|
## SSR Support
|
|
@@ -239,6 +297,18 @@ const { isReady } = useFeedValue();
|
|
|
239
297
|
</template>
|
|
240
298
|
```
|
|
241
299
|
|
|
300
|
+
## Default vs Headless Mode
|
|
301
|
+
|
|
302
|
+
| Feature | Default Mode | Headless Mode |
|
|
303
|
+
|---------|--------------|---------------|
|
|
304
|
+
| Trigger button | Dashboard-styled | You build it |
|
|
305
|
+
| Modal | Dashboard-styled | You build it |
|
|
306
|
+
| API methods | Available | Available |
|
|
307
|
+
| User tracking | Available | Available |
|
|
308
|
+
| Dashboard config | Fetched | Fetched |
|
|
309
|
+
|
|
310
|
+
Use `headless: true` when you want complete control over the UI.
|
|
311
|
+
|
|
242
312
|
## Requirements
|
|
243
313
|
|
|
244
314
|
- Vue 3.3.0 or higher
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedvalue/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "FeedValue Vue 3 SDK - Plugin and Composables for Vue 3+",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,17 +23,26 @@
|
|
|
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
|
+
},
|
|
26
36
|
"peerDependencies": {
|
|
27
37
|
"vue": ">=3.3.0"
|
|
28
38
|
},
|
|
29
39
|
"dependencies": {
|
|
30
|
-
"@feedvalue/core": "
|
|
40
|
+
"@feedvalue/core": "workspace:^"
|
|
31
41
|
},
|
|
32
42
|
"devDependencies": {
|
|
33
43
|
"@vitejs/plugin-vue": "^5.2.0",
|
|
34
44
|
"@vitest/coverage-v8": "^2.1.0",
|
|
35
45
|
"@vue/test-utils": "^2.4.0",
|
|
36
|
-
"eslint": "^9.17.0",
|
|
37
46
|
"happy-dom": "^15.11.0",
|
|
38
47
|
"tsup": "^8.3.0",
|
|
39
48
|
"typescript": "^5.7.0",
|
|
@@ -65,15 +74,5 @@
|
|
|
65
74
|
],
|
|
66
75
|
"engines": {
|
|
67
76
|
"node": ">=18"
|
|
68
|
-
},
|
|
69
|
-
"scripts": {
|
|
70
|
-
"build": "tsup",
|
|
71
|
-
"dev": "tsup --watch",
|
|
72
|
-
"lint": "eslint src --ext .ts",
|
|
73
|
-
"test": "vitest run",
|
|
74
|
-
"test:watch": "vitest",
|
|
75
|
-
"test:coverage": "vitest run --coverage",
|
|
76
|
-
"typecheck": "tsc --noEmit",
|
|
77
|
-
"clean": "rm -rf dist"
|
|
78
77
|
}
|
|
79
|
-
}
|
|
78
|
+
}
|