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:
@@ -44,7 +44,6 @@ const voiceInboxes = computed(() =>
|
||||
);
|
||||
const hasVoiceInboxes = computed(() => voiceInboxes.value.length > 0);
|
||||
|
||||
// Unified behavior: hide when no phone
|
||||
const shouldRender = computed(() => hasVoiceInboxes.value && !!props.phone);
|
||||
|
||||
const isInitiatingCall = computed(() => {
|
||||
@@ -128,7 +127,6 @@ const startCall = async inboxId => {
|
||||
});
|
||||
const { call_sid: callSid, conversation_id: conversationId } = response;
|
||||
|
||||
// Add call to store immediately so widget shows
|
||||
const callsStore = useCallsStore();
|
||||
callsStore.addCall({
|
||||
callSid,
|
||||
|
||||
@@ -43,15 +43,14 @@ const audioAttachment = computed(() =>
|
||||
(attachments?.value || []).find(a => a.fileType === 'audio')
|
||||
);
|
||||
|
||||
// Duration lives in two places depending on which payload the FE got:
|
||||
// - call.duration_seconds / call.durationSeconds (push_event_data shape)
|
||||
// - content_attributes.data.duration_seconds (message-side mirror)
|
||||
// Both can be camelCased by useTransformKeys upstream — check every variant.
|
||||
// Duration may arrive on call.duration_seconds (push_event_data) or
|
||||
// content_attributes.data.duration_seconds — and either may be camelCased
|
||||
// upstream, so check every variant.
|
||||
const durationSeconds = computed(() => {
|
||||
const fromCall = call.value?.durationSeconds || call.value?.duration_seconds;
|
||||
if (fromCall != null) return fromCall;
|
||||
|
||||
const data = contentAttributes?.value?.data || contentAttributes?.value?.data;
|
||||
const data = contentAttributes?.value?.data;
|
||||
return data?.durationSeconds || data?.duration_seconds;
|
||||
});
|
||||
|
||||
@@ -118,8 +117,6 @@ const bgColor = computed(() => BG_COLOR_MAP[status.value] || 'bg-n-teal-9');
|
||||
{{ $t(labelKey) }}
|
||||
</span>
|
||||
<span class="text-xs text-n-slate-11">
|
||||
<!-- When the audio chip is rendered it already shows duration in
|
||||
its own player; suppress here to avoid two competing numbers. -->
|
||||
{{
|
||||
audioAttachment
|
||||
? $t(subtextKey)
|
||||
|
||||
Reference in New Issue
Block a user