fix(contacts): expose root country code

This commit is contained in:
Sojan Jose
2026-05-27 01:17:09 +05:30
parent 4705a5c3ff
commit 25c11ecc56
10 changed files with 29 additions and 6 deletions
@@ -16,6 +16,7 @@ const props = defineProps({
name: { type: String, default: '' },
email: { type: String, default: '' },
additionalAttributes: { type: Object, default: () => ({}) },
countryCode: { type: String, default: '' },
phoneNumber: { type: String, default: '' },
thumbnail: { type: String, default: '' },
availabilityStatus: { type: String, default: null },
@@ -42,6 +43,7 @@ const getInitialContactData = () => ({
name: props.name,
email: props.email,
phoneNumber: props.phoneNumber,
countryCode: props.countryCode,
additionalAttributes: props.additionalAttributes,
});
@@ -58,12 +60,13 @@ const countriesMap = computed(() => {
const countryDetails = computed(() => {
const attributes = props.additionalAttributes || {};
const { country, countryCode, city } = attributes;
const { country, countryCode: additionalCountryCode, city } = attributes;
const countryCode = props.countryCode || additionalCountryCode;
if (!country && !countryCode) return null;
const activeCountry =
countriesMap.value[country] || countriesMap.value[countryCode];
countriesMap.value[countryCode] || countriesMap.value[country];
if (!activeCountry) return null;