@product7/feedback-sdk 1.0.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 +227 -0
- package/dist/README.md +227 -0
- package/dist/feedback-sdk.js +2483 -0
- package/dist/feedback-sdk.js.map +1 -0
- package/dist/feedback-sdk.min.js +2 -0
- package/dist/feedback-sdk.min.js.map +1 -0
- package/package.json +111 -0
- package/src/core/APIService.js +338 -0
- package/src/core/EventBus.js +54 -0
- package/src/core/FeedbackSDK.js +285 -0
- package/src/docs/api.md +686 -0
- package/src/docs/example.md +823 -0
- package/src/docs/installation.md +264 -0
- package/src/index.js +281 -0
- package/src/styles/styles.js +557 -0
- package/src/types/index.d.ts +12 -0
- package/src/utils/errors.js +142 -0
- package/src/utils/helpers.js +219 -0
- package/src/widgets/BaseWidget.js +334 -0
- package/src/widgets/ButtonWidget.js +62 -0
- package/src/widgets/InlineWidget.js +145 -0
- package/src/widgets/TabWidget.js +65 -0
- package/src/widgets/WidgetFactory.js +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Feedback Widget SDK
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40product7%2Ffeedback-sdk)
|
|
4
|
+
[](https://bundlephobia.com/package/@product7/feedback-sdk)
|
|
5
|
+
|
|
6
|
+
A lightweight, customizable JavaScript SDK for collecting user feedback on any website. Built for the Product7 feedback platform.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Multiple widget types — Button, Tab, and Inline widgets
|
|
13
|
+
- Theme support — Light and dark themes with custom CSS properties
|
|
14
|
+
- Responsive design — Works on desktop, tablet, and mobile
|
|
15
|
+
- Easy integration — Simple JavaScript API, minimal setup
|
|
16
|
+
- Lightweight — < 25KB minified and gzipped
|
|
17
|
+
- TypeScript support — Full type definitions included
|
|
18
|
+
- Accessible — WCAG 2.1 compliant
|
|
19
|
+
- Secure — CSP friendly, no `eval()` usage
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### CDN Installation (Recommended)
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/@product7/feedback-sdk@1/dist/feedback-sdk.min.js"></script>
|
|
29
|
+
<script>
|
|
30
|
+
const feedback = new FeedbackSDK({
|
|
31
|
+
workspace: 'your-workspace-name',
|
|
32
|
+
boardId: 'your-board-id',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
feedback.init().then(() => {
|
|
36
|
+
const widget = feedback.createWidget('button');
|
|
37
|
+
widget.mount();
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### NPM Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @product7/feedback-sdk
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import { FeedbackSDK } from '@product7/feedback-sdk';
|
|
50
|
+
|
|
51
|
+
const feedback = new FeedbackSDK({
|
|
52
|
+
workspace: 'your-workspace-name',
|
|
53
|
+
boardId: 'your-board-id',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await feedback.init();
|
|
57
|
+
const widget = feedback.createWidget('button');
|
|
58
|
+
widget.mount();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Auto-Initialization
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<script>
|
|
65
|
+
window.FeedbackSDKConfig = {
|
|
66
|
+
workspace: 'your-workspace',
|
|
67
|
+
boardId: 'your-board-id',
|
|
68
|
+
autoCreate: {
|
|
69
|
+
type: 'button',
|
|
70
|
+
position: 'bottom-right',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/@product7/feedback-sdk@1/dist/feedback-sdk.min.js"></script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
- [Installation Guide](docs/installation.md)
|
|
82
|
+
- [Widget Types](docs/widgets.md)
|
|
83
|
+
- [Configuration](docs/configuration.md)
|
|
84
|
+
- [API Reference](docs/api.md)
|
|
85
|
+
- [Theming Guide](docs/theming.md)
|
|
86
|
+
- [Examples](docs/examples.md)
|
|
87
|
+
- [Migration Guide](docs/migration.md)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Widget Types
|
|
92
|
+
|
|
93
|
+
**Button Widget**
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
const button = feedback.createWidget('button', {
|
|
97
|
+
position: 'bottom-right',
|
|
98
|
+
});
|
|
99
|
+
button.mount();
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Tab Widget**
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const tab = feedback.createWidget('tab', {
|
|
106
|
+
position: 'bottom-left',
|
|
107
|
+
});
|
|
108
|
+
tab.mount();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Inline Widget**
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const inline = feedback.createWidget('inline');
|
|
115
|
+
inline.mount('#feedback-container');
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
| Option | Type | Required | Default | Description |
|
|
123
|
+
| ----------- | ------- | -------- | -------------- | -------------------------- |
|
|
124
|
+
| `workspace` | string | ✅ | - | Your workspace subdomain |
|
|
125
|
+
| `boardId` | string | ❌ | null | Target board for feedback |
|
|
126
|
+
| `apiKey` | string | ❌ | null | API key for authentication |
|
|
127
|
+
| `theme` | string | ❌ | 'light' | Theme: 'light' or 'dark' |
|
|
128
|
+
| `position` | string | ❌ | 'bottom-right' | Widget position |
|
|
129
|
+
| `debug` | boolean | ❌ | false | Enable debug logging |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Theming
|
|
134
|
+
|
|
135
|
+
```css
|
|
136
|
+
:root {
|
|
137
|
+
--feedback-primary-color: #10b981;
|
|
138
|
+
--feedback-primary-hover: #059669;
|
|
139
|
+
--feedback-font-family: 'Inter', sans-serif;
|
|
140
|
+
--feedback-border-radius: 8px;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Events
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
feedback.eventBus.on('feedback:submitted', (data) => {
|
|
150
|
+
console.log('Feedback submitted:', data);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
feedback.eventBus.on('feedback:error', (error) => {
|
|
154
|
+
console.error('Submission failed:', error);
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Development
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/product7/feedback-sdk.git
|
|
164
|
+
cd feedback-sdk
|
|
165
|
+
npm install
|
|
166
|
+
npm run dev
|
|
167
|
+
npm run build
|
|
168
|
+
npm test
|
|
169
|
+
npm run size
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Browser Support
|
|
175
|
+
|
|
176
|
+
- Chrome 60+
|
|
177
|
+
- Firefox 55+
|
|
178
|
+
- Safari 12+
|
|
179
|
+
- Edge 79+
|
|
180
|
+
- iOS Safari 12+
|
|
181
|
+
- Android Chrome 60+
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Bundle Size
|
|
186
|
+
|
|
187
|
+
- **Minified**: \~18KB
|
|
188
|
+
- **Minified + Gzipped**: \~6KB
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
We welcome contributions! See [Contributing Guide](CONTRIBUTING.md).
|
|
195
|
+
|
|
196
|
+
1. Fork the repository
|
|
197
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
198
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
199
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
200
|
+
5. Open a Pull Request
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Support
|
|
211
|
+
|
|
212
|
+
- Docs: [docs.product7.io/feedback-sdk](https://docs.product7.io/feedback-sdk)
|
|
213
|
+
- Issues: [GitHub Issues](https://github.com/product7/feedback-sdk/issues)
|
|
214
|
+
- Discord: [Join our community](https://discord.gg/product7)
|
|
215
|
+
- Email: [support@product7.io](mailto:support@product7.io)
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Related
|
|
220
|
+
|
|
221
|
+
- [Product7 Platform](https://product7.io)
|
|
222
|
+
- [Vue.js Example](https://github.com/product7/feedback-sdk-vue-example)
|
|
223
|
+
- [React Example](https://github.com/product7/feedback-sdk-react-example)
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
Made by the [Product7 Team](https://product7.io)
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Feedback Widget SDK
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40product7%2Ffeedback-sdk)
|
|
4
|
+
[](https://bundlephobia.com/package/@product7/feedback-sdk)
|
|
5
|
+
|
|
6
|
+
A lightweight, customizable JavaScript SDK for collecting user feedback on any website. Built for the Product7 feedback platform.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Multiple widget types — Button, Tab, and Inline widgets
|
|
13
|
+
- Theme support — Light and dark themes with custom CSS properties
|
|
14
|
+
- Responsive design — Works on desktop, tablet, and mobile
|
|
15
|
+
- Easy integration — Simple JavaScript API, minimal setup
|
|
16
|
+
- Lightweight — < 25KB minified and gzipped
|
|
17
|
+
- TypeScript support — Full type definitions included
|
|
18
|
+
- Accessible — WCAG 2.1 compliant
|
|
19
|
+
- Secure — CSP friendly, no `eval()` usage
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### CDN Installation (Recommended)
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/@product7/feedback-sdk@1/dist/feedback-sdk.min.js"></script>
|
|
29
|
+
<script>
|
|
30
|
+
const feedback = new FeedbackSDK({
|
|
31
|
+
workspace: 'your-workspace-name',
|
|
32
|
+
boardId: 'your-board-id',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
feedback.init().then(() => {
|
|
36
|
+
const widget = feedback.createWidget('button');
|
|
37
|
+
widget.mount();
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### NPM Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @product7/feedback-sdk
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import { FeedbackSDK } from '@product7/feedback-sdk';
|
|
50
|
+
|
|
51
|
+
const feedback = new FeedbackSDK({
|
|
52
|
+
workspace: 'your-workspace-name',
|
|
53
|
+
boardId: 'your-board-id',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await feedback.init();
|
|
57
|
+
const widget = feedback.createWidget('button');
|
|
58
|
+
widget.mount();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Auto-Initialization
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<script>
|
|
65
|
+
window.FeedbackSDKConfig = {
|
|
66
|
+
workspace: 'your-workspace',
|
|
67
|
+
boardId: 'your-board-id',
|
|
68
|
+
autoCreate: {
|
|
69
|
+
type: 'button',
|
|
70
|
+
position: 'bottom-right',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/@product7/feedback-sdk@1/dist/feedback-sdk.min.js"></script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
- [Installation Guide](docs/installation.md)
|
|
82
|
+
- [Widget Types](docs/widgets.md)
|
|
83
|
+
- [Configuration](docs/configuration.md)
|
|
84
|
+
- [API Reference](docs/api.md)
|
|
85
|
+
- [Theming Guide](docs/theming.md)
|
|
86
|
+
- [Examples](docs/examples.md)
|
|
87
|
+
- [Migration Guide](docs/migration.md)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Widget Types
|
|
92
|
+
|
|
93
|
+
**Button Widget**
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
const button = feedback.createWidget('button', {
|
|
97
|
+
position: 'bottom-right',
|
|
98
|
+
});
|
|
99
|
+
button.mount();
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Tab Widget**
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const tab = feedback.createWidget('tab', {
|
|
106
|
+
position: 'bottom-left',
|
|
107
|
+
});
|
|
108
|
+
tab.mount();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Inline Widget**
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const inline = feedback.createWidget('inline');
|
|
115
|
+
inline.mount('#feedback-container');
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
| Option | Type | Required | Default | Description |
|
|
123
|
+
| ----------- | ------- | -------- | -------------- | -------------------------- |
|
|
124
|
+
| `workspace` | string | ✅ | - | Your workspace subdomain |
|
|
125
|
+
| `boardId` | string | ❌ | null | Target board for feedback |
|
|
126
|
+
| `apiKey` | string | ❌ | null | API key for authentication |
|
|
127
|
+
| `theme` | string | ❌ | 'light' | Theme: 'light' or 'dark' |
|
|
128
|
+
| `position` | string | ❌ | 'bottom-right' | Widget position |
|
|
129
|
+
| `debug` | boolean | ❌ | false | Enable debug logging |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Theming
|
|
134
|
+
|
|
135
|
+
```css
|
|
136
|
+
:root {
|
|
137
|
+
--feedback-primary-color: #10b981;
|
|
138
|
+
--feedback-primary-hover: #059669;
|
|
139
|
+
--feedback-font-family: 'Inter', sans-serif;
|
|
140
|
+
--feedback-border-radius: 8px;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Events
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
feedback.eventBus.on('feedback:submitted', (data) => {
|
|
150
|
+
console.log('Feedback submitted:', data);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
feedback.eventBus.on('feedback:error', (error) => {
|
|
154
|
+
console.error('Submission failed:', error);
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Development
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/product7/feedback-sdk.git
|
|
164
|
+
cd feedback-sdk
|
|
165
|
+
npm install
|
|
166
|
+
npm run dev
|
|
167
|
+
npm run build
|
|
168
|
+
npm test
|
|
169
|
+
npm run size
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Browser Support
|
|
175
|
+
|
|
176
|
+
- Chrome 60+
|
|
177
|
+
- Firefox 55+
|
|
178
|
+
- Safari 12+
|
|
179
|
+
- Edge 79+
|
|
180
|
+
- iOS Safari 12+
|
|
181
|
+
- Android Chrome 60+
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Bundle Size
|
|
186
|
+
|
|
187
|
+
- **Minified**: \~18KB
|
|
188
|
+
- **Minified + Gzipped**: \~6KB
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
We welcome contributions! See [Contributing Guide](CONTRIBUTING.md).
|
|
195
|
+
|
|
196
|
+
1. Fork the repository
|
|
197
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
198
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
199
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
200
|
+
5. Open a Pull Request
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Support
|
|
211
|
+
|
|
212
|
+
- Docs: [docs.product7.io/feedback-sdk](https://docs.product7.io/feedback-sdk)
|
|
213
|
+
- Issues: [GitHub Issues](https://github.com/product7/feedback-sdk/issues)
|
|
214
|
+
- Discord: [Join our community](https://discord.gg/product7)
|
|
215
|
+
- Email: [support@product7.io](mailto:support@product7.io)
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Related
|
|
220
|
+
|
|
221
|
+
- [Product7 Platform](https://product7.io)
|
|
222
|
+
- [Vue.js Example](https://github.com/product7/feedback-sdk-vue-example)
|
|
223
|
+
- [React Example](https://github.com/product7/feedback-sdk-react-example)
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
Made by the [Product7 Team](https://product7.io)
|