@scalebun/react-native 1.2.2 → 1.3.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.
Files changed (32) hide show
  1. package/android/src/main/java/com/scalebun/replaysdk/ReplaySdkModule.kt +25 -0
  2. package/android/src/main/java/com/scalebun/replaysdk/session/SessionManager.kt +41 -0
  3. package/dist/scalebun.full.js +35 -1
  4. package/dist/scalebun.full.js.map +1 -1
  5. package/dist/scalebun.slim.js +35 -1
  6. package/dist/scalebun.slim.js.map +1 -1
  7. package/ios/ReplaySdk.swift +13 -0
  8. package/ios/Session/SessionManager.swift +43 -0
  9. package/lib/commonjs/bootstrap/SDKBootstrapper.js +12 -0
  10. package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
  11. package/lib/commonjs/core/config/schema.js +6 -0
  12. package/lib/commonjs/core/config/schema.js.map +1 -1
  13. package/lib/commonjs/public/ScaleBunFacade.js +21 -1
  14. package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
  15. package/lib/module/bootstrap/SDKBootstrapper.js +12 -0
  16. package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
  17. package/lib/module/core/config/schema.js +6 -0
  18. package/lib/module/core/config/schema.js.map +1 -1
  19. package/lib/module/public/ScaleBunFacade.js +21 -1
  20. package/lib/module/public/ScaleBunFacade.js.map +1 -1
  21. package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
  22. package/lib/typescript/core/config/schema.d.ts +2 -0
  23. package/lib/typescript/core/config/schema.d.ts.map +1 -1
  24. package/lib/typescript/public/ScaleBunFacade.d.ts +8 -1
  25. package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
  26. package/lib/typescript/public/types.d.ts +12 -0
  27. package/lib/typescript/public/types.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/bootstrap/SDKBootstrapper.ts +12 -0
  30. package/src/core/config/schema.ts +8 -0
  31. package/src/public/ScaleBunFacade.ts +19 -1
  32. package/src/public/types.ts +13 -0
@@ -38,6 +38,7 @@ import { createStorageBackend, MemoryBackend } from '../storage/StorageBackend';
38
38
  import { SessionManager } from '../features/session/SessionManager';
39
39
  import { nativeCapture } from '../features/session/nativeCapture';
40
40
  import { installAlertInstrumentation, uninstallAlertInstrumentation } from '../features/replay/integrations/alert/alertInstrumentation';
41
+ import { installConsoleIntegration, uninstallConsoleIntegration } from '../features/replay/integrations/logs/consoleIntegration';
41
42
  import { BackendSessionAdapter } from '../features/session/BackendSessionAdapter';
42
43
  import { generateSessionId } from '../features/replay/core/ids/sessionId';
43
44
  import type { FeatureContext } from '../core/contracts/IFeature';
@@ -381,6 +382,16 @@ export class SDKBootstrapper {
381
382
  });
382
383
  sessionManager.setBackendTransport(backendAdapter);
383
384
 
385
+ // Opt-in console → Logs lane. Armed here (not only in the desktop-debug
386
+ // replay orchestrator) so a stock SaaS app can capture console.* without
387
+ // pulling in the devTools bundle. Gated by clientKey (the backend transport
388
+ // forwardToLogsLane needs is now set above) AND the explicit
389
+ // captureConsoleLogs opt-in — console output can carry PII, so it stays off
390
+ // unless the host asks for it. queueLog itself no-ops without a clientKey.
391
+ if (this.config.clientKey && this.config.captureConsoleLogs) {
392
+ installConsoleIntegration();
393
+ }
394
+
384
395
  // Cross-kill frame recovery: if a prior run was killed with
385
396
  // unflushed frames, re-upload them linked to that PRIOR session
386
397
  // before the new session takes over. Best-effort, independent of
@@ -608,6 +619,7 @@ export class SDKBootstrapper {
608
619
  this._deepLinkUnsubscribe?.();
609
620
  this._deepLinkUnsubscribe = null;
610
621
  uninstallAlertInstrumentation();
622
+ uninstallConsoleIntegration();
611
623
  this.featureRegistry.teardownAll();
612
624
  }
613
625
  }
@@ -170,6 +170,12 @@ const SHAPE: Record<string, Field> = {
170
170
  },
171
171
  },
172
172
  captureInteractionHeatmap: bool(true),
173
+ // Opt-in: intercept console.* and ship the lines to the Diagnose → Logs lane in SaaS
174
+ // mode. OFF by default — console output can carry PII/secrets and adds ingest volume,
175
+ // so capturing it is the host's explicit choice, not a silent default. When true and a
176
+ // clientKey is present, the bootstrapper arms the console integration (previously only
177
+ // reachable through the desktop-debug tooling, so stock SaaS apps captured nothing).
178
+ captureConsoleLogs: bool(false),
173
179
  ota: {
174
180
  kind: 'obj',
175
181
  opt: true,
@@ -346,6 +352,8 @@ export interface ScaleBunConfig {
346
352
  deltaKeyframeInterval?: number;
347
353
  };
348
354
  captureInteractionHeatmap: boolean;
355
+ /** Opt-in: capture console.* into the Logs lane in SaaS mode. Default false. */
356
+ captureConsoleLogs: boolean;
349
357
  ota?: {
350
358
  enabled: boolean;
351
359
  checkOnForeground: boolean;
@@ -1264,8 +1264,26 @@ class ScaleBunFacade {
1264
1264
  });
1265
1265
  }
1266
1266
 
1267
- /** Log a message (convenience wrapper over track) */
1267
+ /**
1268
+ * Log a message. Delivered to BOTH lanes:
1269
+ * - the Diagnose → Logs lane (tagged `source: 'sdk'`), so an explicit `log()` call shows
1270
+ * up where a developer looks for logs. The method name promised this, but it previously
1271
+ * only emitted a `$log` analytics EVENT and never reached the Logs page.
1272
+ * - the analytics `$log` event (unchanged), so anything already built on it keeps working.
1273
+ * `queueLog` self-gates on `clientKey`, so the Logs-lane write is a no-op outside SaaS mode.
1274
+ */
1268
1275
  public log(level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>) {
1276
+ try {
1277
+ const transport = SessionManager.getExistingInstance()?.getBackendTransport();
1278
+ transport?.queueLog({
1279
+ level,
1280
+ message,
1281
+ source: 'sdk',
1282
+ platform: 'js',
1283
+ timestamp: new Date().toISOString(),
1284
+ ...(data ? { metadata: data } : {}),
1285
+ });
1286
+ } catch { /* no-throw: a logging call must never break the host app */ }
1269
1287
  return this.track('$log', { level, message, ...data });
1270
1288
  }
1271
1289
 
@@ -110,6 +110,12 @@ export interface ScaleBunInitConfig {
110
110
  features?: ScaleBunFeatures;
111
111
  /** Performance pipeline activation flags (tiered, default-safe). */
112
112
  performance?: PerformanceFlags;
113
+ /**
114
+ * Capture `console.*` output into the Diagnose → Logs lane (SaaS mode). Default: **false**.
115
+ * Off by default because console output can carry PII/secrets and adds ingest volume.
116
+ * Requires a `clientKey`; no desktop-debug/devTools setup needed.
117
+ */
118
+ captureConsoleLogs?: boolean;
113
119
  }
114
120
 
115
121
  // ─── User Identity ──────────────────────────────────────────────────────────
@@ -316,6 +322,13 @@ export interface SimplifiedInitConfig {
316
322
  /** Performance pipeline activation flags (tiered, default-safe). */
317
323
  performance?: PerformanceFlags;
318
324
 
325
+ /**
326
+ * Capture `console.*` output into the Diagnose → Logs lane (SaaS mode). Default: **false**.
327
+ * Off by default because console output can carry PII/secrets and adds ingest volume —
328
+ * enable it deliberately. Requires a `clientKey`; no desktop-debug/devTools setup needed.
329
+ */
330
+ captureConsoleLogs?: boolean;
331
+
319
332
  // ─── Phase 1: Envelope event tracking (POST /v1/batch) ──────────────────
320
333
  /** Dashboard App ID. Required to enable the envelope event-tracking lane. */
321
334
  appId?: string;