@feedbackfun/js 0.2.0 β†’ 0.2.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 CHANGED
@@ -1,126 +1,62 @@
1
- # @feedbackfun/js
1
+ # 🎯 feedbackfun JS
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@feedbackfun/js.svg)](https://www.npmjs.com/package/@feedbackfun/js)
4
+ [![npm downloads](https://img.shields.io/npm/dw/@feedbackfun/js.svg)](https://www.npmjs.com/package/@feedbackfun/js)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@feedbackfun/js)](https://bundlephobia.com/package/@feedbackfun/js)
2
7
 
3
8
  Complete customer feedback ecosystem - capture feature requests, bug reports, manage product roadmaps, and provide real-time chat support, all in one embeddable widget.
4
9
 
5
10
  ## Installation
6
11
 
7
- ### NPM Package
8
-
9
12
  ```bash
10
13
  npm install @feedbackfun/js
11
14
  ```
12
15
 
13
- ### CDN (Script Tag)
16
+ ## Features
14
17
 
15
- ```html
16
- <script src="https://cdn.feedbackfun.com/feedbackfun-widget.min.js"
17
- data-feedbackfun-api-key="your-api-key"
18
- data-feedbackfun-project-id="your-project-id">
19
- </script>
20
- ```
18
+ - πŸš€ **Feature Requests** - Collect and prioritize product ideas from your users
19
+ - πŸ› **Bug Reporting** - Visual bug reports with automatic screenshot capture and context
20
+ - πŸ—ΊοΈ **Product Roadmap** - Interactive roadmap with voting and status tracking
21
+ - πŸ’¬ **Real-time Chat Support** - Instant messaging between users and your support team
22
+ - πŸ‘€ **User Authentication** - Associate feedback with authenticated users for better context
23
+ - 🎯 **Click-anywhere Feedback** - Pin feedback to any element on your website
24
+ - 🎨 **Customizable Branding** - Match your brand with custom colors and themes
25
+ - πŸŒ™ **Dark Mode Support** - Automatic dark/light theme detection
26
+ - πŸ“¦ **Zero Configuration** - Widget settings managed via dashboard
27
+ - πŸ”’ **TypeScript Support** - Full TypeScript definitions included
21
28
 
22
29
  ## Quick Start
23
30
 
24
- ### NPM Usage
25
-
26
- ```typescript
27
- import feedbackfun from '@feedbackfun/js';
28
-
29
- // Initialize widget (config is fetched from your dashboard)
30
- await feedbackfun.init({
31
- apiKey: 'your-api-key',
32
- projectId: 'your-project-id'
33
- });
34
- ```
35
-
36
- ### React
37
-
38
- ```typescript
39
- import feedbackfun from '@feedbackfun/js';
40
- import { useEffect } from 'react';
41
-
42
- function App() {
43
- useEffect(() => {
44
- feedbackfun.init({
45
- apiKey: process.env.REACT_APP_FEEDBACKFUN_KEY!,
46
- projectId: process.env.REACT_APP_FEEDBACKFUN_PROJECT_ID!
47
- });
31
+ 1. **Install the package**
48
32
 
49
- return () => feedbackfun.destroy();
50
- }, []);
51
-
52
- return <div>Your App</div>;
53
- }
33
+ ```bash
34
+ npm install @feedbackfun/js
54
35
  ```
55
36
 
56
- ### Next.js
37
+ 2. **Initialize the widget**
57
38
 
58
39
  ```typescript
59
- 'use client';
60
- import feedbackfun from '@feedbackfun/js';
61
- import { useEffect } from 'react';
62
-
63
- export default function Layout({ children }) {
64
- useEffect(() => {
65
- feedbackfun.init({
66
- apiKey: process.env.NEXT_PUBLIC_FEEDBACKFUN_KEY!,
67
- projectId: process.env.NEXT_PUBLIC_FEEDBACKFUN_PROJECT_ID!
68
- });
69
-
70
- return () => feedbackfun.destroy();
71
- }, []);
72
-
73
- return <>{children}</>;
74
- }
75
- ```
76
-
77
- ### Vue.js
78
-
79
- ```vue
80
- <script setup>
81
- import { onMounted, onUnmounted } from 'vue';
82
40
  import feedbackfun from '@feedbackfun/js';
83
41
 
84
- onMounted(() => {
85
- feedbackfun.init({
86
- apiKey: import.meta.env.VITE_FEEDBACKFUN_KEY,
87
- projectId: import.meta.env.VITE_FEEDBACKFUN_PROJECT_ID
88
- });
89
- });
90
-
91
- onUnmounted(() => {
92
- feedbackfun.destroy();
93
- });
94
- </script>
95
- ```
96
-
97
- ### Vanilla JavaScript
98
-
99
- ```javascript
100
- import feedbackfun from '@feedbackfun/js';
101
-
102
- feedbackfun.init({
42
+ // Initialize widget (config is fetched from your dashboard)
43
+ await feedbackfun.init({
103
44
  apiKey: 'your-api-key',
104
45
  projectId: 'your-project-id'
105
46
  });
106
-
107
- // Later, when cleaning up
108
- feedbackfun.destroy();
109
47
  ```
110
48
 
111
- ## API Reference
112
-
113
- ### `init(config)`
49
+ ## Configuration (InitConfig)
114
50
 
115
- Initialize the FeedbackFun widget. Widget configuration (colors, display mode, branding, etc.) is automatically fetched from your FeedbackFun dashboard.
51
+ All widget configuration (colors, display mode, trigger selectors, branding, etc.) is managed via the FeedbackFun dashboard at [feedbackfun.com](https://feedbackfun.com). The `init()` method only requires API credentials.
116
52
 
117
- **Parameters:**
118
- - `config.apiKey` (string, required): Your FeedbackFun API key
119
- - `config.projectId` (string, required): Your project ID
120
-
121
- **Returns:** `Promise<FeedbackfunWidget>` - The widget instance
53
+ | Option | Type | Required | Description |
54
+ |--------|------|----------|-------------|
55
+ | `apiKey` | `string` | Yes | Your FeedbackFun API key from the dashboard |
56
+ | `projectId` | `string` | Yes | Your project ID from the dashboard |
122
57
 
123
58
  **Example:**
59
+
124
60
  ```typescript
125
61
  await feedbackfun.init({
126
62
  apiKey: 'your-api-key',
@@ -128,114 +64,71 @@ await feedbackfun.init({
128
64
  });
129
65
  ```
130
66
 
131
- ### `destroy()`
67
+ ## API (FeedbackfunWidget)
132
68
 
133
- Cleanup and destroy the widget instance. Important for single-page applications to prevent memory leaks.
69
+ | Method | Description |
70
+ |--------|-------------|
71
+ | `init(config)` | Initialize the widget with API credentials. Returns `Promise<FeedbackfunWidget>` |
72
+ | `destroy()` | Cleanup and destroy the widget instance. Important for SPAs to prevent memory leaks |
73
+ | `getInstance()` | Get the current widget instance. Returns `FeedbackfunWidget \| null` |
74
+ | `setUserInfo(user)` | Set authenticated user information to associate feedback with specific users |
75
+ | `clearUserInfo()` | Clear user information (useful for logout scenarios) |
76
+ | `setPrimaryColor(color)` | Runtime override of the primary theme color configured in dashboard |
77
+ | `setPrimaryForeground(color)` | Runtime override of the primary foreground color configured in dashboard |
134
78
 
135
- **Example:**
136
- ```typescript
137
- feedbackfun.destroy();
138
- ```
79
+ ### Method Details
139
80
 
140
- ### `getInstance()`
81
+ #### `setUserInfo(user)`
141
82
 
142
- Get the current widget instance.
83
+ Set authenticated user information to associate feedback with specific users. You can pass any custom data fields beyond the standard ones.
143
84
 
144
- **Returns:** `FeedbackfunWidget | null`
85
+ **Standard Parameters:**
145
86
 
146
- **Example:**
147
- ```typescript
148
- const widget = feedbackfun.getInstance();
149
- ```
150
-
151
- ### `setUserInfo(user)`
87
+ | Parameter | Type | Required | Description |
88
+ |-----------|------|----------|-------------|
89
+ | `user.id` | `string` | Yes | User's unique identifier |
90
+ | `user.name` | `string` | No | User's display name |
91
+ | `user.email` | `string` | No | User's email address |
152
92
 
153
- Set authenticated user information to associate feedback with specific users.
93
+ **Custom Fields:**
154
94
 
155
- **Parameters:**
156
- - `user.id` (string, required): User's unique identifier
157
- - `user.name` (string, optional): User's display name
158
- - `user.email` (string, optional): User's email address
159
- - `user.avatar` (string, optional): URL to user's avatar image
95
+ You can pass any additional custom data as needed (e.g., `avatar`, `role`, `plan`, `company`, etc.). All custom fields will be stored and associated with the user's feedback.
160
96
 
161
97
  **Example:**
98
+
162
99
  ```typescript
163
100
  feedbackfun.setUserInfo({
164
101
  id: 'user-123',
165
102
  name: 'John Doe',
166
103
  email: 'john@example.com',
167
- avatar: 'https://example.com/avatar.jpg'
104
+ // Custom fields - pass any data you want
105
+ avatar: 'https://example.com/avatar.jpg',
106
+ role: 'admin',
107
+ plan: 'premium',
108
+ company: 'Acme Inc'
168
109
  });
169
110
  ```
170
111
 
171
- ### `clearUserInfo()`
172
-
173
- Clear user information (useful for logout scenarios).
174
-
175
- **Example:**
176
- ```typescript
177
- feedbackfun.clearUserInfo();
178
- ```
179
-
180
- ### `setPrimaryColor(color)`
112
+ #### `setPrimaryColor(color)`
181
113
 
182
114
  Runtime override of the primary theme color configured in your dashboard.
183
115
 
184
- **Parameters:**
185
- - `color` (string): CSS color value (hex, rgb, etc.)
186
-
187
116
  **Example:**
117
+
188
118
  ```typescript
189
119
  feedbackfun.setPrimaryColor('#3b82f6');
190
120
  ```
191
121
 
192
- ### `setPrimaryForeground(color)`
122
+ #### `setPrimaryForeground(color)`
193
123
 
194
124
  Runtime override of the primary foreground color configured in your dashboard.
195
125
 
196
- **Parameters:**
197
- - `color` (string): CSS color value (hex, rgb, etc.)
198
-
199
126
  **Example:**
200
- ```typescript
201
- feedbackfun.setPrimaryForeground('#ffffff');
202
- ```
203
-
204
- ## Configuration
205
-
206
- All widget configuration (colors, display mode, trigger selectors, branding, etc.) is managed via the FeedbackFun dashboard. Simply log in to [feedbackfun.com](https://feedbackfun.com), navigate to your project settings, and configure the widget appearance and behavior.
207
-
208
- No configuration needed in code!
209
-
210
- ## Features
211
-
212
- - **Feature Requests**: Collect and prioritize product ideas from your users
213
- - **Bug Reporting**: Visual bug reports with automatic screenshot capture and context
214
- - **Product Roadmap**: Interactive roadmap with voting and status tracking
215
- - **Real-time Chat Support**: Instant messaging between users and your support team
216
- - **User Authentication**: Associate feedback with authenticated users for better context
217
- - **Click-anywhere feedback**: Pin feedback to any element on your website
218
- - **Customizable Branding**: Match your brand with custom colors and themes
219
- - **Dark Mode Support**: Automatic dark/light theme detection
220
-
221
- ## TypeScript Support
222
-
223
- Full TypeScript definitions included. Import types if needed:
224
127
 
225
128
  ```typescript
226
- import feedbackfun from '@feedbackfun/js';
227
-
228
- // All methods are fully typed
229
- await feedbackfun.init({ apiKey: '...', projectId: '...' });
129
+ feedbackfun.setPrimaryForeground('#ffffff');
230
130
  ```
231
131
 
232
- ## Browser Support
233
-
234
- - Chrome (last 2 versions)
235
- - Firefox (last 2 versions)
236
- - Safari (last 2 versions)
237
- - Edge (last 2 versions)
238
-
239
132
  ## License
240
133
 
241
134
  MIT