@spanwise/rum 0.5.0 → 0.6.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 ADDED
@@ -0,0 +1,403 @@
1
+ # @spanwise/rum
2
+
3
+ Real User Monitoring SDK for browser applications. Captures page views, clicks, errors, Web Vitals, and session replays.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @spanwise/rum
9
+ # or
10
+ pnpm add @spanwise/rum
11
+ # or
12
+ yarn add @spanwise/rum
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { createSpanwiseBrowser } from "@spanwise/rum"
19
+
20
+ const spanwise = createSpanwiseBrowser({
21
+ apiKey: "sw_...",
22
+ serviceName: "my-app",
23
+ })
24
+
25
+ // That's it! Page views, clicks, errors, and vitals are tracked automatically.
26
+ ```
27
+
28
+ ## Configuration
29
+
30
+ ```typescript
31
+ const spanwise = createSpanwiseBrowser({
32
+ // Required
33
+ apiKey: "sw_...",
34
+
35
+ // Optional
36
+ serviceName: "my-app", // Service name for filtering
37
+ sampleRate: 1.0, // Sample 100% of sessions (default: 1.0)
38
+ trackPageViews: true, // Track page views (default: true)
39
+ trackClicks: true, // Track clicks (default: true)
40
+ trackVitals: true, // Track Web Vitals (default: true)
41
+ trackErrors: true, // Track errors (default: true)
42
+ trackResources: true, // Track fetch/XHR requests (default: true)
43
+ sessionStorage: "cookie", // "cookie" or "sessionStorage" (default: "cookie")
44
+
45
+ // Distributed Tracing
46
+ tracing: {
47
+ enabled: true, // Inject traceparent headers (default: true)
48
+ propagateToOrigins: [ // Origins to propagate trace context to
49
+ "https://api.example.com",
50
+ /\.example\.com$/,
51
+ ],
52
+ },
53
+
54
+ // Session Replay (opt-in)
55
+ replay: {
56
+ enabled: true, // Enable replay recording (default: false)
57
+ sampleRate: 0.1, // Record 10% of sessions (default: 0.1)
58
+ onErrorSampleRate: 1.0, // Record 100% of sessions with errors (default: 1.0)
59
+ privacyMode: "strict", // Privacy mode (default: "strict")
60
+ },
61
+ })
62
+ ```
63
+
64
+ ## API
65
+
66
+ ### `spanwise.trackEvent(name, properties?)`
67
+
68
+ Track a custom event.
69
+
70
+ ```typescript
71
+ spanwise.trackEvent("purchase", {
72
+ productId: "123",
73
+ amount: 99.99,
74
+ })
75
+ ```
76
+
77
+ ### `spanwise.trackPageView(url?)`
78
+
79
+ Manually track a page view. Called automatically on navigation.
80
+
81
+ ```typescript
82
+ spanwise.trackPageView("/checkout")
83
+ ```
84
+
85
+ ### `spanwise.trackError(error, options?)`
86
+
87
+ Manually track an error.
88
+
89
+ ```typescript
90
+ try {
91
+ await riskyOperation()
92
+ } catch (error) {
93
+ spanwise.trackError(error, {
94
+ requestId: "req_123",
95
+ traceId: "trace_abc",
96
+ })
97
+ }
98
+ ```
99
+
100
+ ### `spanwise.setUser(id, traits?)`
101
+
102
+ Identify the current user.
103
+
104
+ ```typescript
105
+ spanwise.setUser("user_123", {
106
+ email: "user@example.com",
107
+ plan: "pro",
108
+ })
109
+ ```
110
+
111
+ ### `spanwise.getSessionId()`
112
+
113
+ Get the current session ID.
114
+
115
+ ```typescript
116
+ const sessionId = spanwise.getSessionId()
117
+ ```
118
+
119
+ ### `spanwise.startReplay()` / `spanwise.stopReplay()`
120
+
121
+ Manually control replay recording (overrides sampling).
122
+
123
+ ```typescript
124
+ // Start recording for VIP users regardless of sample rate
125
+ if (user.isVIP) {
126
+ spanwise.startReplay()
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Session Replay
133
+
134
+ Session Replay records user interactions as a video-like playback. It captures DOM mutations, mouse movements, clicks, and scrolls.
135
+
136
+ ### Enabling Replay
137
+
138
+ ```typescript
139
+ const spanwise = createSpanwiseBrowser({
140
+ apiKey: "sw_...",
141
+ replay: {
142
+ enabled: true,
143
+ },
144
+ })
145
+ ```
146
+
147
+ ### Sampling
148
+
149
+ By default, only 10% of sessions are recorded to manage costs and storage:
150
+
151
+ ```typescript
152
+ replay: {
153
+ enabled: true,
154
+ sampleRate: 0.1, // 10% of sessions
155
+ onErrorSampleRate: 1.0, // 100% if an error occurs
156
+ }
157
+ ```
158
+
159
+ When an error occurs in a session that wasn't initially sampled, recording automatically starts to capture the error context.
160
+
161
+ ---
162
+
163
+ ## Privacy & Data Protection
164
+
165
+ Session Replay is designed with privacy as the default. **No configuration is required for most applications** - sensitive data is automatically protected.
166
+
167
+ ### Privacy Modes
168
+
169
+ | Mode | Text | Inputs | Use Case |
170
+ |------|------|--------|----------|
171
+ | `"strict"` (default) | Masked | Masked | Most applications |
172
+ | `"balanced"` | Visible | Masked | Marketing sites, blogs |
173
+ | `"permissive"` | Visible | Visible | Internal tools only |
174
+
175
+ ```typescript
176
+ replay: {
177
+ enabled: true,
178
+ privacyMode: "strict", // Default - masks everything
179
+ }
180
+ ```
181
+
182
+ ### What Each Mode Does
183
+
184
+ #### Strict Mode (Default)
185
+
186
+ All text content is replaced with `****`. Form inputs show `•••••`. You see the page structure and user interactions, but no actual content.
187
+
188
+ ```
189
+ ┌─────────────────────────────┐
190
+ │ **** ******** │ ← Masked heading
191
+ │ │
192
+ │ ******** **** ** ******* │ ← Masked paragraph
193
+ │ ******* ** *** **** │
194
+ │ │
195
+ │ Email: [•••••••••••••] │ ← Masked input
196
+ │ Password: [••••••••] │
197
+ │ │
198
+ │ [**********] │ ← Masked button
199
+ └─────────────────────────────┘
200
+ ```
201
+
202
+ #### Balanced Mode
203
+
204
+ Text is visible, but all form inputs are masked. Good for content-heavy sites.
205
+
206
+ ```
207
+ ┌─────────────────────────────┐
208
+ │ Welcome Back │ ← Visible heading
209
+ │ │
210
+ │ Please sign in to continue │ ← Visible text
211
+ │ │
212
+ │ Email: [•••••••••••••] │ ← Masked input
213
+ │ Password: [••••••••] │
214
+ │ │
215
+ │ [Sign In] │ ← Visible button
216
+ └─────────────────────────────┘
217
+ ```
218
+
219
+ #### Permissive Mode
220
+
221
+ Everything is recorded as-is. **Only use for internal tools or with explicit user consent.**
222
+
223
+ ### Fine-Grained Control with HTML Attributes
224
+
225
+ Regardless of privacy mode, you can control specific elements:
226
+
227
+ #### Block Elements Completely
228
+
229
+ Use `data-sw-block` to completely hide an element. It will appear as a gray placeholder in replays.
230
+
231
+ ```html
232
+ <!-- Credit card form - never record -->
233
+ <div data-sw-block>
234
+ <input type="text" placeholder="Card number" />
235
+ <input type="text" placeholder="CVV" />
236
+ </div>
237
+
238
+ <!-- Sensitive user data -->
239
+ <div data-sw-block class="user-profile">
240
+ <p>SSN: 123-45-6789</p>
241
+ </div>
242
+ ```
243
+
244
+ #### Mask Specific Elements
245
+
246
+ Use `data-sw-mask` to mask text while preserving structure (useful in balanced/permissive modes).
247
+
248
+ ```html
249
+ <!-- Mask email in a visible section -->
250
+ <p>Contact: <span data-sw-mask>user@example.com</span></p>
251
+ ```
252
+
253
+ #### Unmask Elements in Strict Mode
254
+
255
+ Use `data-sw-unmask` to show content even when using strict mode.
256
+
257
+ ```html
258
+ <!-- Show navigation labels in strict mode -->
259
+ <nav data-sw-unmask>
260
+ <a href="/">Home</a>
261
+ <a href="/products">Products</a>
262
+ <a href="/about">About</a>
263
+ </nav>
264
+
265
+ <!-- Show static content -->
266
+ <footer data-sw-unmask>
267
+ <p>© 2024 My Company</p>
268
+ </footer>
269
+ ```
270
+
271
+ #### rrweb Classes (Alternative)
272
+
273
+ The standard rrweb classes also work:
274
+
275
+ ```html
276
+ <div class="rr-block">Hidden content</div>
277
+ <div class="rr-mask">Masked content</div>
278
+ ```
279
+
280
+ ### Best Practices
281
+
282
+ 1. **Start with strict mode** - It's the safest default. Only relax if needed.
283
+
284
+ 2. **Block sensitive sections entirely** - For areas with PII (profile pages, account settings), use `data-sw-block`.
285
+
286
+ 3. **Review before production** - Test your app with replay enabled and verify no sensitive data appears.
287
+
288
+ 4. **Consider user consent** - For GDPR compliance, inform users that sessions may be recorded.
289
+
290
+ 5. **Use unmask sparingly** - Only unmask truly static, non-sensitive content like navigation labels.
291
+
292
+ ### What's Automatically Protected
293
+
294
+ Even without configuration:
295
+
296
+ - All `<input>` values are masked (except in permissive mode)
297
+ - Password fields are always masked
298
+ - Credit card patterns are detected and masked
299
+ - `<script>` content is never recorded
300
+ - `<head>` metadata is stripped
301
+
302
+ ### Sensitive Data Checklist
303
+
304
+ Before enabling replay, ensure these are blocked or masked:
305
+
306
+ - [ ] User profile information (name, email, phone)
307
+ - [ ] Payment forms and credit card inputs
308
+ - [ ] Social security numbers, government IDs
309
+ - [ ] Medical or health information
310
+ - [ ] Authentication tokens displayed on screen
311
+ - [ ] Private messages or chat content
312
+ - [ ] Financial account numbers
313
+ - [ ] Any PII in confirmation pages
314
+
315
+ ---
316
+
317
+ ## Distributed Tracing
318
+
319
+ The SDK automatically injects `traceparent` headers into fetch/XHR requests, connecting frontend sessions to backend traces.
320
+
321
+ ```typescript
322
+ const spanwise = createSpanwiseBrowser({
323
+ apiKey: "sw_...",
324
+ tracing: {
325
+ enabled: true,
326
+ propagateToOrigins: [
327
+ "https://api.myapp.com",
328
+ /\.myapp\.com$/,
329
+ ],
330
+ },
331
+ })
332
+ ```
333
+
334
+ Your backend will receive headers like:
335
+
336
+ ```
337
+ traceparent: 00-{traceId}-{spanId}-01
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Browser Support
343
+
344
+ - Chrome 64+
345
+ - Firefox 67+
346
+ - Safari 12+
347
+ - Edge 79+
348
+
349
+ Session Replay requires:
350
+ - MutationObserver
351
+ - WeakMap
352
+ - requestAnimationFrame
353
+
354
+ ---
355
+
356
+ ## Bundle Size
357
+
358
+ The base SDK is ~8KB gzipped. Session Replay adds ~40KB gzipped (rrweb).
359
+
360
+ Replay is dynamically imported only when enabled, so it won't affect your bundle if not used.
361
+
362
+ ---
363
+
364
+ ## TypeScript
365
+
366
+ Full TypeScript support with exported types:
367
+
368
+ ```typescript
369
+ import {
370
+ createSpanwiseBrowser,
371
+ type BrowserConfig,
372
+ type SpanwiseBrowser,
373
+ type ReplayConfig,
374
+ type PrivacyMode,
375
+ type TracingConfig,
376
+ } from "@spanwise/rum"
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Troubleshooting
382
+
383
+ ### Replay not recording
384
+
385
+ 1. Check that `replay.enabled` is `true`
386
+ 2. Verify you're within the sample rate (try `sampleRate: 1.0` for testing)
387
+ 3. Check browser console for errors
388
+
389
+ ### High data volume
390
+
391
+ 1. Reduce `sampleRate` (e.g., `0.05` for 5%)
392
+ 2. Use `"strict"` privacy mode (smaller payloads due to masked content)
393
+
394
+ ### Missing trace correlation
395
+
396
+ 1. Ensure `tracing.propagateToOrigins` includes your API domain
397
+ 2. Check that your backend parses the `traceparent` header
398
+
399
+ ---
400
+
401
+ ## License
402
+
403
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createSpanwiseBrowser, type BrowserConfig, type SpanwiseBrowser, type TracingConfig, } from "./client.js";
2
- export type { ReplayConfig } from "./replay.js";
2
+ export type { ReplayConfig, PrivacyMode } from "./replay.js";
3
3
  export type { RumEvent, RumEventType, PageViewEvent, ClickEvent, VitalsEvent, ErrorEvent, CustomEvent, ResourceEvent, } from "./events.js";
4
4
  export { getSessionId, endSession, type StorageMode } from "./session.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,YAAY,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC5D,YAAY,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA"}
package/dist/replay.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Privacy mode for session replay recording.
3
+ *
4
+ * - `"strict"` (default): Masks ALL text and input values. Recommended for most apps.
5
+ * Only element structure and interactions are visible.
6
+ *
7
+ * - `"balanced"`: Masks input values only. Text content is visible but form data is protected.
8
+ * Good for marketing sites with minimal user input.
9
+ *
10
+ * - `"permissive"`: Records everything as-is. Only use for internal tools or after
11
+ * explicit user consent. You must ensure no PII is captured.
12
+ */
13
+ export type PrivacyMode = "strict" | "balanced" | "permissive";
1
14
  export type ReplayConfig = {
2
15
  /** Enable replay recording (default: false) */
3
16
  enabled?: boolean;
@@ -5,12 +18,23 @@ export type ReplayConfig = {
5
18
  sampleRate?: number;
6
19
  /** Sample rate when error occurs 0-1 (default: 1.0 = 100%) */
7
20
  onErrorSampleRate?: number;
8
- /** Privacy level: 'allow' | 'mask-user-input' | 'mask' (default: 'mask-user-input') */
9
- privacyLevel?: "allow" | "mask-user-input" | "mask";
10
- /** CSS selector for elements to block completely */
11
- blockSelector?: string;
12
- /** CSS selector for elements to mask text */
13
- maskSelector?: string;
21
+ /**
22
+ * Privacy mode controls what data is captured (default: "strict")
23
+ *
24
+ * - "strict": Masks all text and inputs (recommended)
25
+ * - "balanced": Masks inputs only, text is visible
26
+ * - "permissive": Records everything (use with caution)
27
+ *
28
+ * Regardless of mode, you can use HTML attributes for fine-grained control:
29
+ * - `data-sw-block`: Completely hides element (shows placeholder)
30
+ * - `data-sw-mask`: Masks text content with asterisks
31
+ * - `data-sw-unmask`: Shows content even in strict mode
32
+ *
33
+ * rrweb built-in classes are also supported:
34
+ * - `.rr-block`: Same as data-sw-block
35
+ * - `.rr-mask`: Same as data-sw-mask
36
+ */
37
+ privacyMode?: PrivacyMode;
14
38
  };
15
39
  type ReplayTransportConfig = {
16
40
  apiKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../src/replay.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG;IAC1B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uFAAuF;IACvF,YAAY,CAAC,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,CAAA;IACnD,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAcD,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,qBAAqB,EACtC,OAAO,CAAC,EAAE,MAAM,IAAI;iBAoHF,IAAI;gBAcL,IAAI;qBAgCC,IAAI;;;EA2B1B;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../src/replay.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG;IAC1B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAmBD,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,qBAAqB,EACtC,OAAO,CAAC,EAAE,MAAM,IAAI;iBAsIF,IAAI;gBAcL,IAAI;qBAgCC,IAAI;;;EA2B1B;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
package/dist/replay.js CHANGED
@@ -2,6 +2,10 @@ import { gzipSync } from "fflate";
2
2
  import { record } from "rrweb";
3
3
  const MAX_CHUNK_SIZE = 64 * 1024; // 64KB uncompressed
4
4
  const FLUSH_INTERVAL = 5000; // 5 seconds
5
+ // Selectors for privacy control
6
+ const BLOCK_SELECTOR = "[data-sw-block], .rr-block";
7
+ const MASK_SELECTOR = "[data-sw-mask], .rr-mask";
8
+ const UNMASK_SELECTOR = "[data-sw-unmask]";
5
9
  // Efficient base64 encoding for Uint8Array (avoids spread operator on large arrays)
6
10
  function uint8ToBase64(bytes) {
7
11
  let binary = "";
@@ -23,10 +27,15 @@ export function createReplayRecorder(config, transportConfig, onError) {
23
27
  const shouldRecord = Math.random() < (config.sampleRate ?? 0.1);
24
28
  let wasUpgradedByError = false;
25
29
  function getRecordOptions() {
26
- const privacyLevel = config.privacyLevel ?? "mask-user-input";
27
- // Build options object
28
- const maskAllInputs = privacyLevel === "mask" || privacyLevel === "mask-user-input";
29
- const maskTextSelector = privacyLevel === "mask" ? "*" : config.maskSelector;
30
+ const privacyMode = config.privacyMode ?? "strict";
31
+ // Build privacy settings based on mode
32
+ const maskAllInputs = privacyMode !== "permissive";
33
+ const maskAllText = privacyMode === "strict";
34
+ // In strict mode, mask everything except explicitly unmasked elements
35
+ // In balanced/permissive modes, only mask elements with data-sw-mask
36
+ const maskTextSelector = maskAllText
37
+ ? `*:not(${UNMASK_SELECTOR}):not(${UNMASK_SELECTOR} *)`
38
+ : MASK_SELECTOR;
30
39
  return {
31
40
  emit: (event) => handleEvent(event),
32
41
  sampling: {
@@ -35,9 +44,22 @@ export function createReplayRecorder(config, transportConfig, onError) {
35
44
  scroll: 150,
36
45
  input: "last",
37
46
  },
47
+ // Privacy settings
38
48
  maskAllInputs,
39
49
  maskTextSelector,
40
- blockSelector: config.blockSelector,
50
+ blockSelector: BLOCK_SELECTOR,
51
+ // Slimmer DOM for performance
52
+ slimDOMOptions: {
53
+ script: true,
54
+ comment: true,
55
+ headFavicon: true,
56
+ headWhitespace: true,
57
+ headMetaSocial: true,
58
+ headMetaRobots: true,
59
+ headMetaHttpEquiv: true,
60
+ headMetaVerification: true,
61
+ headMetaAuthorship: true,
62
+ },
41
63
  };
42
64
  }
43
65
  function handleEvent(event) {
@@ -1 +1 @@
1
- {"version":3,"file":"replay.js","sourceRoot":"","sources":["../src/replay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAuB9B,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,oBAAoB;AACrD,MAAM,cAAc,GAAG,IAAI,CAAA,CAAC,YAAY;AAExC,oFAAoF;AACpF,SAAS,aAAa,CAAC,KAAiB;IACvC,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK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6 +1,6 @@
1
1
  {
2
2
  "name": "@spanwise/rum",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Real User Monitoring SDK for Spanwise - track sessions, page views, clicks, and Core Web Vitals",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,9 +14,7 @@
14
14
  "types": "./dist/index.d.ts"
15
15
  }
16
16
  },
17
- "files": [
18
- "dist"
19
- ],
17
+ "files": ["dist"],
20
18
  "scripts": {
21
19
  "build": "tsc",
22
20
  "dev": "tsc --watch",