@scalebun/react-native 1.2.2-beta.0 → 1.2.2

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.
@@ -7480,6 +7480,7 @@ var init_AppLaunchCollector = __esm({
7480
7480
  "use strict";
7481
7481
  init_getNativePerformanceModule();
7482
7482
  init_models();
7483
+ init_internalLogger();
7483
7484
  JS_IMPORT_TIME = Date.now();
7484
7485
  AppLaunchCollector = class {
7485
7486
  collected = false;
@@ -7497,10 +7498,19 @@ var init_AppLaunchCollector = __esm({
7497
7498
  if (this.collected || !this.config.appLaunch) return;
7498
7499
  try {
7499
7500
  const perfModule = getNativePerformanceModule();
7500
- if (!perfModule?.getAppStartInfo) return;
7501
+ if (!perfModule?.getAppStartInfo) {
7502
+ logger.debug("[perf.trace] AppLaunchCollector: native perf module unavailable \u2014 no app_launch");
7503
+ return;
7504
+ }
7501
7505
  const jsReadyTimestamp = Date.now();
7502
7506
  const info = await perfModule.getAppStartInfo();
7503
- if (!info || typeof info.durationMs !== "number") return;
7507
+ if (!info || typeof info.durationMs !== "number") {
7508
+ logger.debug("[perf.trace] AppLaunchCollector: getAppStartInfo returned no usable duration \u2014 no app_launch", {
7509
+ hasInfo: !!info,
7510
+ durationType: typeof info?.durationMs
7511
+ });
7512
+ return;
7513
+ }
7504
7514
  this.collected = true;
7505
7515
  const breakdown = {};
7506
7516
  const phaseLabels = {};
@@ -7545,8 +7555,15 @@ var init_AppLaunchCollector = __esm({
7545
7555
  breakdown: hasBreakdown ? breakdown : void 0,
7546
7556
  phaseLabels: hasBreakdown ? phaseLabels : void 0
7547
7557
  };
7558
+ logger.debug("[perf.trace] AppLaunchCollector: app_launch built, invoking handler", {
7559
+ durationMs: event.durationMs,
7560
+ launchType: event.launchType
7561
+ });
7548
7562
  this.onLaunch(event);
7549
- } catch {
7563
+ } catch (e) {
7564
+ logger.debug("[perf.trace] AppLaunchCollector: collect() threw", {
7565
+ message: e?.message
7566
+ });
7550
7567
  }
7551
7568
  }
7552
7569
  };
@@ -8341,6 +8358,7 @@ var init_PerformanceFeature = __esm({
8341
8358
  init_PerformanceTransport();
8342
8359
  init_MetricsEngine();
8343
8360
  init_SessionManager();
8361
+ init_internalLogger();
8344
8362
  PerformanceFeature = class _PerformanceFeature {
8345
8363
  name = "performance";
8346
8364
  active = false;
@@ -8741,7 +8759,14 @@ var init_PerformanceFeature = __esm({
8741
8759
  * flushes the backlog in the order the metrics were produced.
8742
8760
  */
8743
8761
  _forwardMetricToBackend(metric) {
8744
- const backendTransport = SessionManager.getExistingInstance()?.getBackendTransport();
8762
+ const sm = SessionManager.getExistingInstance();
8763
+ const backendTransport = sm?.getBackendTransport();
8764
+ logger.debug("[perf.trace] forwardMetricToBackend", {
8765
+ type: metric.type,
8766
+ hasSessionManager: !!sm,
8767
+ hasBackendTransport: !!backendTransport,
8768
+ buffered: this._pendingBackendMetrics.length
8769
+ });
8745
8770
  if (backendTransport) {
8746
8771
  this._drainPendingBackendMetrics(backendTransport);
8747
8772
  backendTransport.queuePerformanceMetric(metric);
@@ -8761,6 +8786,9 @@ var init_PerformanceFeature = __esm({
8761
8786
  for (const metric of buffered) {
8762
8787
  backendTransport.queuePerformanceMetric(metric);
8763
8788
  }
8789
+ logger.debug("[perf.trace] drained buffered metrics to backend", {
8790
+ count: buffered.length
8791
+ });
8764
8792
  this._clearBackendDrainTimer();
8765
8793
  this._backendDrainAttempts = 0;
8766
8794
  }
@@ -8773,7 +8801,13 @@ var init_PerformanceFeature = __esm({
8773
8801
  */
8774
8802
  _scheduleBackendDrain() {
8775
8803
  if (this._backendDrainTimer) return;
8776
- if (this._backendDrainAttempts >= _PerformanceFeature.BACKEND_DRAIN_MAX_ATTEMPTS) return;
8804
+ if (this._backendDrainAttempts >= _PerformanceFeature.BACKEND_DRAIN_MAX_ATTEMPTS) {
8805
+ logger.warn("[perf.trace] drain gave up \u2014 buffered metrics never reached the backend", {
8806
+ attempts: this._backendDrainAttempts,
8807
+ dropped: this._pendingBackendMetrics.length
8808
+ });
8809
+ return;
8810
+ }
8777
8811
  const delays = _PerformanceFeature.BACKEND_DRAIN_DELAYS;
8778
8812
  const delay = delays[Math.min(this._backendDrainAttempts, delays.length - 1)];
8779
8813
  this._backendDrainAttempts++;
@@ -15762,7 +15796,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
15762
15796
  clientId: this._clientId(),
15763
15797
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
15764
15798
  });
15765
- logger.debug("[perf.queue] enqueued performance metric", {
15799
+ logger.debug("[perf.trace] queue enqueued performance metric", {
15766
15800
  type: data.type,
15767
15801
  pending: this.pendingPerformanceMetrics.length
15768
15802
  });
@@ -16334,7 +16368,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
16334
16368
  async _flushPerformance() {
16335
16369
  if (this.pendingPerformanceMetrics.length === 0) return;
16336
16370
  if (!this.currentSessionId || !this.config.clientKey) {
16337
- logger.debug("[perf.flush] waiting \u2014 not deliverable yet", {
16371
+ logger.debug("[perf.trace] flush waiting \u2014 not deliverable yet", {
16338
16372
  pending: this.pendingPerformanceMetrics.length,
16339
16373
  hasSession: !!this.currentSessionId,
16340
16374
  hasClientKey: !!this.config.clientKey
@@ -16344,13 +16378,13 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
16344
16378
  const batch = this.pendingPerformanceMetrics.splice(0, 50);
16345
16379
  try {
16346
16380
  if (await this._enqueueNative("performance", batch)) {
16347
- logger.debug("[perf.flush] handed to native outbox", {
16381
+ logger.debug("[perf.trace] flush handed to native outbox", {
16348
16382
  count: batch.length
16349
16383
  });
16350
16384
  return;
16351
16385
  }
16352
16386
  if (!this._sessionRowReady()) {
16353
- logger.debug("[perf.flush] session row not ready \u2014 re-buffering", {
16387
+ logger.debug("[perf.trace] flush session row not ready \u2014 re-buffering", {
16354
16388
  count: batch.length
16355
16389
  });
16356
16390
  this.pendingPerformanceMetrics.unshift(...batch);
@@ -16359,7 +16393,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
16359
16393
  await this._post(ENDPOINTS.INGESTION_PERFORMANCE(this.currentSessionId), {
16360
16394
  metrics: batch
16361
16395
  });
16362
- logger.info("[perf.flush] POST performance metrics ok", {
16396
+ logger.debug("[perf.trace] flush POST performance metrics ok", {
16363
16397
  count: batch.length
16364
16398
  });
16365
16399
  } catch (err) {