@mushi-mushi/web 1.28.0 → 1.29.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/README.md +35 -6
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +2 -2
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js.map +1 -1
- package/dist/i18n/index.cjs +4 -4
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +4 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +145 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +146 -28
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +410 -398
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js.map +1 -1
- package/package.json +74 -32
- package/CODE_OF_CONDUCT.md +0 -51
- package/CONTRIBUTING.md +0 -226
- package/SECURITY.md +0 -359
- package/dist/mushi.loader.global.js.map +0 -1
package/README.md
CHANGED
|
@@ -127,20 +127,30 @@ The details step renders the attached screenshot as a visible preview (not just
|
|
|
127
127
|
<details>
|
|
128
128
|
<summary><b>Session replay</b> — opt-in rolling buffer attached on submit</summary>
|
|
129
129
|
|
|
130
|
+
```bash
|
|
131
|
+
npm install rrweb # only for replay: 'rrweb' — your app installs it
|
|
132
|
+
```
|
|
133
|
+
|
|
130
134
|
```typescript
|
|
131
135
|
Mushi.init({
|
|
132
136
|
projectId: 'proj_xxx',
|
|
133
137
|
apiKey: 'mushi_xxx',
|
|
134
138
|
capture: {
|
|
135
|
-
// 'rrweb' — full DOM replay (
|
|
136
|
-
// 'lite' — dependency-free
|
|
139
|
+
// 'rrweb' — full DOM replay (every text node and input masked)
|
|
140
|
+
// 'lite' — dependency-free, records clicks only
|
|
137
141
|
// 'sentry'— reuse an installed @sentry/replay session
|
|
138
142
|
// 'off' — default
|
|
139
143
|
replay: 'rrweb',
|
|
144
|
+
// Hand the SDK your own import of rrweb.
|
|
145
|
+
rrweb: () => import('rrweb'),
|
|
140
146
|
},
|
|
141
147
|
});
|
|
142
148
|
```
|
|
143
149
|
|
|
150
|
+
`replay: 'rrweb'` needs `rrweb` in your app (`npm install rrweb`). It is an optional peer dependency, so apps that don't record replay don't download it.
|
|
151
|
+
|
|
152
|
+
`rrweb: () => import('rrweb')` is what makes `'rrweb'` mode work in a bundled app. The SDK cannot import rrweb itself: a published package's `import('rrweb')` is invisible to your bundler, so rrweb never reaches your build. An import written in your code is one your bundler sees, and it code-splits rrweb into its own chunk that loads only for sessions sampled into replay. Without the loader the SDK tries a global `rrweb` (the UMD build from a `<script>` tag), then a bare `import('rrweb')` (which resolves only under an import map); if neither works, it records clicks only (`'lite'`) and warns once in the console. The `rrweb` option ships in `@mushi-mushi/web` 1.29.
|
|
153
|
+
|
|
144
154
|
Records continuously from init (so you capture the moments *before* the report), trimmed to a rolling window. Already on Sentry Replay? See [coexistence](https://kensaur.us/mushi-mushi/docs/sdks/sentry-replay-coexistence).
|
|
145
155
|
</details>
|
|
146
156
|
|
|
@@ -152,13 +162,13 @@ const mushi = Mushi.init({ projectId: 'proj_xxx', apiKey: 'mushi_xxx' });
|
|
|
152
162
|
|
|
153
163
|
mushi.identify('usr_42', { email: 'aya@example.com', segment: 'beta' });
|
|
154
164
|
mushi.setTags({ plan: 'pro', region: 'apac' });
|
|
155
|
-
mushi.addBreadcrumb({ category: '
|
|
165
|
+
mushi.addBreadcrumb({ category: 'custom', level: 'info', message: 'cart.checkout_started', data: { itemCount: 3 } });
|
|
156
166
|
|
|
157
167
|
try {
|
|
158
168
|
await runCheckout();
|
|
159
169
|
} catch (err) {
|
|
160
170
|
// Normalises any throw, attaches breadcrumbs + sticky tags + Sentry context.
|
|
161
|
-
mushi.captureException(err, {
|
|
171
|
+
mushi.captureException(err, { severity: 'high', tags: { surface: 'checkout' } });
|
|
162
172
|
}
|
|
163
173
|
```
|
|
164
174
|
|
|
@@ -171,6 +181,25 @@ try {
|
|
|
171
181
|
The widget's "Your reports" tab lets reporters see team replies and respond, signed via HMAC against the public API key (no auth user required): `mushi.listMyReports()`, `mushi.listMyComments(id)`, `mushi.replyToReport(id, text)`. Call `mushi.identify()` and add a `rewards` block to track activity, tiers, and points. See [Rewards & contributor identity](https://kensaur.us/mushi-mushi/docs/concepts/rewards).
|
|
172
182
|
</details>
|
|
173
183
|
|
|
184
|
+
<details>
|
|
185
|
+
<summary><b>Product analytics</b> — <code>track()</code>, funnels, paths and people in the same console</summary>
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const mushi = Mushi.init({
|
|
189
|
+
projectId: 'proj_xxx',
|
|
190
|
+
apiKey: 'mushi_xxx',
|
|
191
|
+
// Optional. Defaults: enabled, consent 'implied', DNT/GPC respected, sampleRate 1.
|
|
192
|
+
analytics: { consent: 'required' },
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
mushi.setConsent('granted'); // only needed with consent: 'required'
|
|
196
|
+
mushi.track('checkout_started', { plan: 'pro' }); // snake_case names, flat properties
|
|
197
|
+
mushi.identify('usr_42'); // stitches earlier anonymous events to the person
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Events batch to `POST /v1/sdk/events` (20 per batch or every 5 s, flushed on `pagehide`, spilled to `localStorage` when offline). Names must match `^[a-z][a-z0-9_]{1,63}$`; properties are flat `string | number | boolean | null`, PII-looking keys (`email`, `phone`, `token`, …) are dropped, and string values run through the PII scrubber. `analytics.enabled: false` turns it off; `navigator.doNotTrack` / Global Privacy Control are honoured by default. The console's **Users & Funnels** page reads the same events; retention defaults to 90 days per project.
|
|
201
|
+
</details>
|
|
202
|
+
|
|
174
203
|
<details>
|
|
175
204
|
<summary><b>Runtime control & self-noise filters</b> — imperative APIs and CSP-safe defaults</summary>
|
|
176
205
|
|
|
@@ -285,7 +314,7 @@ Screenshot capture uses canvas / SVG `foreignObject` serialization — it does n
|
|
|
285
314
|
|
|
286
315
|
## Bundle size
|
|
287
316
|
|
|
288
|
-
~7 KB brotli, enforced at 89 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget's visual system — washi paper, sumi ink, vermillion 朱 accent, system serif — lives in [`src/styles.ts`](./src/styles.ts).
|
|
317
|
+
~7 KB brotli, enforced at 89.5 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget's visual system — washi paper, sumi ink, vermillion 朱 accent, system serif — lives in [`src/styles.ts`](./src/styles.ts).
|
|
289
318
|
|
|
290
319
|
## License
|
|
291
320
|
|
|
@@ -294,4 +323,4 @@ MIT
|
|
|
294
323
|
<!-- mushi-readme-stats-footer -->
|
|
295
324
|
---
|
|
296
325
|
|
|
297
|
-
<sub>Monorepo scale (July 2026):
|
|
326
|
+
<sub>Monorepo scale (July 2026): 59 edge functions · 374 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
|