fix(contacts): expose root country code
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ const prepareStateBasedOnProps = () => {
|
||||
name = '',
|
||||
email: emailAddress,
|
||||
phoneNumber,
|
||||
countryCode: contactCountryCode = '',
|
||||
additionalAttributes = {},
|
||||
} = props.contactData || {};
|
||||
const { firstName, lastName } = splitName(name || '');
|
||||
@@ -122,7 +123,7 @@ const prepareStateBasedOnProps = () => {
|
||||
additionalAttributes: {
|
||||
description,
|
||||
companyName,
|
||||
countryCode,
|
||||
countryCode: contactCountryCode || countryCode,
|
||||
country,
|
||||
city,
|
||||
socialProfiles: {
|
||||
|
||||
@@ -94,6 +94,7 @@ const handleAvatarHover = (id, isHovered) => {
|
||||
:email="contact.email"
|
||||
:thumbnail="contact.thumbnail"
|
||||
:phone-number="contact.phoneNumber"
|
||||
:country-code="contact.countryCode"
|
||||
:additional-attributes="contact.additionalAttributes"
|
||||
:availability-status="contact.availabilityStatus"
|
||||
:is-expanded="expandedCardId === contact.id"
|
||||
|
||||
Reference in New Issue
Block a user