@signalwire/js 4.0.0-dev-20260915135732 → 4.0.0-dev-20260915175740

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/browser.mjs CHANGED
@@ -12536,8 +12536,36 @@ var AttachManager = class {
12536
12536
  logger$26.warn("[AttachManager] Skip attach for calls with no destination");
12537
12537
  return;
12538
12538
  }
12539
+ const attachment = this.buildAttachment(call, call.to);
12540
+ await this.mutate((attached) => ({
12541
+ ...attached,
12542
+ [call.id]: attachment
12543
+ }));
12544
+ }
12545
+ /**
12546
+ * Keep an already-stored call's reference alive and current — the periodic
12547
+ * refresh the `verto.ping` keepalive drives.
12548
+ *
12549
+ * Only ever updates: a call with no record is one nothing wants reattached,
12550
+ * and re-creating it here would undo a `detach`. That matters because a ping
12551
+ * can land in the window between `bye()` detaching and the call being torn
12552
+ * down, and a record revived there survives the hangup — so the next page
12553
+ * load dials a call nobody is on. The existence check and the write share
12554
+ * one {@link mutate} turn, so a concurrent detach cannot slip between them.
12555
+ */
12556
+ async refresh(call) {
12557
+ if (!call.to) return;
12539
12558
  const destination = call.to;
12540
- const attachment = {
12559
+ await this.mutate((attached) => {
12560
+ if (!Object.hasOwn(attached, call.id)) return attached;
12561
+ return {
12562
+ ...attached,
12563
+ [call.id]: this.buildAttachment(call, destination)
12564
+ };
12565
+ });
12566
+ }
12567
+ buildAttachment(call, destination) {
12568
+ return {
12541
12569
  nodeId: call.nodeId,
12542
12570
  destination,
12543
12571
  mediaDirections: call.mediaDirections,
@@ -12545,10 +12573,6 @@ var AttachManager = class {
12545
12573
  videoInputDevice: call.mediaDirections.video !== "inactive" ? this.deviceController.selectedVideoInputDevice : null,
12546
12574
  attachedAt: Date.now()
12547
12575
  };
12548
- await this.mutate((attached) => ({
12549
- ...attached,
12550
- [call.id]: attachment
12551
- }));
12552
12576
  }
12553
12577
  async detach(call) {
12554
12578
  await this.mutate((attached) => {
@@ -17298,7 +17322,7 @@ var WebRTCVertoManager = class extends VertoManager {
17298
17322
  this.applyServerMediaParams(rtcPeerConnController, audio, video);
17299
17323
  });
17300
17324
  this.subscribeTo(this.vertoPing$, (vertoPing) => {
17301
- this.attachManager.attach(this.buildAttachableCall());
17325
+ this.attachManager.refresh(this.buildAttachableCall());
17302
17326
  this.sendVertoPong(vertoPing);
17303
17327
  });
17304
17328
  }
@@ -17660,7 +17684,7 @@ var WebRTCVertoManager = class extends VertoManager {
17660
17684
  this.emitMainSignalingStatus(rtcPeerConnController.id, "trying");
17661
17685
  const nodeId = getValueFrom(response, "result.node_id") ?? null;
17662
17686
  const memberId = getValueFrom(response, "result.result.result.memberID") ?? null;
17663
- const callId = getValueFrom(response, "result.result.result.callID") ?? null;
17687
+ const callId = getValueFrom(response, "result.result.result.callID");
17664
17688
  logger$16.debug("[WebRTCManager] Verto invite response:", {
17665
17689
  callId,
17666
17690
  memberId,
@@ -17671,14 +17695,9 @@ var WebRTCVertoManager = class extends VertoManager {
17671
17695
  if (rtcPeerConnController.isMainDevice) {
17672
17696
  this._selfId$.next(memberId);
17673
17697
  this._nodeId$.next(nodeId);
17674
- }
17675
- if (callId) {
17676
- this.webRtcCallSession.addCallId(callId);
17677
17698
  this.attachManager.attach(this.buildAttachableCall(callId, nodeId ?? void 0));
17678
- } else logger$16.warn("[WebRTCManager] Cannot attach call, missing callId:", {
17679
- nodeId: this.nodeId,
17680
- callId
17681
- });
17699
+ }
17700
+ if (callId) this.webRtcCallSession.addCallId(callId);
17682
17701
  logger$16.info("[WebRTCManager] Verto invite successful");
17683
17702
  logger$16.debug(`[WebRTCManager] nodeid: ${this._nodeId$.value}, selfId: ${this._selfId$.value}`);
17684
17703
  } else {
@@ -23122,7 +23141,7 @@ var SignalWire = class extends Destroyable {
23122
23141
  logger$1.warn("[SignalWire] Failed to initialize VisibilityController:", error);
23123
23142
  }
23124
23143
  try {
23125
- this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260915135732" });
23144
+ this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260915175740" });
23126
23145
  } catch (error) {
23127
23146
  logger$1.warn("[SignalWire] Failed to initialize DiagnosticsCollector:", error);
23128
23147
  }
@@ -23677,7 +23696,7 @@ var StaticCredentialProvider = class {
23677
23696
  /**
23678
23697
  * Library version from package.json, injected at build time.
23679
23698
  */
23680
- const version = "4.0.0-dev-20260915135732";
23699
+ const version = "4.0.0-dev-20260915175740";
23681
23700
  /**
23682
23701
  * Flag indicating the library has been loaded and is ready to use.
23683
23702
  * For UMD builds: `window.SignalWire.ready`
@@ -23699,7 +23718,7 @@ const ready = true;
23699
23718
  */
23700
23719
  const emitReadyEvent = () => {
23701
23720
  if (typeof window !== "undefined") {
23702
- const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260915135732" } });
23721
+ const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260915175740" } });
23703
23722
  window.dispatchEvent(event);
23704
23723
  }
23705
23724
  };