@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.
Files changed (40) hide show
  1. package/dist/scalebun.full.js +42 -3
  2. package/dist/scalebun.full.js.map +1 -1
  3. package/dist/scalebun.slim.js +42 -3
  4. package/dist/scalebun.slim.js.map +1 -1
  5. package/lib/commonjs/bootstrap/SDKBootstrapper.js +12 -0
  6. package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
  7. package/lib/commonjs/core/config/schema.js +6 -0
  8. package/lib/commonjs/core/config/schema.js.map +1 -1
  9. package/lib/commonjs/features/replay/integrations/logs/consoleIntegration.js +19 -0
  10. package/lib/commonjs/features/replay/integrations/logs/consoleIntegration.js.map +1 -1
  11. package/lib/commonjs/features/session/SessionManager.js +7 -1
  12. package/lib/commonjs/features/session/SessionManager.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/features/replay/integrations/logs/consoleIntegration.js +19 -0
  20. package/lib/module/features/replay/integrations/logs/consoleIntegration.js.map +1 -1
  21. package/lib/module/features/session/SessionManager.js +7 -1
  22. package/lib/module/features/session/SessionManager.js.map +1 -1
  23. package/lib/module/public/ScaleBunFacade.js +21 -1
  24. package/lib/module/public/ScaleBunFacade.js.map +1 -1
  25. package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
  26. package/lib/typescript/core/config/schema.d.ts +2 -0
  27. package/lib/typescript/core/config/schema.d.ts.map +1 -1
  28. package/lib/typescript/features/replay/integrations/logs/consoleIntegration.d.ts.map +1 -1
  29. package/lib/typescript/features/session/SessionManager.d.ts.map +1 -1
  30. package/lib/typescript/public/ScaleBunFacade.d.ts +8 -1
  31. package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
  32. package/lib/typescript/public/types.d.ts +12 -0
  33. package/lib/typescript/public/types.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/src/bootstrap/SDKBootstrapper.ts +12 -0
  36. package/src/core/config/schema.ts +8 -0
  37. package/src/features/replay/integrations/logs/consoleIntegration.ts +20 -0
  38. package/src/features/session/SessionManager.ts +7 -1
  39. package/src/public/ScaleBunFacade.ts +19 -1
  40. package/src/public/types.ts +13 -0
@@ -4006,7 +4006,7 @@ var init_SessionManager = __esm({
4006
4006
  confidence: p.confidence ?? null,
4007
4007
  source: p.source ?? null
4008
4008
  };
4009
- console.log("[TapDiag]", JSON.stringify(diag));
4009
+ if (__DEV__) console.log("[TapDiag]", JSON.stringify(diag));
4010
4010
  } catch {
4011
4011
  }
4012
4012
  }
@@ -4263,6 +4263,9 @@ var init_SessionManager = __esm({
4263
4263
  });
4264
4264
 
4265
4265
  // lib/module/features/replay/integrations/logs/consoleIntegration.js
4266
+ function isSdkInternalLog(firstArg) {
4267
+ return typeof firstArg === "string" && SDK_INTERNAL_LOG_PREFIXES.some((prefix) => firstArg.startsWith(prefix));
4268
+ }
4266
4269
  function forwardToLogsLane(method, message) {
4267
4270
  try {
4268
4271
  const transport = SessionManager.getExistingInstance()?.getBackendTransport();
@@ -4287,6 +4290,7 @@ function installConsoleIntegration() {
4287
4290
  const firstArg = args[0];
4288
4291
  if (typeof firstArg === "string" && firstArg.startsWith("[ReplaySdk]")) return;
4289
4292
  original.apply(console, args);
4293
+ if (isSdkInternalLog(firstArg)) return;
4290
4294
  if (_enabled) {
4291
4295
  try {
4292
4296
  const message = args.map((a) => {
@@ -4319,7 +4323,7 @@ function uninstallConsoleIntegration() {
4319
4323
  function setConsoleEnabled(enabled) {
4320
4324
  _enabled = enabled;
4321
4325
  }
4322
- var _installed, _enabled, CONSOLE_LEVEL, _originals;
4326
+ var _installed, _enabled, CONSOLE_LEVEL, SDK_INTERNAL_LOG_PREFIXES, _originals;
4323
4327
  var init_consoleIntegration = __esm({
4324
4328
  "lib/module/features/replay/integrations/logs/consoleIntegration.js"() {
4325
4329
  "use strict";
@@ -4334,6 +4338,7 @@ var init_consoleIntegration = __esm({
4334
4338
  error: "error",
4335
4339
  debug: "debug"
4336
4340
  };
4341
+ SDK_INTERNAL_LOG_PREFIXES = ["[TapDiag]", "[TapAccuracy]", "[ScaleBun", "[perf."];
4337
4342
  _originals = {
4338
4343
  log: console.log,
4339
4344
  info: console.info,
@@ -9419,6 +9424,12 @@ var SHAPE = {
9419
9424
  }
9420
9425
  },
9421
9426
  captureInteractionHeatmap: bool(true),
9427
+ // Opt-in: intercept console.* and ship the lines to the Diagnose → Logs lane in SaaS
9428
+ // mode. OFF by default — console output can carry PII/secrets and adds ingest volume,
9429
+ // so capturing it is the host's explicit choice, not a silent default. When true and a
9430
+ // clientKey is present, the bootstrapper arms the console integration (previously only
9431
+ // reachable through the desktop-debug tooling, so stock SaaS apps captured nothing).
9432
+ captureConsoleLogs: bool(false),
9422
9433
  ota: {
9423
9434
  kind: "obj",
9424
9435
  opt: true,
@@ -12082,6 +12093,9 @@ function uninstallAlertInstrumentation() {
12082
12093
  installed = false;
12083
12094
  }
12084
12095
 
12096
+ // lib/module/bootstrap/SDKBootstrapper.js
12097
+ init_consoleIntegration();
12098
+
12085
12099
  // lib/module/features/session/BackendSessionAdapter.js
12086
12100
  init_internalLogger();
12087
12101
 
@@ -13594,6 +13608,9 @@ var SDKBootstrapper = class {
13594
13608
  }
13595
13609
  });
13596
13610
  sessionManager.setBackendTransport(backendAdapter);
13611
+ if (this.config.clientKey && this.config.captureConsoleLogs) {
13612
+ installConsoleIntegration();
13613
+ }
13597
13614
  backendAdapter.recoverPersistedFrames().catch(() => {
13598
13615
  });
13599
13616
  if (this.config.clientKey) {
@@ -13780,6 +13797,7 @@ var SDKBootstrapper = class {
13780
13797
  this._deepLinkUnsubscribe?.();
13781
13798
  this._deepLinkUnsubscribe = null;
13782
13799
  uninstallAlertInstrumentation();
13800
+ uninstallConsoleIntegration();
13783
13801
  this.featureRegistry.teardownAll();
13784
13802
  }
13785
13803
  };
@@ -17119,8 +17137,29 @@ var ScaleBunFacade = class {
17119
17137
  }
17120
17138
  });
17121
17139
  }
17122
- /** Log a message (convenience wrapper over track) */
17140
+ /**
17141
+ * Log a message. Delivered to BOTH lanes:
17142
+ * - the Diagnose → Logs lane (tagged `source: 'sdk'`), so an explicit `log()` call shows
17143
+ * up where a developer looks for logs. The method name promised this, but it previously
17144
+ * only emitted a `$log` analytics EVENT and never reached the Logs page.
17145
+ * - the analytics `$log` event (unchanged), so anything already built on it keeps working.
17146
+ * `queueLog` self-gates on `clientKey`, so the Logs-lane write is a no-op outside SaaS mode.
17147
+ */
17123
17148
  log(level, message, data) {
17149
+ try {
17150
+ const transport = SessionManager.getExistingInstance()?.getBackendTransport();
17151
+ transport?.queueLog({
17152
+ level,
17153
+ message,
17154
+ source: "sdk",
17155
+ platform: "js",
17156
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
17157
+ ...data ? {
17158
+ metadata: data
17159
+ } : {}
17160
+ });
17161
+ } catch {
17162
+ }
17124
17163
  return this.track("$log", {
17125
17164
  level,
17126
17165
  message,