Skip to content

Commit

Permalink
legacy support fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Mar 22, 2021
1 parent 815d29a commit b93cb60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions integrations/Clevertap/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class Clevertap {
} catch (err) {
logger.debug(`Error occured at extractCustomFields ${err}`);
}
Object.values(payload).map((vals) => {
if (isObject(vals)) {
Object.keys(payload).map((key) => {
if (isObject(payload[key])) {
logger.debug("cannot process, unsupported traits");
return;
}
Expand Down Expand Up @@ -144,8 +144,8 @@ class Clevertap {
}
window.clevertap.event.push("Charged", ecomProperties);
} else {
Object.values(properties).map((vals) => {
if (isObject(vals) || isArray(vals)) {
Object.keys(properties).map((key) => {
if (isObject(properties[key]) || isArray(properties[key])) {
logger.debug("cannot process, unsupported event");
return;
}
Expand All @@ -171,8 +171,8 @@ class Clevertap {
eventName = "WebPage Viewed";
}
if (properties) {
Object.values(properties).map((vals) => {
if (isObject(vals) || isArray(vals)) {
Object.keys(properties).map((key) => {
if (isObject(properties[key]) || isArray(properties[key])) {
logger.debug("cannot process, unsupported event");
return;
}
Expand Down
12 changes: 7 additions & 5 deletions utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ function extractCustomFields(message, destination, keys, exclusionFields) {
if (messageContext) {
const objKeys = [];
Object.keys(messageContext).map((k) => {
if (!exclusionFields.includes(k)) objKeys.push(k);
if (exclusionFields.indexOf(k) < 0) {
objKeys.push(k);
}
});
objKeys.map((k) => {
if (!(typeof messageContext[k] === "undefined")) {
Expand All @@ -553,9 +555,9 @@ function extractCustomFields(message, destination, keys, exclusionFields) {
return destination;
}
/**
*
* @param {*} message
*
*
* @param {*} message
*
* Use get-value to retrieve defined trais from message traits
*/
function getDefinedTraits(message) {
Expand Down Expand Up @@ -640,5 +642,5 @@ export {
extractCustomFields,
getDefinedTraits,
isObject,
isArray
isArray,
};

0 comments on commit b93cb60

Please sign in to comment.