humanbehavior-js 0.4.15 → 0.4.17

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.
Files changed (89) hide show
  1. package/dist/cjs/wizard/index.cjs +6 -8
  2. package/dist/cjs/wizard/index.cjs.map +1 -1
  3. package/dist/cli/ai-auto-install.js +6 -8
  4. package/dist/cli/ai-auto-install.js.map +1 -1
  5. package/dist/esm/wizard/index.js +6 -8
  6. package/dist/esm/wizard/index.js.map +1 -1
  7. package/package/WIZARD_USAGE_GUIDE.md +381 -0
  8. package/package/canvas-recording-demo.html +143 -0
  9. package/package/clean-console-demo.html +39 -0
  10. package/package/dist/cjs/angular/index.cjs +14354 -0
  11. package/package/dist/cjs/angular/index.cjs.map +1 -0
  12. package/package/dist/cjs/index.cjs +14323 -0
  13. package/package/dist/cjs/index.cjs.map +1 -0
  14. package/package/dist/cjs/install-wizard.cjs +1530 -0
  15. package/package/dist/cjs/install-wizard.cjs.map +1 -0
  16. package/package/dist/cjs/react/index.cjs +14478 -0
  17. package/package/dist/cjs/react/index.cjs.map +1 -0
  18. package/package/dist/cjs/remix/index.cjs +14452 -0
  19. package/package/dist/cjs/remix/index.cjs.map +1 -0
  20. package/package/dist/cjs/svelte/index.cjs +14308 -0
  21. package/package/dist/cjs/svelte/index.cjs.map +1 -0
  22. package/package/dist/cjs/vue/index.cjs +14317 -0
  23. package/package/dist/cjs/vue/index.cjs.map +1 -0
  24. package/package/dist/cjs/wizard/index.cjs +3446 -0
  25. package/package/dist/cjs/wizard/index.cjs.map +1 -0
  26. package/package/dist/cli/ai-auto-install.cjs +57161 -0
  27. package/package/dist/cli/ai-auto-install.cjs.map +1 -0
  28. package/package/dist/cli/ai-auto-install.js +1969 -0
  29. package/package/dist/cli/ai-auto-install.js.map +1 -0
  30. package/package/dist/cli/auto-install.cjs +56352 -0
  31. package/package/dist/cli/auto-install.cjs.map +1 -0
  32. package/package/dist/cli/auto-install.js +1957 -0
  33. package/package/dist/cli/auto-install.js.map +1 -0
  34. package/package/dist/esm/angular/index.js +14350 -0
  35. package/package/dist/esm/angular/index.js.map +1 -0
  36. package/package/dist/esm/index.js +14309 -0
  37. package/package/dist/esm/index.js.map +1 -0
  38. package/package/dist/esm/install-wizard.js +1507 -0
  39. package/package/dist/esm/install-wizard.js.map +1 -0
  40. package/package/dist/esm/react/index.js +14472 -0
  41. package/package/dist/esm/react/index.js.map +1 -0
  42. package/package/dist/esm/remix/index.js +14448 -0
  43. package/package/dist/esm/remix/index.js.map +1 -0
  44. package/package/dist/esm/svelte/index.js +14306 -0
  45. package/package/dist/esm/svelte/index.js.map +1 -0
  46. package/package/dist/esm/vue/index.js +14315 -0
  47. package/package/dist/esm/vue/index.js.map +1 -0
  48. package/package/dist/esm/wizard/index.js +3415 -0
  49. package/package/dist/esm/wizard/index.js.map +1 -0
  50. package/package/dist/index.min.js +2 -0
  51. package/package/dist/index.min.js.map +1 -0
  52. package/package/dist/types/angular/index.d.ts +267 -0
  53. package/package/dist/types/index.d.ts +373 -0
  54. package/package/dist/types/install-wizard.d.ts +156 -0
  55. package/package/dist/types/react/index.d.ts +255 -0
  56. package/package/dist/types/remix/index.d.ts +246 -0
  57. package/package/dist/types/svelte/index.d.ts +232 -0
  58. package/package/dist/types/vue/index.d.ts +15 -0
  59. package/package/dist/types/wizard/index.d.ts +523 -0
  60. package/package/package.json +105 -0
  61. package/package/readme.md +281 -0
  62. package/package/rollup.config.js +422 -0
  63. package/package/simple-demo.html +26 -0
  64. package/package/simple-spa.html +838 -0
  65. package/package/src/angular/index.ts +79 -0
  66. package/package/src/api.ts +376 -0
  67. package/package/src/index.ts +28 -0
  68. package/package/src/react/AutoInstallWizard.tsx +557 -0
  69. package/package/src/react/browser.ts +8 -0
  70. package/package/src/react/index.tsx +308 -0
  71. package/package/src/redact.ts +521 -0
  72. package/package/src/remix/index.ts +16 -0
  73. package/package/src/svelte/index.ts +14 -0
  74. package/package/src/tracker.ts +1319 -0
  75. package/package/src/types/clack.d.ts +31 -0
  76. package/package/src/utils/logger.ts +144 -0
  77. package/package/src/vue/index.ts +29 -0
  78. package/package/src/wizard/README.md +114 -0
  79. package/package/src/wizard/ai/ai-install-wizard.ts +897 -0
  80. package/package/src/wizard/ai/manual-framework-wizard.ts +238 -0
  81. package/package/src/wizard/cli/ai-auto-install.ts +243 -0
  82. package/package/src/wizard/cli/auto-install.ts +224 -0
  83. package/package/src/wizard/core/install-wizard.ts +1744 -0
  84. package/package/src/wizard/index.ts +23 -0
  85. package/package/src/wizard/services/centralized-ai-service.ts +668 -0
  86. package/package/src/wizard/services/remote-ai-service.ts +240 -0
  87. package/package/tsconfig.json +24 -0
  88. package/package.json +1 -1
  89. package/src/wizard/cli/ai-auto-install.ts +4 -6
@@ -0,0 +1,381 @@
1
+ # HumanBehavior SDK Auto-Installation Wizard
2
+
3
+ The HumanBehavior SDK includes an intelligent auto-installation wizard that can detect your project's framework and automatically integrate the SDK with minimal user intervention.
4
+
5
+ ## 🚀 Quick Start
6
+
7
+ ### Single Command Installation
8
+
9
+ **When the package is published to npm:**
10
+ ```bash
11
+ npx humanbehavior-js auto-install YOUR_API_KEY
12
+ ```
13
+
14
+ **For local development/testing:**
15
+ ```bash
16
+ node path/to/humanbehavior-js/dist/cli/auto-install.js YOUR_API_KEY
17
+ ```
18
+
19
+ That's it! The wizard will:
20
+ - 🔍 Auto-detect your project's framework
21
+ - 📦 Install the humanbehavior-js package
22
+ - ✏️ Modify your codebase to integrate the SDK
23
+ - 🔧 Create environment files with your API key
24
+ - 🚀 Make your app ready to track user behavior
25
+
26
+ ## 📋 Supported Frameworks
27
+
28
+ The wizard automatically detects and configures:
29
+
30
+ - ✅ **React** (CRA, Vite, Webpack)
31
+ - ✅ **Next.js** (App Router, Pages Router)
32
+ - ✅ **Vue** (Vue CLI, Vite)
33
+ - ✅ **Angular**
34
+ - ✅ **Svelte** (SvelteKit, Vite)
35
+ - ✅ **Nuxt.js**
36
+ - ✅ **Vanilla JS/TS**
37
+ - ✅ **Node.js** (CommonJS & ESM)
38
+
39
+ ## 🛠️ Installation Options
40
+
41
+ ### Basic Usage
42
+
43
+ **When the package is published to npm:**
44
+ ```bash
45
+ # Interactive mode (prompts for API key)
46
+ npx humanbehavior-js auto-install
47
+
48
+ # With API key as argument
49
+ npx humanbehavior-js auto-install your-api-key-here
50
+
51
+ # Skip all prompts
52
+ npx humanbehavior-js auto-install your-api-key-here --yes
53
+ ```
54
+
55
+ **For local development/testing:**
56
+ ```bash
57
+ # Interactive mode (prompts for API key)
58
+ node path/to/humanbehavior-js/dist/cli/auto-install.js
59
+
60
+ # With API key as argument
61
+ node path/to/humanbehavior-js/dist/cli/auto-install.js your-api-key-here
62
+
63
+ # Skip all prompts
64
+ node path/to/humanbehavior-js/dist/cli/auto-install.js your-api-key-here --yes
65
+ ```
66
+
67
+ ### Advanced Options
68
+
69
+ **When the package is published to npm:**
70
+ ```bash
71
+ # Specify project directory
72
+ npx humanbehavior-js auto-install your-api-key -p /path/to/project
73
+
74
+ # Dry run (show what would be changed without making changes)
75
+ npx humanbehavior-js auto-install your-api-key --dry-run
76
+
77
+ # Get help
78
+ npx humanbehavior-js auto-install --help
79
+ ```
80
+
81
+ **For local development/testing:**
82
+ ```bash
83
+ # Specify project directory
84
+ node path/to/humanbehavior-js/dist/cli/auto-install.js your-api-key -p /path/to/project
85
+
86
+ # Dry run (show what would be changed without making changes)
87
+ node path/to/humanbehavior-js auto-install.js your-api-key --dry-run
88
+
89
+ # Get help
90
+ node path/to/humanbehavior-js/dist/cli/auto-install.js --help
91
+ ```
92
+
93
+ ## 🔧 Framework-Specific Integration
94
+
95
+ ### React
96
+ ```jsx
97
+ // The wizard automatically wraps your app with HumanBehaviorProvider
98
+ import { HumanBehaviorProvider } from 'humanbehavior-js/react';
99
+
100
+ function App() {
101
+ return (
102
+ <HumanBehaviorProvider apiKey={process.env.HUMANBEHAVIOR_API_KEY}>
103
+ {/* Your app content */}
104
+ </HumanBehaviorProvider>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ### Next.js (App Router)
110
+ ```tsx
111
+ // Creates app/providers.tsx
112
+ 'use client';
113
+ import { HumanBehaviorProvider } from 'humanbehavior-js/react';
114
+
115
+ export function Providers({ children }: { children: React.ReactNode }) {
116
+ return (
117
+ <HumanBehaviorProvider apiKey={process.env.HUMANBEHAVIOR_API_KEY}>
118
+ {children}
119
+ </HumanBehaviorProvider>
120
+ );
121
+ }
122
+
123
+ // Modifies app/layout.tsx to use Providers
124
+ ```
125
+
126
+ ### Next.js (Pages Router)
127
+ ```tsx
128
+ // Creates components/providers.tsx
129
+ 'use client';
130
+ import { HumanBehaviorProvider } from 'humanbehavior-js/react';
131
+
132
+ export function Providers({ children }: { children: React.ReactNode }) {
133
+ return (
134
+ <HumanBehaviorProvider apiKey={process.env.HUMANBEHAVIOR_API_KEY}>
135
+ {children}
136
+ </HumanBehaviorProvider>
137
+ );
138
+ }
139
+
140
+ // Modifies pages/_app.tsx to use Providers
141
+ ```
142
+
143
+ ### Vue
144
+ ```js
145
+ // The wizard adds the plugin to your main.js/ts
146
+ import { HumanBehaviorPlugin } from 'humanbehavior-js/vue';
147
+
148
+ app.use(HumanBehaviorPlugin, {
149
+ apiKey: import.meta.env.VITE_HUMANBEHAVIOR_API_KEY
150
+ });
151
+ ```
152
+
153
+ ### Angular
154
+ ```typescript
155
+ // The wizard adds the module to app.module.ts
156
+ import { HumanBehaviorModule } from 'humanbehavior-js/angular';
157
+
158
+ @NgModule({
159
+ imports: [
160
+ // ... other imports
161
+ HumanBehaviorModule.forRoot({
162
+ apiKey: environment.humanBehaviorApiKey
163
+ })
164
+ ]
165
+ })
166
+ ```
167
+
168
+ ### Svelte
169
+ ```javascript
170
+ // The wizard adds the store to your main file
171
+ import { humanBehaviorStore } from 'humanbehavior-js/svelte';
172
+
173
+ humanBehaviorStore.init('your-api-key');
174
+ ```
175
+
176
+ ### Nuxt.js
177
+ ```typescript
178
+ // Creates plugins/humanbehavior.client.ts
179
+ import { HumanBehaviorPlugin } from 'humanbehavior-js/vue';
180
+
181
+ export default defineNuxtPlugin((nuxtApp) => {
182
+ nuxtApp.vueApp.use(HumanBehaviorPlugin, {
183
+ apiKey: useRuntimeConfig().public.humanBehaviorApiKey
184
+ });
185
+ });
186
+ ```
187
+
188
+ ## 🔐 Environment Variables
189
+
190
+ The wizard intelligently handles environment files:
191
+
192
+ ### Smart File Detection
193
+ The wizard checks for existing environment files in this order:
194
+ 1. `.env.local`
195
+ 2. `.env.development.local`
196
+ 3. `.env.development`
197
+ 4. `.env.local.development`
198
+ 5. `.env`
199
+ 6. `.env.production`
200
+ 7. `.env.staging`
201
+
202
+ ### Framework-Specific Variables
203
+ - **React/Next.js**: `HUMANBEHAVIOR_API_KEY`
204
+ - **Vue**: `VITE_HUMANBEHAVIOR_API_KEY`
205
+ - **Svelte**: `PUBLIC_HUMANBEHAVIOR_API_KEY`
206
+ - **Angular**: `humanBehaviorApiKey` (in environment.ts)
207
+ - **Nuxt**: `HUMANBEHAVIOR_API_KEY`
208
+
209
+ ### Safe Environment Handling
210
+ - ✅ **Preserves existing files** (never overwrites)
211
+ - ✅ **Appends to existing files** (adds API key safely)
212
+ - ✅ **Skips duplicates** (won't add same variable twice)
213
+ - ✅ **Works with gitignored files** (finds .env files even if ignored)
214
+
215
+ ## 📁 Project Structure After Installation
216
+
217
+ ### React/Next.js Project
218
+ ```
219
+ your-project/
220
+ ├── .env.local # Created with API key
221
+ ├── src/
222
+ │ ├── App.tsx # Modified with provider
223
+ │ └── index.tsx # Unchanged
224
+ ├── package.json # humanbehavior-js added
225
+ └── node_modules/
226
+ ```
227
+
228
+ ### Next.js App Router
229
+ ```
230
+ your-project/
231
+ ├── .env.local # Created with API key
232
+ ├── app/
233
+ │ ├── layout.tsx # Modified to use providers
234
+ │ └── providers.tsx # Created with provider
235
+ ├── package.json # humanbehavior-js added
236
+ └── node_modules/
237
+ ```
238
+
239
+ ### Vue Project
240
+ ```
241
+ your-project/
242
+ ├── .env.local # Created with API key
243
+ ├── src/
244
+ │ └── main.js # Modified with plugin
245
+ ├── package.json # humanbehavior-js added
246
+ └── node_modules/
247
+ ```
248
+
249
+ ## 🎯 What Gets Modified
250
+
251
+ ### Code Changes
252
+ - **Main entry point**: Wrapped with provider/plugin
253
+ - **Environment files**: API key added safely
254
+ - **Package.json**: humanbehavior-js dependency added
255
+
256
+ ### Files Created
257
+ - **Environment files**: `.env.local`, `.env`, etc.
258
+ - **Provider files**: `providers.tsx` (Next.js)
259
+ - **Plugin files**: `humanbehavior.client.ts` (Nuxt)
260
+
261
+ ### Files Modified
262
+ - **Main app file**: `App.tsx`, `main.js`, `layout.tsx`, etc.
263
+ - **Package.json**: Dependencies updated
264
+ - **Environment files**: API key appended
265
+
266
+ ## 🚨 Troubleshooting
267
+
268
+ ### Common Issues
269
+
270
+ **"Framework not detected"**
271
+ - Ensure you're running the command from your project root
272
+ - Check that `package.json` exists and has dependencies
273
+
274
+ **"Permission denied"**
275
+ - Make sure you have write permissions to your project directory
276
+ - Try running with `sudo` if needed (not recommended)
277
+
278
+ **"Package installation failed"**
279
+ - Check your internet connection
280
+ - Ensure npm/yarn is properly configured
281
+ - Try running `npm install` manually first
282
+
283
+ ### Manual Fallback
284
+
285
+ If the wizard fails, you can install manually:
286
+
287
+ ```bash
288
+ # Install the package
289
+ npm install humanbehavior-js
290
+
291
+ # Add environment variable
292
+ echo "HUMANBEHAVIOR_API_KEY=your-api-key" >> .env.local
293
+
294
+ # Then follow framework-specific setup in the main README
295
+ ```
296
+
297
+ ## 🚀 Current Status
298
+
299
+ **Note**: The auto-installation wizard is currently in development and not yet published to npm. To test it locally:
300
+
301
+ 1. **Clone the repository**:
302
+ ```bash
303
+ git clone https://github.com/humanbehavior-gh/humanbehavior-js.git
304
+ cd humanbehavior-js
305
+ ```
306
+
307
+ 2. **Build the wizard**:
308
+ ```bash
309
+ npm install
310
+ npm run build
311
+ ```
312
+
313
+ 3. **Test in your project**:
314
+ ```bash
315
+ node dist/cli/auto-install.js your-api-key --yes
316
+ ```
317
+
318
+ Once the package is published to npm, you'll be able to use the `npx` commands shown above.
319
+
320
+ ## 🔍 Debugging
321
+
322
+ ### Dry Run Mode
323
+ **When the package is published to npm:**
324
+ ```bash
325
+ npx humanbehavior-js auto-install your-api-key --dry-run
326
+ ```
327
+
328
+ **For local development/testing:**
329
+ ```bash
330
+ node path/to/humanbehavior-js/dist/cli/auto-install.js your-api-key --dry-run
331
+ ```
332
+
333
+ Shows what changes would be made without actually making them.
334
+
335
+ ### Verbose Output
336
+ The wizard provides detailed output showing:
337
+ - Framework detection results
338
+ - Package installation status
339
+ - Files created/modified
340
+ - Next steps for the user
341
+
342
+ ## 📚 Next Steps After Installation
343
+
344
+ Once the wizard completes:
345
+
346
+ 1. **Start your development server**
347
+ ```bash
348
+ npm start
349
+ # or
350
+ yarn dev
351
+ ```
352
+
353
+ 2. **Verify integration**
354
+ - Check browser console for SDK initialization
355
+ - Visit your app and trigger some interactions
356
+ - Check your HumanBehavior dashboard for sessions
357
+
358
+ 3. **Customize tracking** (optional)
359
+ ```javascript
360
+ // React
361
+ import { useHumanBehavior } from 'humanbehavior-js/react';
362
+
363
+ function MyComponent() {
364
+ const { trackEvent } = useHumanBehavior();
365
+
366
+ const handleClick = () => {
367
+ trackEvent('button_clicked', { button: 'submit' });
368
+ };
369
+ }
370
+ ```
371
+
372
+ ## 🎉 Success Indicators
373
+
374
+ The wizard is successful when you see:
375
+ - ✅ "Installation completed successfully!"
376
+ - ✅ Framework detected correctly
377
+ - ✅ Package installed without errors
378
+ - ✅ Environment file created
379
+ - ✅ Code modifications applied
380
+
381
+ Your app is now ready to track user behavior! 🚀
@@ -0,0 +1,143 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>HumanBehavior Canvas Recording Demo</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; margin: 20px; }
9
+ .demo-section { margin: 20px 0; padding: 20px; border: 1px solid #ccc; }
10
+ canvas { border: 2px solid #333; margin: 10px; }
11
+ button { padding: 10px 20px; margin: 5px; }
12
+ .info { background: #f0f0f0; padding: 10px; border-radius: 5px; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>HumanBehavior Canvas Recording Demo</h1>
17
+
18
+ <div class="info">
19
+ <h3>PostHog-Style Canvas Protection</h3>
20
+ <ul>
21
+ <li><strong>4 FPS Throttling:</strong> Prevents canvas overwhelm (vs 60 FPS default)</li>
22
+ <li><strong>40% Quality:</strong> WebP format with compression</li>
23
+ <li><strong>Opt-in Only:</strong> Disabled by default for safety</li>
24
+ <li><strong>Smart Sampling:</strong> Only captures when canvas changes</li>
25
+ </ul>
26
+ </div>
27
+
28
+ <div class="demo-section">
29
+ <h3>Canvas Drawing Demo</h3>
30
+ <canvas id="demoCanvas" width="400" height="300"></canvas>
31
+ <br>
32
+ <button onclick="drawRandom()">Draw Random Shape</button>
33
+ <button onclick="clearCanvas()">Clear Canvas</button>
34
+ <button onclick="animate()">Start Animation</button>
35
+ </div>
36
+
37
+ <div class="demo-section">
38
+ <h3>Canvas Recording Options</h3>
39
+ <button onclick="enableCanvasRecording()">Enable Canvas Recording</button>
40
+ <button onclick="disableCanvasRecording()">Disable Canvas Recording</button>
41
+ <p id="status">Canvas recording: <strong>Disabled</strong></p>
42
+ </div>
43
+
44
+ <script src="./dist/index.min.js"></script>
45
+ <script>
46
+ let tracker;
47
+ let canvas = document.getElementById('demoCanvas');
48
+ let ctx = canvas.getContext('2d');
49
+ let animationId;
50
+
51
+ // Initialize tracker without canvas recording
52
+ function initTracker(enableCanvas = false) {
53
+ tracker = HumanBehaviorTracker.init('13c3e029-ca45-4a3c-a33b-f5dcb297e31c', {
54
+ logLevel: 'warn',
55
+ suppressConsoleErrors: true,
56
+ recordCanvas: enableCanvas // PostHog-style protection
57
+ });
58
+
59
+ updateStatus();
60
+ console.log('✅ Tracker initialized with canvas recording:', enableCanvas);
61
+ }
62
+
63
+ function updateStatus() {
64
+ const status = document.getElementById('status');
65
+ status.innerHTML = `Canvas recording: <strong>${tracker.recordCanvas ? 'Enabled' : 'Disabled'}</strong>`;
66
+ }
67
+
68
+ function enableCanvasRecording() {
69
+ if (tracker) {
70
+ tracker.stop();
71
+ }
72
+ initTracker(true);
73
+ }
74
+
75
+ function disableCanvasRecording() {
76
+ if (tracker) {
77
+ tracker.stop();
78
+ }
79
+ initTracker(false);
80
+ }
81
+
82
+ function drawRandom() {
83
+ const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7'];
84
+ const color = colors[Math.floor(Math.random() * colors.length)];
85
+
86
+ ctx.fillStyle = color;
87
+ ctx.beginPath();
88
+ ctx.arc(
89
+ Math.random() * canvas.width,
90
+ Math.random() * canvas.height,
91
+ Math.random() * 50 + 10,
92
+ 0,
93
+ 2 * Math.PI
94
+ );
95
+ ctx.fill();
96
+
97
+ // Track the drawing event
98
+ if (tracker) {
99
+ tracker.customEvent('canvas_draw', {
100
+ color: color,
101
+ timestamp: Date.now()
102
+ });
103
+ }
104
+ }
105
+
106
+ function clearCanvas() {
107
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
108
+
109
+ if (tracker) {
110
+ tracker.customEvent('canvas_clear', {
111
+ timestamp: Date.now()
112
+ });
113
+ }
114
+ }
115
+
116
+ function animate() {
117
+ let angle = 0;
118
+
119
+ function animateFrame() {
120
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
121
+
122
+ // Draw rotating rectangle
123
+ ctx.save();
124
+ ctx.translate(canvas.width / 2, canvas.height / 2);
125
+ ctx.rotate(angle);
126
+ ctx.fillStyle = '#FF6B6B';
127
+ ctx.fillRect(-25, -25, 50, 50);
128
+ ctx.restore();
129
+
130
+ angle += 0.02;
131
+ animationId = requestAnimationFrame(animateFrame);
132
+ }
133
+
134
+ animateFrame();
135
+ }
136
+
137
+ // Initialize tracker on page load
138
+ initTracker(false);
139
+
140
+ console.log('🎨 Canvas demo ready! Try drawing or enabling canvas recording.');
141
+ </script>
142
+ </body>
143
+ </html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>HumanBehavior Clean Console Demo</title>
7
+ </head>
8
+ <body>
9
+ <h1>HumanBehavior Clean Console Demo</h1>
10
+ <p>This demo shows how to suppress common rrweb errors for a clean console.</p>
11
+
12
+ <!-- External images that would normally cause CORS errors -->
13
+ <img src="https://img.lumas.com/showimg_rwt01_search.jpg" alt="External image 1" style="width: 100px; height: 100px;">
14
+ <img src="https://media.lumas.de/homepage/2024/magazine-kachel-300x400.webp" alt="External image 2" style="width: 100px; height: 100px;">
15
+
16
+ <button>Click me to test recording</button>
17
+ <input type="text" placeholder="Type something">
18
+ <input type="password" placeholder="Password (will be redacted)">
19
+
20
+ <script src="./dist/index.min.js"></script>
21
+ <script>
22
+ // Initialize the tracker with error suppression enabled (default)
23
+ const tracker = HumanBehaviorTracker.init('13c3e029-ca45-4a3c-a33b-f5dcb297e31c', {
24
+ redactFields: ['input[type="password"]'],
25
+ suppressConsoleErrors: true, // Enable error suppression (default)
26
+ logLevel: 'warn' // Only show warnings and errors
27
+ });
28
+
29
+ console.log('✅ HumanBehavior tracker initialized with clean console mode');
30
+ console.log('✅ Canvas security errors and CORS issues will be suppressed');
31
+
32
+ // Test that core functionality still works
33
+ tracker.customEvent('demo_started', {
34
+ feature: 'clean_console',
35
+ timestamp: Date.now()
36
+ });
37
+ </script>
38
+ </body>
39
+ </html>