@scalebun/react-native 1.2.3 → 1.3.1-beta.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/dist/scalebun.full.js +42 -3
- package/dist/scalebun.full.js.map +1 -1
- package/dist/scalebun.slim.js +42 -3
- package/dist/scalebun.slim.js.map +1 -1
- package/lib/commonjs/bootstrap/SDKBootstrapper.js +12 -0
- package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/commonjs/core/config/schema.js +6 -0
- package/lib/commonjs/core/config/schema.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/logs/consoleIntegration.js +19 -0
- package/lib/commonjs/features/replay/integrations/logs/consoleIntegration.js.map +1 -1
- package/lib/commonjs/features/session/SessionManager.js +7 -1
- package/lib/commonjs/features/session/SessionManager.js.map +1 -1
- package/lib/commonjs/public/ScaleBunFacade.js +21 -1
- package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
- package/lib/module/bootstrap/SDKBootstrapper.js +12 -0
- package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/module/core/config/schema.js +6 -0
- package/lib/module/core/config/schema.js.map +1 -1
- package/lib/module/features/replay/integrations/logs/consoleIntegration.js +19 -0
- package/lib/module/features/replay/integrations/logs/consoleIntegration.js.map +1 -1
- package/lib/module/features/session/SessionManager.js +7 -1
- package/lib/module/features/session/SessionManager.js.map +1 -1
- package/lib/module/public/ScaleBunFacade.js +21 -1
- package/lib/module/public/ScaleBunFacade.js.map +1 -1
- package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
- package/lib/typescript/core/config/schema.d.ts +2 -0
- package/lib/typescript/core/config/schema.d.ts.map +1 -1
- package/lib/typescript/features/replay/integrations/logs/consoleIntegration.d.ts.map +1 -1
- package/lib/typescript/features/session/SessionManager.d.ts.map +1 -1
- package/lib/typescript/public/ScaleBunFacade.d.ts +8 -1
- package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
- package/lib/typescript/public/types.d.ts +12 -0
- package/lib/typescript/public/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/SDKBootstrapper.ts +12 -0
- package/src/core/config/schema.ts +8 -0
- package/src/features/replay/integrations/logs/consoleIntegration.ts +20 -0
- package/src/features/session/SessionManager.ts +7 -1
- package/src/public/ScaleBunFacade.ts +19 -1
- 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;
|
|
@@ -25,6 +25,22 @@ const CONSOLE_LEVEL: Record<string, string> = {
|
|
|
25
25
|
debug: 'debug',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Prefixes that identify a log line as SDK-internal. These still print to the real
|
|
30
|
+
* console (developers may want to see them in dev), but they must NEVER be routed
|
|
31
|
+
* into the customer-facing logs lane or replay breadcrumbs — otherwise SDK self-noise
|
|
32
|
+
* (e.g. one [TapDiag] per tap, or internal [ScaleBun:*]/[perf.*] diagnostics) buries
|
|
33
|
+
* the customer's own logs in Diagnose → Logs. `[ReplaySdk]` is handled separately and
|
|
34
|
+
* suppressed entirely (it also trips the RN/Expo error overlay).
|
|
35
|
+
*/
|
|
36
|
+
const SDK_INTERNAL_LOG_PREFIXES = ['[TapDiag]', '[TapAccuracy]', '[ScaleBun', '[perf.'];
|
|
37
|
+
|
|
38
|
+
/** True when a console line is an SDK-internal diagnostic that must not reach customer surfaces. */
|
|
39
|
+
function isSdkInternalLog(firstArg: unknown): boolean {
|
|
40
|
+
return typeof firstArg === 'string'
|
|
41
|
+
&& SDK_INTERNAL_LOG_PREFIXES.some(prefix => firstArg.startsWith(prefix));
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
/**
|
|
29
45
|
* First producer into the logs lane: forward this console call to the backend logs
|
|
30
46
|
* queue (source='console', platform='js'). Additive to the existing breadcrumb capture
|
|
@@ -76,6 +92,10 @@ export function installConsoleIntegration(): void {
|
|
|
76
92
|
// Always call original for non-SDK logs
|
|
77
93
|
original.apply(console, args);
|
|
78
94
|
|
|
95
|
+
// Print SDK-internal diagnostics to the console (dev visibility) but never
|
|
96
|
+
// forward them to the customer-facing logs lane / breadcrumbs.
|
|
97
|
+
if (isSdkInternalLog(firstArg)) return;
|
|
98
|
+
|
|
79
99
|
if (_enabled) {
|
|
80
100
|
try {
|
|
81
101
|
const message = args.map(a => {
|
|
@@ -858,8 +858,14 @@ export class SessionManager {
|
|
|
858
858
|
confidence: p.confidence ?? null,
|
|
859
859
|
source: p.source ?? null,
|
|
860
860
|
};
|
|
861
|
+
// Dev-only diagnostic echo. Must NOT emit in release: the console
|
|
862
|
+
// capture integration (captureConsoleLogs) would otherwise forward
|
|
863
|
+
// one [TapDiag] line per tap into the customer-facing Logs lane and
|
|
864
|
+
// bury their own logs. Sibling [TapAccuracy] log above is __DEV__-gated
|
|
865
|
+
// for the same reason; the heatmap/replay data flows through the
|
|
866
|
+
// interaction pipeline, not this echo, so gating it loses nothing.
|
|
861
867
|
// eslint-disable-next-line no-console
|
|
862
|
-
console.log('[TapDiag]', JSON.stringify(diag));
|
|
868
|
+
if (__DEV__) console.log('[TapDiag]', JSON.stringify(diag));
|
|
863
869
|
} catch { /* no-throw */ }
|
|
864
870
|
}
|
|
865
871
|
|
|
@@ -1264,8 +1264,26 @@ class ScaleBunFacade {
|
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
-
/**
|
|
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
|
|
package/src/public/types.ts
CHANGED
|
@@ -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;
|