Skip to content

Commit

Permalink
chore: refactor screen code for evType and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Nov 7, 2023
1 parent c99361b commit 5412023
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/v0/destinations/am/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const getScreenevTypeAndUpdatedProperties = (message, CATEGORY_KEY) => {
const name = message.name || message.event || get(message, CATEGORY_KEY);
const updatedName = name ? `${name} ` : '';
return {
evType: `Viewed ${updatedName}Screen`,
eventType: `Viewed ${updatedName}Screen`,
updatedProperties: {
...message.properties,
name,
Expand Down Expand Up @@ -589,7 +589,6 @@ const processSingleMessage = (message, destination) => {
// To be used for track/page calls to associate the event to a group in AM
let groupInfo = get(message, 'integrations.Amplitude.groups') || undefined;
let category = ConfigCategory.DEFAULT;
let updatedProperties;
const { name, event, properties } = message;
const messageType = message.type.toLowerCase();
const CATEGORY_KEY = 'properties.category';
Expand Down Expand Up @@ -629,9 +628,15 @@ const processSingleMessage = (message, destination) => {
category = ConfigCategory.PAGE;
break;
case EventType.SCREEN:
({ evType, updatedProperties } = getScreenevTypeAndUpdatedProperties(message, CATEGORY_KEY));
message.properties = updatedProperties;
category = ConfigCategory.SCREEN;
{
const { eventType, updatedProperties } = getScreenevTypeAndUpdatedProperties(
message,
CATEGORY_KEY,
);
evType = eventType;
message.properties = updatedProperties;
category = ConfigCategory.SCREEN;
}
break;
case EventType.GROUP:
evType = 'group';
Expand Down

0 comments on commit 5412023

Please sign in to comment.