@app-connect/core 1.7.0-beta.5 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/handlers/log.js +3 -3
- package/lib/callLogComposer.js +0 -19
- package/package.json +1 -1
package/handlers/log.js
CHANGED
|
@@ -4,7 +4,7 @@ const { MessageLogModel } = require('../models/messageLogModel');
|
|
|
4
4
|
const { UserModel } = require('../models/userModel');
|
|
5
5
|
const oauth = require('../lib/oauth');
|
|
6
6
|
const errorMessage = require('../lib/generalErrorMessage');
|
|
7
|
-
const { composeCallLog
|
|
7
|
+
const { composeCallLog } = require('../lib/callLogComposer');
|
|
8
8
|
const connectorRegistry = require('../connector/registry');
|
|
9
9
|
const { LOG_DETAILS_FORMAT_TYPE } = require('../lib/constants');
|
|
10
10
|
const { NoteCache } = require('../models/dynamo/noteCacheSchema');
|
|
@@ -84,7 +84,7 @@ async function createCallLog({ platform, userId, incomingData, hashedAccountId,
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
// Compose call log details centrally
|
|
87
|
-
const logFormat = getLogFormatType(platform);
|
|
87
|
+
const logFormat = platformModule.platformModule ? platformModule.getLogFormatType(platform) : LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
|
|
88
88
|
let composedLogDetails = '';
|
|
89
89
|
if (logFormat === LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT || logFormat === LOG_DETAILS_FORMAT_TYPE.HTML || logFormat === LOG_DETAILS_FORMAT_TYPE.MARKDOWN) {
|
|
90
90
|
composedLogDetails = await composeCallLog({
|
|
@@ -324,7 +324,7 @@ async function updateCallLog({ platform, userId, incomingData, hashedAccountId,
|
|
|
324
324
|
|
|
325
325
|
// Fetch existing call log details once to avoid duplicate API calls
|
|
326
326
|
let existingCallLogDetails = null; // Compose updated call log details centrally
|
|
327
|
-
const logFormat = getLogFormatType(platform);
|
|
327
|
+
const logFormat = platformModule.platformModule ? platformModule.getLogFormatType(platform) : LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
|
|
328
328
|
let composedLogDetails = '';
|
|
329
329
|
if (logFormat === LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT || logFormat === LOG_DETAILS_FORMAT_TYPE.HTML || logFormat === LOG_DETAILS_FORMAT_TYPE.MARKDOWN) {
|
|
330
330
|
let existingBody = '';
|
package/lib/callLogComposer.js
CHANGED
|
@@ -615,27 +615,8 @@ function upsertLegs({ body, legs, logFormat }) {
|
|
|
615
615
|
return result;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
/**
|
|
619
|
-
* Helper function to determine format type for a CRM platform
|
|
620
|
-
* @param {string} platform - CRM platform name
|
|
621
|
-
* @returns {string} Format type
|
|
622
|
-
*/
|
|
623
|
-
function getLogFormatType(platform) {
|
|
624
|
-
if(process.env.LOG_FORMAT_PLAIN_TEXT_PLATFORMS.split(',').includes(platform)){
|
|
625
|
-
return LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
|
|
626
|
-
}
|
|
627
|
-
if(process.env.LOG_FORMAT_HTML_PLATFORMS.split(',').includes(platform)){
|
|
628
|
-
return LOG_DETAILS_FORMAT_TYPE.HTML;
|
|
629
|
-
}
|
|
630
|
-
if(process.env.LOG_FORMAT_MARKDOWN_PLATFORMS.split(',').includes(platform)){
|
|
631
|
-
return LOG_DETAILS_FORMAT_TYPE.MARKDOWN;
|
|
632
|
-
}
|
|
633
|
-
return LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
618
|
module.exports = {
|
|
637
619
|
composeCallLog,
|
|
638
|
-
getLogFormatType,
|
|
639
620
|
// Export individual upsert functions for backward compatibility
|
|
640
621
|
upsertCallAgentNote,
|
|
641
622
|
upsertCallSessionId,
|