Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// const contactId = currentContact.id;
const activityCardId = sessionId ? `${currentContact.id}-${sessionId}` : currentContact.id;
if (recentMessages.messages[activityCardId]) {
messages = recentMessages.messages[activityCardId];
}
if (recentCalls.calls[activityCardId]) {
calls = recentCalls.calls[activityCardId];
}
if (recentMessages.unreadMessageCounts[activityCardId]) {
unreadMessageCounts = recentMessages.unreadMessageCounts[activityCardId];
}
}
const tabs = [
{
icon: <span>,
label: i18n.getString('call', currentLocale),
path: 'recentCalls',
isActive: path => path === 'recentCalls',
view: (
),
getData: () => {
recentCalls.getCalls({ currentContact, sessionId });
},
cleanUp: () => recentCalls.cleanUpCalls({ contact: currentContact, sessionId })
},
{</span>
view: (
),
getData: () => {
recentCalls.getCalls({ currentContact, sessionId });
},
cleanUp: () => recentCalls.cleanUpCalls({ contact: currentContact, sessionId })
},
{
icon: <span>,
label: i18n.getString('text', currentLocale),
path: 'recentMessages',
noticeCounts: unreadMessageCounts,
isActive: path => path === 'recentMessages',
view: (
),
getData: () => {
recentMessages.getMessages({ currentContact, sessionId });
},
cleanUp: () => recentMessages.cleanUpMessages({ contact: currentContact, sessionId })</span>
sessionId = session.id;
currentContact = session.contactMatch;
const contactMapping = contactMatcher && contactMatcher.dataMapping;
const phoneNumber = session.direction === callDirections.outbound ?
session.to : session.from;
if (!currentContact) {
currentContact = contactMapping && contactMapping[phoneNumber];
if (currentContact && currentContact.length >= 1) {
currentContact = currentContact[0];
}
}
ready = ready && contactMatcher.ready;
}
return {
currentLocale,
title: i18n.getString('recentActivities', locale.currentLocale),
showSpinner: !ready,
currentContact,
calls: recentCalls.calls || [],
tabs: getTabs({
ready,
currentLocale,
dateTimeFormatter,
navigateTo,
currentContact,
recentMessages,
recentCalls,
thirdPartyService,
sessionId,
}),
defaultTab: 'recentCalls',
};