chore(voice): trim dead exports, fix duplicate-OR bug, drop redundant comments

Branch review pass:
- useWhatsappCallSession: drop unused `error` ref and unused exports
  (hasActiveWhatsappCall, isWhatsappCallMuted), fold sendWhatsappCallBeacon
  into a private beaconTerminate helper since only sendWhatsappTerminateBeacon
  consumed it externally. Trim WHAT-comments; keep WHY-comments
  (browser-quirk explanations, race-condition notes, auth-cookie rationale).
- VoiceCall.vue bubble: fix `data || data` short-circuit that did nothing —
  upstream key transform was the same on both branches; collapse to one read.
- calls/useCallSession/actionCable/FloatingCallWidget/VoiceCallButton:
  drop comments that just describe what the next line already says.

Net diff: -63 lines across 7 files. No behavior change.
This commit is contained in:
Tanmay Deep Sharma
2026-05-04 15:16:04 +07:00
parent 6179adac22
commit 0b1ad1a854
7 changed files with 88 additions and 151 deletions
@@ -40,8 +40,6 @@ class ActionCableConnector extends BaseActionCableConnector {
'account.cache_invalidated': this.onCacheInvalidate,
'account.enrichment_completed': this.onEnrichmentCompleted,
'copilot.message.created': this.onCopilotMessageCreated,
// WhatsApp call SDP exchange happens via these events; Twilio-shaped voice_call.*
// events also flow through here but are ignored when provider !== 'whatsapp'.
'voice_call.incoming': this.onVoiceCallIncoming,
'voice_call.outbound_connected': this.onVoiceCallOutboundConnected,
'voice_call.ended': this.onVoiceCallEnded,
@@ -228,8 +226,6 @@ class ActionCableConnector extends BaseActionCableConnector {
provider: 'whatsapp',
sdpOffer: data.sdp_offer,
iceServers: data.ice_servers,
// Caller info for the FloatingCallWidget so it doesn't show "Unknown caller"
// before the conversation/contact has loaded into the store.
caller: data.caller,
});
};
@@ -243,13 +239,12 @@ class ActionCableConnector extends BaseActionCableConnector {
// eslint-disable-next-line class-methods-use-this
onVoiceCallEnded = async data => {
if (data?.provider !== 'whatsapp') return;
// Must await the upload-and-cleanup BEFORE removeCall, because the store's
// sync teardownByProvider -> cleanupWhatsappSession would otherwise wipe
// mediaRecorder + recorderChunks before any upload microtask gets to run.
// Await upload before removeCall the store's sync teardown would otherwise
// wipe the recorder chunks before they reach the server.
try {
await handleWhatsappRemoteEnd(data.id);
} catch (_) {
/* noop — upload is best-effort */
/* noop */
}
useCallsStore().removeCall(data.call_id);
};