@devskin/browser-sdk 1.0.42 → 1.0.45

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.
@@ -13964,6 +13964,14 @@ class DevSkinSDK {
13964
13964
  console.warn('[DevSkin] SDK already initialized or initializing');
13965
13965
  return;
13966
13966
  }
13967
+ // CRITICAL: Skip ALL initialization for bots/crawlers (SEO optimization)
13968
+ // This ensures ZERO performance impact on Google PageSpeed, Lighthouse, etc.
13969
+ if (this.isBot()) {
13970
+ if (config.debug) {
13971
+ console.log('[DevSkin] Bot/crawler detected - SDK disabled for SEO optimization');
13972
+ }
13973
+ return;
13974
+ }
13967
13975
  // Mark as initializing to prevent duplicate init() calls
13968
13976
  this.initializing = true;
13969
13977
  this.config = Object.assign({ debug: false, captureWebVitals: true, captureNetworkRequests: true, captureErrors: true, captureUserAgent: true, captureLocation: true, captureDevice: true, heatmapOptions: {
@@ -14014,17 +14022,15 @@ class DevSkinSDK {
14014
14022
  }
14015
14023
  // Initialize session recording with rrweb
14016
14024
  if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
14017
- // Skip recording for bots/crawlers to avoid impacting SEO
14018
- const isBot = this.isBot();
14019
14025
  // Apply session sampling - decide if this session should be recorded
14020
14026
  const samplingRate = this.config.sessionRecording.sampling || 1.0;
14021
- const shouldRecord = !isBot && Math.random() < samplingRate;
14027
+ const shouldRecord = Math.random() < samplingRate;
14022
14028
  if (shouldRecord) {
14023
14029
  // Use RRWebRecorder for complete DOM recording
14024
14030
  // Pass sessionStartTime to ensure timestamp continuity across page navigations
14025
14031
  this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
14026
14032
  enabled: true,
14027
- mouseMoveSampleRate: 0.5, // Sample 10% of mouse movements to reduce bandwidth
14033
+ mouseMoveSampleRate: 0.5, // Sample 50% of mouse movements to reduce bandwidth
14028
14034
  blockClass: 'rr-block',
14029
14035
  ignoreClass: this.config.sessionRecording.ignoreClass || 'rr-ignore',
14030
14036
  maskAllInputs: this.config.sessionRecording.maskAllInputs !== undefined
@@ -14054,12 +14060,7 @@ class DevSkinSDK {
14054
14060
  }
14055
14061
  else {
14056
14062
  if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.debug) {
14057
- if (isBot) {
14058
- console.log(`[DevSkin] Session ${this.sessionId} skipped recording (bot/crawler detected for SEO optimization)`);
14059
- }
14060
- else {
14061
- console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
14062
- }
14063
+ console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
14063
14064
  }
14064
14065
  }
14065
14066
  }
@@ -14364,7 +14365,36 @@ class DevSkinSDK {
14364
14365
  }
14365
14366
  }
14366
14367
  // Create singleton instance
14367
- const DevSkin = new DevSkinSDK();
14368
+ const sdk = new DevSkinSDK();
14369
+ // Command processor function (Hotjar-style API)
14370
+ function DevSkin(command, ...args) {
14371
+ if (typeof sdk[command] === 'function') {
14372
+ sdk[command](...args);
14373
+ }
14374
+ else {
14375
+ console.warn(`[DevSkin] Unknown command: ${command}`);
14376
+ }
14377
+ }
14378
+ // Process queued commands from async loader
14379
+ if (typeof window !== 'undefined' && window.DevSkin) {
14380
+ const stub = window.DevSkin;
14381
+ if (stub.q && Array.isArray(stub.q)) {
14382
+ // Process all queued commands
14383
+ stub.q.forEach((args) => {
14384
+ if (args.length > 0) {
14385
+ DevSkin(args[0], ...args.slice(1));
14386
+ }
14387
+ });
14388
+ }
14389
+ // Preserve load time
14390
+ if (stub.l) {
14391
+ DevSkin.l = stub.l;
14392
+ }
14393
+ // Replace stub with real function
14394
+ window.DevSkin = DevSkin;
14395
+ }
14396
+ // For UMD/global access, also expose singleton methods directly
14397
+ Object.assign(DevSkin, sdk);
14368
14398
 
14369
- export { DevSkin as default };
14399
+ export { sdk as default };
14370
14400
  //# sourceMappingURL=devskin.esm.js.map