From 13e2c69ad685365c600bdf37a1a2ac8121e95dd3 Mon Sep 17 00:00:00 2001 From: Da Kong Date: Fri, 3 Jan 2025 16:20:57 +0800 Subject: [PATCH] fix: bullhorn note --- src/adapters/bullhorn/index.js | 10 +++++----- src/adapters/pipedrive/index.js | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/adapters/bullhorn/index.js b/src/adapters/bullhorn/index.js index 6dd6056f..790c8c15 100644 --- a/src/adapters/bullhorn/index.js +++ b/src/adapters/bullhorn/index.js @@ -388,7 +388,7 @@ async function createContact({ user, authHeader, phoneNumber, newContactName, ne async function createCallLog({ user, contactInfo, authHeader, callLog, note, additionalSubmission, aiNote, transcript }) { const noteActions = additionalSubmission.noteActions ?? ''; const subject = callLog.customSubject ?? `${callLog.direction} Call ${callLog.direction === 'Outbound' ? `to ${contactInfo.name}` : `from ${contactInfo.name}`}`; - let comments = 'Agent notes
';; + let comments = 'Agent notes';; if (user.userSettings?.addCallLogNote?.value ?? true) { comments = upsertCallAgentNote({ body: comments, note }); } comments += 'Call details')[0]?.split('
  • Summary: ')[1]?.split('
  • ')[0] ?? ''; const totalContactCount = getLogRes.data.data.clientContacts.total + getLogRes.data.data.candidates.total; let contact = { @@ -749,12 +749,12 @@ function upsertCallAgentNote({ body, note }) { if (!!!note) { return body; } - const noteRegex = RegExp('Agent notes
    ([\\s\\S]+?)

    '); + const noteRegex = RegExp('Agent notes([\\s\\S]+?)Call details
    '); if (noteRegex.test(body)) { - body = body.replace(noteRegex, `Agent notes
    ${note}

    `); + body = body.replace(noteRegex, `Agent notes
    ${note}

    Call details`); } else { - body += `${note}

    `; + body += `
    ${note}

    `; } return body; } diff --git a/src/adapters/pipedrive/index.js b/src/adapters/pipedrive/index.js index fe052a97..90a91dfc 100644 --- a/src/adapters/pipedrive/index.js +++ b/src/adapters/pipedrive/index.js @@ -372,7 +372,7 @@ async function getCallLog({ user, callLogId, authHeader }) { headers: { 'Authorization': authHeader } }); const logBody = getLogRes.data.data.note; - const note = logBody.split('
  • Summary: ')[1]?.split('
  • ')[0] ?? ''; + const note = logBody.split('Agent notes')[1]?.split('Call details')[0]?.replaceAll('
    ', '') ?? ''; const relatedContact = getLogRes.data.related_objects?.person; let contactName = 'Unknown'; if (!!relatedContact) { @@ -392,9 +392,9 @@ function upsertCallAgentNote({ body, note }) { if (!!!note) { return body; } - const noteRegex = RegExp('Agent notes
    ([\\s\\S]+?)

    '); + const noteRegex = RegExp('Agent notes([\\s\\S]+?)Call details
    '); if (noteRegex.test(body)) { - body = body.replace(noteRegex, `Agent notes
    ${note}

    `); + body = body.replace(noteRegex, `Agent notes
    ${note}

    Call details`); } else { body += `
    ${note}

    `;