@usero/sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/react.cjs +1137 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +72 -0
- package/dist/react.d.ts +72 -0
- package/dist/react.js +1132 -0
- package/dist/react.js.map +1 -0
- package/dist/usero.iife.js +471 -0
- package/dist/usero.iife.js.map +1 -0
- package/dist/vanilla.cjs +1071 -0
- package/dist/vanilla.cjs.map +1 -0
- package/dist/vanilla.d.cts +71 -0
- package/dist/vanilla.d.ts +71 -0
- package/dist/vanilla.js +1066 -0
- package/dist/vanilla.js.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Will Smith
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# usero
|
|
2
|
+
|
|
3
|
+
Lightweight feedback widget for the web. Drop-in vanilla JS, React component, or `<script>` tag. Zero config, framework-free, tiny.
|
|
4
|
+
|
|
5
|
+
Backed by [Usero](https://usero.io). Sign up to get a `clientId`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @usero/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Vanilla JS (any framework, or none)
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { initUseroFeedbackWidget } from '@usero/sdk'
|
|
19
|
+
|
|
20
|
+
const widget = initUseroFeedbackWidget({
|
|
21
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
22
|
+
position: 'right',
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// later, if you need to remove it:
|
|
26
|
+
widget.destroy()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The vanilla build never imports React. Vue, Svelte, Angular, plain HTML, and Electron apps pay zero React tax.
|
|
30
|
+
|
|
31
|
+
### React
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { UseroFeedbackWidget } from '@usero/sdk/react'
|
|
35
|
+
|
|
36
|
+
export function App() {
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
{/* your app */}
|
|
40
|
+
<UseroFeedbackWidget clientId='YOUR_CLIENT_ID' />
|
|
41
|
+
</>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Screenshot upload
|
|
47
|
+
|
|
48
|
+
The widget includes a screenshot upload button by default. Users can attach up to 3 images (max 10MB each, any `image/*` MIME type) to their feedback. Uploads go to `${baseUrl}/api/screenshots` and the resulting URLs are attached to the feedback submission. Disable with `showScreenshotOption: false`.
|
|
49
|
+
|
|
50
|
+
### Script tag (CDN)
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<script src="https://unpkg.com/@usero/sdk"></script>
|
|
54
|
+
<script>
|
|
55
|
+
Usero.initUseroFeedbackWidget({ clientId: 'YOUR_CLIENT_ID' })
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`unpkg` and `jsDelivr` both serve the IIFE bundle automatically. No separate hosting needed.
|
|
60
|
+
|
|
61
|
+
## Options
|
|
62
|
+
|
|
63
|
+
| Option | Type | Default | Description |
|
|
64
|
+
| ---------------------- | ----------------------------- | --------------------------------------------- | ------------------------------------------ |
|
|
65
|
+
| `clientId` | `string` | required | Your Usero client ID |
|
|
66
|
+
| `position` | `'left' \| 'right'` | `'right'` | Which side of the viewport the tab sits on |
|
|
67
|
+
| `theme` | `Partial<WidgetTheme>` | light theme | Override colors |
|
|
68
|
+
| `title` | `string` | `'Share Feedback'` | Panel header |
|
|
69
|
+
| `placeholder` | `string` | `'Tell us what you think... (optional)'` | Comment placeholder |
|
|
70
|
+
| `showEmailOption` | `boolean` | `true` | Show the "share my email" checkbox |
|
|
71
|
+
| `showScreenshotOption` | `boolean` | `true` | Show the screenshot upload button (up to 3 images, 10MB each) |
|
|
72
|
+
| `environment` | `string` | undefined | Tag feedback with an environment |
|
|
73
|
+
| `baseUrl` | `string` | `'https://usero.io'` | Override API host (self-hosted Usero) |
|
|
74
|
+
| `metadata` | `Record<string, unknown>` | undefined | Arbitrary metadata attached to feedback |
|
|
75
|
+
| `onSubmit` | `(data) => void` | undefined | Fires after a successful submission |
|
|
76
|
+
| `onError` | `(err: Error) => void` | undefined | Fires on init or submission error |
|
|
77
|
+
| `onOpen` / `onClose` | `() => void` | undefined | Fire when the panel opens/closes |
|
|
78
|
+
|
|
79
|
+
## Why named exports only
|
|
80
|
+
|
|
81
|
+
Default exports break tree-shaking and rename inconsistently across consumer codebases. The package exports nothing as a default, anywhere, on purpose.
|
|
82
|
+
|
|
83
|
+
## Why subpath exports
|
|
84
|
+
|
|
85
|
+
Bundlers can tree-shake well, but `@usero/sdk/react` vs `@usero/sdk` is a guarantee, not a hope. Vanilla users never pull React into their bundle.
|
|
86
|
+
|
|
87
|
+
## Building from source
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install
|
|
91
|
+
npm run build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Outputs:
|
|
95
|
+
|
|
96
|
+
- `dist/vanilla.js` (ESM) + `dist/vanilla.cjs` + `dist/vanilla.d.ts`
|
|
97
|
+
- `dist/react.js` (ESM) + `dist/react.cjs` + `dist/react.d.ts`
|
|
98
|
+
- `dist/usero.iife.js` (minified, exposes `window.Usero`)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|