feat(voice): resolve country name from country_code in call widget

When a contact has only country_code (e.g. "US") stored in
additional_attributes and not the full country name, the floating call
widget now falls back to the shared countries list to render
"City, Country" in the location line.
This commit is contained in:
Tanmay Deep Sharma
2026-05-13 15:02:36 +05:30
parent a985010a40
commit 5d9c979ace
@@ -7,6 +7,7 @@ import { setWhatsappCallMuted } from 'dashboard/composables/useWhatsappCallSessi
import { frontendURL, conversationUrl } from 'dashboard/helper/URLHelper';
import WindowVisibilityHelper from 'dashboard/helper/AudioAlerts/WindowVisibilityHelper';
import CallCard from 'dashboard/components/widgets/call/CallCard.vue';
import countriesList from 'shared/constants/countries.js';
const RINGTONE_URL = '/audio/dashboard/bell.mp3';
@@ -71,8 +72,11 @@ const getCallInfo = call => {
const caller = call?.caller;
const additional = sender?.additional_attributes || {};
const city = additional.city || '';
const country = additional.country || '';
const countryCode = additional.country_code || '';
const country =
additional.country ||
countriesList.find(c => c.id === countryCode.toUpperCase())?.name ||
'';
// Prefer the richest available location string ("City, Country"); fall back to
// whichever single field is present; finally fall back to the inbox name so
// there's always something to show.