@mushi-mushi/web 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 +71 -0
- package/dist/index.cjs +1576 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +142 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +1564 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenji Sakuramoto
|
|
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,71 @@
|
|
|
1
|
+
# @mushi-mushi/web
|
|
2
|
+
|
|
3
|
+
Browser SDK for Mushi Mushi — embeddable bug reporting widget with Shadow DOM isolation.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Shadow DOM widget with full CSS isolation from host page
|
|
8
|
+
- Console log capture (ring buffer)
|
|
9
|
+
- Network request capture (fetch interceptor)
|
|
10
|
+
- Screenshot capture (canvas-based)
|
|
11
|
+
- Web Vitals / performance metrics
|
|
12
|
+
- IndexedDB offline queue with auto-sync
|
|
13
|
+
- On-device pre-filter (blocks spam before server submission)
|
|
14
|
+
- Client-side rate limiting (token bucket self-throttle)
|
|
15
|
+
- Light/dark theme with auto-detection
|
|
16
|
+
- **Proactive triggers** — rage click, long task, API cascade failure detection
|
|
17
|
+
- **Report fatigue prevention** — session limits, cooldowns, permanent suppression
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
### Proactive Manager (`proactive-manager.ts`)
|
|
22
|
+
|
|
23
|
+
Controls report prompt frequency to prevent fatigue:
|
|
24
|
+
- `maxProactivePerSession` (default 2) — cap per browser session
|
|
25
|
+
- `dismissCooldownHours` (default 24) — suppress after dismissal
|
|
26
|
+
- `suppressAfterDismissals` (default 3) — permanently disable after N consecutive dismissals
|
|
27
|
+
- Smart dedup — same trigger type not shown twice per session
|
|
28
|
+
|
|
29
|
+
### Proactive Triggers (`proactive-triggers.ts`)
|
|
30
|
+
|
|
31
|
+
Auto-detects conditions that should prompt the user:
|
|
32
|
+
- **Rage click** — 3+ clicks in < 500ms on same element
|
|
33
|
+
- **Long task** — > 5s main thread block (PerformanceObserver)
|
|
34
|
+
- **API cascade** — 3+ failed requests in 10s window
|
|
35
|
+
|
|
36
|
+
## Bundle Size
|
|
37
|
+
|
|
38
|
+
~6 KB brotli (limit: 30 KB). Requires `@mushi-mushi/core` as a dependency (not bundled inline).
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Mushi } from '@mushi-mushi/web';
|
|
44
|
+
|
|
45
|
+
Mushi.init({
|
|
46
|
+
projectId: 'proj_xxx',
|
|
47
|
+
apiKey: 'your-api-key',
|
|
48
|
+
widget: { position: 'bottom-right', theme: 'auto' },
|
|
49
|
+
capture: { console: true, network: true, screenshot: 'on-report' },
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### With Proactive Triggers
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { createProactiveManager, setupProactiveTriggers } from '@mushi-mushi/web';
|
|
57
|
+
|
|
58
|
+
const manager = createProactiveManager({ maxProactivePerSession: 2 });
|
|
59
|
+
|
|
60
|
+
setupProactiveTriggers({
|
|
61
|
+
onTrigger: (type, context) => {
|
|
62
|
+
if (manager.shouldShow(type)) {
|
|
63
|
+
// Open widget with pre-filled context
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|