@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
@@ -6105,7 +6105,7 @@ var init_SessionManager = __esm({
6105
6105
  confidence: p.confidence ?? null,
6106
6106
  source: p.source ?? null
6107
6107
  };
6108
- console.log("[TapDiag]", JSON.stringify(diag));
6108
+ if (__DEV__) console.log("[TapDiag]", JSON.stringify(diag));
6109
6109
  } catch {
6110
6110
  }
6111
6111
  }
@@ -6362,6 +6362,9 @@ var init_SessionManager = __esm({
6362
6362
  });
6363
6363
 
6364
6364
  // lib/module/features/replay/integrations/logs/consoleIntegration.js
6365
+ function isSdkInternalLog(firstArg) {
6366
+ return typeof firstArg === "string" && SDK_INTERNAL_LOG_PREFIXES.some((prefix) => firstArg.startsWith(prefix));
6367
+ }
6365
6368
  function forwardToLogsLane(method, message) {
6366
6369
  try {
6367
6370
  const transport = SessionManager.getExistingInstance()?.getBackendTransport();
@@ -6386,6 +6389,7 @@ function installConsoleIntegration() {
6386
6389
  const firstArg = args[0];
6387
6390
  if (typeof firstArg === "string" && firstArg.startsWith("[ReplaySdk]")) return;
6388
6391
  original.apply(console, args);
6392
+ if (isSdkInternalLog(firstArg)) return;
6389
6393
  if (_enabled) {
6390
6394
  try {
6391
6395
  const message = args.map((a) => {
@@ -6418,7 +6422,7 @@ function uninstallConsoleIntegration() {
6418
6422
  function setConsoleEnabled(enabled) {
6419
6423
  _enabled = enabled;
6420
6424
  }
6421
- var _installed, _enabled, CONSOLE_LEVEL, _originals;
6425
+ var _installed, _enabled, CONSOLE_LEVEL, SDK_INTERNAL_LOG_PREFIXES, _originals;
6422
6426
  var init_consoleIntegration = __esm({
6423
6427
  "lib/module/features/replay/integrations/logs/consoleIntegration.js"() {
6424
6428
  "use strict";
@@ -6433,6 +6437,7 @@ var init_consoleIntegration = __esm({
6433
6437
  error: "error",
6434
6438
  debug: "debug"
6435
6439
  };
6440
+ SDK_INTERNAL_LOG_PREFIXES = ["[TapDiag]", "[TapAccuracy]", "[ScaleBun", "[perf."];
6436
6441
  _originals = {
6437
6442
  log: console.log,
6438
6443
  info: console.info,
@@ -14031,6 +14036,12 @@ var SHAPE = {
14031
14036
  }
14032
14037
  },
14033
14038
  captureInteractionHeatmap: bool(true),
14039
+ // Opt-in: intercept console.* and ship the lines to the Diagnose → Logs lane in SaaS
14040
+ // mode. OFF by default — console output can carry PII/secrets and adds ingest volume,
14041
+ // so capturing it is the host's explicit choice, not a silent default. When true and a
14042
+ // clientKey is present, the bootstrapper arms the console integration (previously only
14043
+ // reachable through the desktop-debug tooling, so stock SaaS apps captured nothing).
14044
+ captureConsoleLogs: bool(false),
14034
14045
  ota: {
14035
14046
  kind: "obj",
14036
14047
  opt: true,
@@ -15283,6 +15294,9 @@ function uninstallAlertInstrumentation() {
15283
15294
  installed = false;
15284
15295
  }
15285
15296
 
15297
+ // lib/module/bootstrap/SDKBootstrapper.js
15298
+ init_consoleIntegration();
15299
+
15286
15300
  // lib/module/features/session/BackendSessionAdapter.js
15287
15301
  init_internalLogger();
15288
15302
 
@@ -16795,6 +16809,9 @@ var SDKBootstrapper = class {
16795
16809
  }
16796
16810
  });
16797
16811
  sessionManager.setBackendTransport(backendAdapter);
16812
+ if (this.config.clientKey && this.config.captureConsoleLogs) {
16813
+ installConsoleIntegration();
16814
+ }
16798
16815
  backendAdapter.recoverPersistedFrames().catch(() => {
16799
16816
  });
16800
16817
  if (this.config.clientKey) {
@@ -16981,6 +16998,7 @@ var SDKBootstrapper = class {
16981
16998
  this._deepLinkUnsubscribe?.();
16982
16999
  this._deepLinkUnsubscribe = null;
16983
17000
  uninstallAlertInstrumentation();
17001
+ uninstallConsoleIntegration();
16984
17002
  this.featureRegistry.teardownAll();
16985
17003
  }
16986
17004
  };
@@ -20321,8 +20339,29 @@ var ScaleBunFacade = class {
20321
20339
  }
20322
20340
  });
20323
20341
  }
20324
- /** Log a message (convenience wrapper over track) */
20342
+ /**
20343
+ * Log a message. Delivered to BOTH lanes:
20344
+ * - the Diagnose → Logs lane (tagged `source: 'sdk'`), so an explicit `log()` call shows
20345
+ * up where a developer looks for logs. The method name promised this, but it previously
20346
+ * only emitted a `$log` analytics EVENT and never reached the Logs page.
20347
+ * - the analytics `$log` event (unchanged), so anything already built on it keeps working.
20348
+ * `queueLog` self-gates on `clientKey`, so the Logs-lane write is a no-op outside SaaS mode.
20349
+ */
20325
20350
  log(level, message, data) {
20351
+ try {
20352
+ const transport = SessionManager.getExistingInstance()?.getBackendTransport();
20353
+ transport?.queueLog({
20354
+ level,
20355
+ message,
20356
+ source: "sdk",
20357
+ platform: "js",
20358
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
20359
+ ...data ? {
20360
+ metadata: data
20361
+ } : {}
20362
+ });
20363
+ } catch {
20364
+ }
20326
20365
  return this.track("$log", {
20327
20366
  level,
20328
20367
  message,