@meshconnect/uwc-core 1.2.2 → 1.2.3-snapshot.bd9aae7

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.
@@ -154,6 +154,14 @@ export interface UWCTelemetryEvent {
154
154
  * handoffCovered to avoid double-counting.
155
155
  */
156
156
  handoffCovered?: boolean | undefined
157
+ /** `pageVisibleDuringHandoff` only: how long the page was hidden for that segment (ms). */
158
+ hiddenMs?: number | undefined
159
+ /** Handoff terminals: cumulative time the page was backgrounded during the handoff (ms). */
160
+ backgroundedMs?: number | undefined
161
+ /** Handoff terminals: how many times the page was backgrounded during the handoff. */
162
+ backgroundCount?: number | undefined
163
+ /** Handoff terminals, WalletConnect only: relay-socket drops seen while the handoff was pending. */
164
+ relayDropCount?: number | undefined
157
165
  }
158
166
 
159
167
  /**
@@ -362,7 +370,10 @@ function buildTelemetryEvent<K extends UWCEventName>(
362
370
  durationMs: d.durationMs,
363
371
  timedOut: d.timedOut,
364
372
  timeoutMs: d.timeoutMs,
365
- targetAlreadyActive: d.targetAlreadyActive
373
+ targetAlreadyActive: d.targetAlreadyActive,
374
+ backgroundedMs: d.backgroundedMs,
375
+ backgroundCount: d.backgroundCount,
376
+ relayDropCount: d.relayDropCount
366
377
  }
367
378
  }
368
379
  case 'walletRejected': {
@@ -381,7 +392,10 @@ function buildTelemetryEvent<K extends UWCEventName>(
381
392
  targetAlreadyActive: d.targetAlreadyActive,
382
393
  errorCode: d.errorCode,
383
394
  failureKind: d.failureKind,
384
- source: d.source
395
+ source: d.source,
396
+ backgroundedMs: d.backgroundedMs,
397
+ backgroundCount: d.backgroundCount,
398
+ relayDropCount: d.relayDropCount
385
399
  }
386
400
  }
387
401
  case 'walletTimedOut': {
@@ -396,7 +410,10 @@ function buildTelemetryEvent<K extends UWCEventName>(
396
410
  handoffId: d.handoffId,
397
411
  durationMs: d.durationMs,
398
412
  timeoutMs: d.timeoutMs,
399
- targetAlreadyActive: d.targetAlreadyActive
413
+ targetAlreadyActive: d.targetAlreadyActive,
414
+ backgroundedMs: d.backgroundedMs,
415
+ backgroundCount: d.backgroundCount,
416
+ relayDropCount: d.relayDropCount
400
417
  }
401
418
  }
402
419
  case 'walletFailed': {
@@ -416,7 +433,10 @@ function buildTelemetryEvent<K extends UWCEventName>(
416
433
  errorCode: d.errorCode,
417
434
  failureKind: d.failureKind,
418
435
  source: d.source,
419
- error: { type: d.error.type, message: scrubMessage(d.error.message) }
436
+ error: { type: d.error.type, message: scrubMessage(d.error.message) },
437
+ backgroundedMs: d.backgroundedMs,
438
+ backgroundCount: d.backgroundCount,
439
+ relayDropCount: d.relayDropCount
420
440
  }
421
441
  }
422
442
  case 'capabilitiesUpdated': {
@@ -448,8 +468,15 @@ function buildTelemetryEvent<K extends UWCEventName>(
448
468
  }
449
469
  case 'pageHiddenDuringHandoff':
450
470
  case 'pageVisibleDuringHandoff': {
451
- const d = data as UWCEventMap['pageHiddenDuringHandoff']
452
- return { ...base, handoffId: d.handoffId, platform: d.platform }
471
+ // Cast to the visible shape (superset). `hiddenMs` is absent on the hidden
472
+ // event undefined dropped by compactUndefined.
473
+ const d = data as UWCEventMap['pageVisibleDuringHandoff']
474
+ return {
475
+ ...base,
476
+ handoffId: d.handoffId,
477
+ platform: d.platform,
478
+ hiddenMs: d.hiddenMs
479
+ }
453
480
  }
454
481
  case 'bridgeError': {
455
482
  const d = data as UWCEventMap['bridgeError']
@@ -473,6 +500,31 @@ function buildTelemetryEvent<K extends UWCEventName>(
473
500
  error: { type: d.error.type, message: scrubMessage(d.error.message) }
474
501
  }
475
502
  }
503
+ case 'relayDisconnected': {
504
+ const d = data as UWCEventMap['relayDisconnected']
505
+ // The relay socket dropped. Observational, NOT a failure: a drop only
506
+ // matters if a round-trip was in flight — deliberately left without a
507
+ // `failureKind` so it never inflates failure metrics. Pair with
508
+ // `relayReconnected` (same sdkSessionId) for the dead-window duration.
509
+ return {
510
+ ...base,
511
+ connectionMode: 'walletConnect',
512
+ source: 'provider',
513
+ ...(d.error
514
+ ? {
515
+ error: {
516
+ type: d.error.type,
517
+ message: scrubMessage(d.error.message)
518
+ }
519
+ }
520
+ : {})
521
+ }
522
+ }
523
+ case 'relayReconnected': {
524
+ // Socket recovered. Name-only + mode; the diagnostic value is the timestamp
525
+ // relative to the paired `relayDisconnected`.
526
+ return { ...base, connectionMode: 'walletConnect', source: 'provider' }
527
+ }
476
528
  case 'walletConnectInitError': {
477
529
  const d = data as UWCEventMap['walletConnectInitError']
478
530
  // SignClient.init failed — the WC client never came up. Distinct from
@@ -325,7 +325,17 @@ export class UniversalWalletConnector {
325
325
  (error: unknown) =>
326
326
  this.eventManager.emit('walletConnectInitError', {
327
327
  error: toWalletError(error)
328
- })
328
+ }),
329
+ // Relay transport dropped — capture the FACT (+ scrubbed reason if any) so a
330
+ // socket death during a wallet deep-link is visible, not silent (CARE-263).
331
+ (detail: unknown) =>
332
+ this.eventManager.emit(
333
+ 'relayDisconnected',
334
+ detail ? { error: toWalletError(detail) } : {}
335
+ ),
336
+ // Relay transport recovered — pair with `relayDisconnected` (same
337
+ // sdkSessionId) to measure the dead window.
338
+ () => this.eventManager.emit('relayReconnected', undefined)
329
339
  )
330
340
  )
331
341
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated from package.json by scripts/generate-version.mjs — do not edit.
2
- export const UWC_CORE_VERSION = '1.2.2'
2
+ export const UWC_CORE_VERSION = '1.2.3'