|
|
|
|
@ -14,12 +14,13 @@ import { useTranslation } from '../../../../../contexts/TranslationContext'; |
|
|
|
|
import { AsyncStatePhase } from '../../../../../hooks/useAsyncState'; |
|
|
|
|
import { useEndpointData } from '../../../../../hooks/useEndpointData'; |
|
|
|
|
import { useFormatDate } from '../../../../../hooks/useFormatDate'; |
|
|
|
|
import CustomField from '../../../components/CustomField'; |
|
|
|
|
import Field from '../../../components/Field'; |
|
|
|
|
import Info from '../../../components/Info'; |
|
|
|
|
import Label from '../../../components/Label'; |
|
|
|
|
import { FormSkeleton } from '../../Skeleton'; |
|
|
|
|
import CustomField from './CustomField'; |
|
|
|
|
import Info from './Info'; |
|
|
|
|
import Label from './Label'; |
|
|
|
|
|
|
|
|
|
function ContactInfo({ id, rid, route }) { |
|
|
|
|
const ContactInfo = ({ id, rid, route }) => { |
|
|
|
|
const t = useTranslation(); |
|
|
|
|
const routePath = useRoute(route || 'omnichannel-directory'); |
|
|
|
|
|
|
|
|
|
@ -73,7 +74,11 @@ function ContactInfo({ id, rid, route }) { |
|
|
|
|
contact: { name, username, visitorEmails, phone, livechatData, ts, lastChat, contactManager }, |
|
|
|
|
} = data || { contact: {} }; |
|
|
|
|
if (state === AsyncStatePhase.LOADING) { |
|
|
|
|
return <FormSkeleton />; |
|
|
|
|
return ( |
|
|
|
|
<Box pi='x24'> |
|
|
|
|
<FormSkeleton /> |
|
|
|
|
</Box> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (error || !data || !data.contact) { |
|
|
|
|
@ -102,7 +107,7 @@ function ContactInfo({ id, rid, route }) { |
|
|
|
|
<VerticalBar.ScrollableContent p='x24'> |
|
|
|
|
<Margins block='x4'> |
|
|
|
|
{displayName && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{`${t('Name')} / ${t('Username')}`}</Label> |
|
|
|
|
<Info style={{ display: 'flex' }}> |
|
|
|
|
<UserAvatar size='x40' title={username} username={username} /> |
|
|
|
|
@ -117,32 +122,32 @@ function ContactInfo({ id, rid, route }) { |
|
|
|
|
</Box> |
|
|
|
|
)} |
|
|
|
|
</Info> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
{visitorEmails && visitorEmails.length && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{t('Email')}</Label> |
|
|
|
|
<Info>{visitorEmails[0].address}</Info> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
{phone && phone.length && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{t('Phone')}</Label> |
|
|
|
|
<Info>{phone[0].phoneNumber}</Info> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
{ts && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{t('Created_at')}</Label> |
|
|
|
|
<Info>{formatDate(ts)}</Info> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{lastChat && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{t('Last_Chat')}</Label> |
|
|
|
|
<Info>{formatDate(lastChat.ts)}</Info> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
{canViewCustomFields() && |
|
|
|
|
livechatData && |
|
|
|
|
@ -152,10 +157,10 @@ function ContactInfo({ id, rid, route }) { |
|
|
|
|
livechatData[key] && <CustomField key={key} id={key} value={livechatData[key]} />, |
|
|
|
|
)} |
|
|
|
|
{contactManager && ( |
|
|
|
|
<> |
|
|
|
|
<Field> |
|
|
|
|
<Label>{t('Contact_Manager')}</Label> |
|
|
|
|
<ContactManagerInfo username={contactManager.username} /> |
|
|
|
|
</> |
|
|
|
|
</Field> |
|
|
|
|
)} |
|
|
|
|
</Margins> |
|
|
|
|
</VerticalBar.ScrollableContent> |
|
|
|
|
@ -173,6 +178,6 @@ function ContactInfo({ id, rid, route }) { |
|
|
|
|
</VerticalBar.Footer> |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export default ContactInfo; |
|
|
|
|
|