Skip to content

Commit

Permalink
sonarcloud fix+1
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Nov 2, 2023
1 parent c2c5001 commit 9320251
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/v0/destinations/am/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ const getGroupInfo = (destination, groupInfo, groupTraits) => {
}
return groupInfo;
};
const getUpdatedPageNameWithoutUserDefinedPageEventName = (name, message, CATEGORY_KEY) =>
name || get(message, CATEGORY_KEY) ? `${name || get(message, CATEGORY_KEY)} ` : undefined;

// Generic process function which invokes specific handler functions depending on message type
// and event type where applicable
const processSingleMessage = (message, destination) => {
Expand Down Expand Up @@ -612,11 +615,13 @@ const processSingleMessage = (message, destination) => {
.trim()
.replaceAll(/{{([^{}]+)}}/g, get(message, getMessagePath));
} else {
const updatedName =
name || get(message, CATEGORY_KEY) ? `${name || get(message, CATEGORY_KEY)} ` : undefined;
const updatedName = getUpdatedPageNameWithoutUserDefinedPageEventName(
name,
message,
CATEGORY_KEY,
);
evType = `Viewed ${updatedName || ''}Page`;
}

message.properties = {
...message.properties,
name: name || get(message, CATEGORY_KEY),
Expand Down

0 comments on commit 9320251

Please sign in to comment.