Skip to content
Snippets Groups Projects
Unverified Commit e72e9d63 authored by Matheus Barbosa Silva's avatar Matheus Barbosa Silva Committed by GitHub
Browse files

regression: Use visitor activity to define if its contact is unknown (#33993)

parent bef9138b
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,7 @@ const dataMap: [Partial<ILivechatVisitor>, IOmnichannelSource, CreateContactPara
{
_id: 'visitor1',
username: 'Username',
activity: ['2024-11'],
lastChat: {
_id: 'last-chat-id',
ts: testDate,
......@@ -134,6 +135,41 @@ const dataMap: [Partial<ILivechatVisitor>, IOmnichannelSource, CreateContactPara
contactManager: undefined,
},
],
[
{
_id: 'visitor1',
username: 'Username',
activity: [],
},
{
type: OmnichannelSourceType.WIDGET,
},
{
name: 'Username',
emails: undefined,
phones: undefined,
unknown: true,
channels: [
{
name: 'sms',
visitor: {
visitorId: 'visitor1',
source: {
type: OmnichannelSourceType.WIDGET,
},
},
blocked: false,
verified: false,
details: {
type: OmnichannelSourceType.WIDGET,
},
},
],
customFields: undefined,
contactManager: undefined,
},
],
];
describe('mapVisitorToContact', () => {
......
......@@ -8,7 +8,7 @@ export async function mapVisitorToContact(visitor: ILivechatVisitor, source: IOm
name: visitor.name || visitor.username,
emails: visitor.visitorEmails?.map(({ address }) => address),
phones: visitor.phone?.map(({ phoneNumber }) => phoneNumber),
unknown: true,
unknown: !visitor.activity || visitor.activity.length === 0,
channels: [
{
name: source.label || source.type.toString(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment